|
17 | 17 |
|
18 | 18 | import numpy as np |
19 | 19 |
|
20 | | -import xrt.backends.raycing.sources as rsources |
| 20 | +# import xrt.backends.raycing.sources as rsources |
21 | 21 | import xrt.backends.raycing.screens as rscreens |
22 | 22 | import xrt.backends.raycing.materials as rmats |
23 | | -import xrt.backends.raycing.materials.elemental as rmatsel |
24 | | -import xrt.backends.raycing.materials.compounds as rmatsco |
25 | | -import xrt.backends.raycing.materials.crystals as rmatscr |
| 23 | +# import xrt.backends.raycing.materials.elemental as rmatsel |
| 24 | +# import xrt.backends.raycing.materials.compounds as rmatsco |
| 25 | +# import xrt.backends.raycing.materials.crystals as rmatscr |
26 | 26 | import xrt.backends.raycing.oes as roes |
27 | 27 | import xrt.backends.raycing.apertures as rapts |
28 | 28 | import xrt.backends.raycing.run as rrun |
29 | 29 | import xrt.backends.raycing as raycing |
30 | 30 | import xrt.plotter as xrtplot |
31 | 31 | import xrt.runner as xrtrun |
32 | 32 |
|
| 33 | +def build_histRGB(lb, gb, limits=None, isScreen=False, shape=None): |
| 34 | + if shape is None: |
| 35 | + shape = [256, 256] |
| 36 | + good = (lb.state == 1) | (lb.state == 2) |
| 37 | + if isScreen: |
| 38 | + x, y, z = lb.x[good], lb.z[good], lb.y[good] |
| 39 | + else: |
| 40 | + x, y, z = lb.x[good], lb.y[good], lb.z[good] |
| 41 | + goodlen = len(lb.x[good]) |
| 42 | + hist2dRGB = np.zeros((shape[1], shape[0], 3), dtype=np.float64) |
| 43 | + hist2d = np.zeros((shape[1], shape[0]), dtype=np.float64) |
| 44 | + |
| 45 | + if limits is None and goodlen > 0: |
| 46 | + limits = np.array([[np.min(x), np.max(x)], [np.min(y), np.max(y)], [np.min(z), np.max(z)]]) |
| 47 | + |
| 48 | + if goodlen > 0: |
| 49 | + beamLimits = [limits[1], limits[0]] or None |
| 50 | + flux = gb.Jss[good] + gb.Jpp[good] |
| 51 | + hist2d, _, _ = np.histogram2d(y, x, bins=[shape[1], shape[0]], range=beamLimits, weights=flux) |
| 52 | + hist2dRGB = None |
| 53 | + return hist2d, hist2dRGB, limits |
| 54 | + |
33 | 55 | CVD = rmats.Material( |
34 | 56 | elements=['C'], |
35 | 57 | quantities=[1.0], |
|
51 | 73 | V=160.17128543981727, |
52 | 74 | elements=['Si'], |
53 | 75 | quantities=[1.0], |
54 | | - name=r"Si220", |
55 | | - kind=r"crystal") |
| 76 | + name=r"Si220") |
56 | 77 |
|
57 | 78 | CVDcoating = rmats.Material( |
58 | 79 | elements=['C'], |
|
91 | 112 | beta=1.5707963267948966, |
92 | 113 | gamma=1.5707963267948966, |
93 | 114 | atomsFraction=[1, 1, 1, 1, 1, 1, 1, 1], |
94 | | - d=1.916079064786341, |
95 | | - V=159.1751463370933, |
96 | | - elements=['Si', 'Si', 'Si', 'Si', 'Si', 'Si', 'Si', 'Si'], |
97 | | - quantities=[1, 1, 1, 1, 1, 1, 1, 1], |
98 | | - rho=2.3439368026411915, |
99 | | - kind=r"crystal harmonics") |
| 115 | + # V=159.1751463370933, |
| 116 | + # elements=['Si', 'Si', 'Si', 'Si', 'Si', 'Si', 'Si', 'Si'], |
| 117 | + # quantities=[1, 1, 1, 1, 1, 1, 1, 1], |
| 118 | + # rho=2.3439368026411915, |
| 119 | + # kind=r"crystal harmonics" |
| 120 | + ) |
100 | 121 |
|
101 | 122 |
|
102 | 123 | def build_beamline(): |
103 | 124 | BioXAS_Main = raycing.BeamLine( |
104 | | - alignE=8000, |
105 | | - name=r"BioXAS_Main") |
| 125 | + alignE=8000) |
106 | 126 |
|
107 | | - BioXAS_Main.Wiggler = raycing.sources.synchr.Wiggler( |
| 127 | + # BioXAS_Main.Wiggler = raycing.sources.synchr.Wiggler( |
| 128 | + BioXAS_Main.Wiggler = raycing.sources_synchr.Wiggler( |
108 | 129 | bl=BioXAS_Main, |
109 | 130 | name=r"Wiggler", |
110 | 131 | center=[0, 0, 0], |
@@ -202,9 +223,10 @@ def build_beamline(): |
202 | 223 | center=[0, 26000, r"auto"], |
203 | 224 | x=[1.0, -0.0, 0.0], |
204 | 225 | z=[0.0, 0.0, 1.0], |
205 | | - limPhysX=[0.0, 0.0], |
206 | | - limPhysY=[0.0, 0.0], |
207 | | - cLimits=[0.0, 0.0]) |
| 226 | + # limPhysX=[0.0, 0.0], |
| 227 | + # limPhysY=[0.0, 0.0], |
| 228 | + # cLimits=[0.0, 0.0] |
| 229 | + ) |
208 | 230 |
|
209 | 231 | BioXAS_Main.Mirror2 = roes.ToroidMirror( |
210 | 232 | bl=BioXAS_Main, |
@@ -266,9 +288,10 @@ def build_beamline(): |
266 | 288 | center=[0, 30650, r"auto"], |
267 | 289 | x=[1.0, -0.0, 0.0], |
268 | 290 | z=[0.0, 0.0, 1.0], |
269 | | - limPhysX=[0.0, 0.0], |
270 | | - limPhysY=[0.0, 0.0], |
271 | | - cLimits=[0.0, 0.0]) |
| 291 | + # limPhysX=[0.0, 0.0], |
| 292 | + # limPhysY=[0.0, 0.0], |
| 293 | + # cLimits=[0.0, 0.0]) |
| 294 | + ) |
272 | 295 |
|
273 | 296 | return BioXAS_Main |
274 | 297 |
|
|
0 commit comments