syned 1.0.47__py3-none-any.whl → 1.0.49__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- syned/beamline/__init__.py +1 -1
- syned/beamline/beamline.py +155 -155
- syned/beamline/beamline_element.py +76 -76
- syned/beamline/element_coordinates.py +199 -199
- syned/beamline/optical_element.py +47 -47
- syned/beamline/optical_element_with_surface_shape.py +126 -126
- syned/beamline/optical_elements/__init__.py +1 -1
- syned/beamline/optical_elements/absorbers/absorber.py +21 -21
- syned/beamline/optical_elements/absorbers/beam_stopper.py +63 -63
- syned/beamline/optical_elements/absorbers/filter.py +61 -61
- syned/beamline/optical_elements/absorbers/holed_filter.py +67 -67
- syned/beamline/optical_elements/absorbers/slit.py +80 -80
- syned/beamline/optical_elements/crystals/__init__.py +1 -1
- syned/beamline/optical_elements/crystals/crystal.py +70 -70
- syned/beamline/optical_elements/gratings/__init__.py +1 -1
- syned/beamline/optical_elements/gratings/grating.py +279 -279
- syned/beamline/optical_elements/ideal_elements/__init__.py +1 -1
- syned/beamline/optical_elements/ideal_elements/ideal_element.py +15 -15
- syned/beamline/optical_elements/ideal_elements/ideal_fzp.py +183 -183
- syned/beamline/optical_elements/ideal_elements/ideal_lens.py +54 -54
- syned/beamline/optical_elements/ideal_elements/screen.py +15 -15
- syned/beamline/optical_elements/mirrors/__init__.py +1 -1
- syned/beamline/optical_elements/mirrors/mirror.py +39 -39
- syned/beamline/optical_elements/multilayers/__init__.py +46 -46
- syned/beamline/optical_elements/multilayers/multilayer.py +45 -45
- syned/beamline/optical_elements/refractors/__init__.py +1 -1
- syned/beamline/optical_elements/refractors/crl.py +79 -79
- syned/beamline/optical_elements/refractors/interface.py +60 -60
- syned/beamline/optical_elements/refractors/lens.py +105 -105
- syned/beamline/shape.py +2884 -2803
- syned/storage_ring/__init__.py +1 -1
- syned/storage_ring/electron_beam.py +804 -804
- syned/storage_ring/empty_light_source.py +40 -40
- syned/storage_ring/light_source.py +90 -90
- syned/storage_ring/magnetic_structure.py +8 -8
- syned/storage_ring/magnetic_structures/__init__.py +1 -1
- syned/storage_ring/magnetic_structures/bending_magnet.py +329 -329
- syned/storage_ring/magnetic_structures/insertion_device.py +169 -169
- syned/storage_ring/magnetic_structures/undulator.py +413 -413
- syned/storage_ring/magnetic_structures/wiggler.py +27 -27
- syned/syned_object.py +273 -264
- syned/util/__init__.py +21 -21
- syned/util/json_tools.py +196 -198
- syned/widget/widget_decorator.py +66 -66
- {syned-1.0.47.dist-info → syned-1.0.49.dist-info}/METADATA +88 -88
- syned-1.0.49.dist-info/RECORD +52 -0
- {syned-1.0.47.dist-info → syned-1.0.49.dist-info}/WHEEL +1 -1
- {syned-1.0.47.dist-info → syned-1.0.49.dist-info}/licenses/LICENSE +20 -20
- syned/__test/__init__.py +0 -46
- syned/__test/test.py +0 -28
- syned-1.0.47.dist-info/RECORD +0 -54
- {syned-1.0.47.dist-info → syned-1.0.49.dist-info}/top_level.txt +0 -0
|
@@ -1,279 +1,279 @@
|
|
|
1
|
-
from syned.beamline.shape import SurfaceShape, BoundaryShape
|
|
2
|
-
from syned.beamline.optical_element_with_surface_shape import OpticalElementsWithSurfaceShape
|
|
3
|
-
|
|
4
|
-
class Grating(OpticalElementsWithSurfaceShape):
|
|
5
|
-
"""
|
|
6
|
-
Constructor.
|
|
7
|
-
|
|
8
|
-
Parameters
|
|
9
|
-
----------
|
|
10
|
-
name : str, optional
|
|
11
|
-
The name of the optical element.
|
|
12
|
-
surface_shape : instance of SurfaceShape, optional
|
|
13
|
-
The geometry of the crystal surface. if None, it is initialized to SurfaceShape().
|
|
14
|
-
boundary_shape : instance of BoundaryShape, optional
|
|
15
|
-
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
16
|
-
ruling : float, optional
|
|
17
|
-
The grating ruling in lines/m.
|
|
18
|
-
|
|
19
|
-
"""
|
|
20
|
-
def __init__(self,
|
|
21
|
-
name="Undefined",
|
|
22
|
-
surface_shape=SurfaceShape(),
|
|
23
|
-
boundary_shape=BoundaryShape(),
|
|
24
|
-
ruling=800e3,
|
|
25
|
-
):
|
|
26
|
-
super().__init__(name, surface_shape, boundary_shape)
|
|
27
|
-
self._ruling = ruling
|
|
28
|
-
|
|
29
|
-
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
30
|
-
self._set_support_text([
|
|
31
|
-
("name", "Name" , "" ),
|
|
32
|
-
("surface_shape", "Surface Shape" , "" ),
|
|
33
|
-
("boundary_shape", "Boundary Shape" , "" ),
|
|
34
|
-
("ruling", "Ruling at center" , "lines/m" ),
|
|
35
|
-
] )
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class GratingVLS(Grating):
|
|
39
|
-
"""
|
|
40
|
-
Constructor.
|
|
41
|
-
|
|
42
|
-
Parameters
|
|
43
|
-
----------
|
|
44
|
-
name : str, optional
|
|
45
|
-
The name of the optical element.
|
|
46
|
-
surface_shape : instance of SurfaceShape, optional
|
|
47
|
-
The geometry of the optical element surface. if None, it is initialized to SurfaceShape().
|
|
48
|
-
boundary_shape : instance of BoundaryShape, optional
|
|
49
|
-
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
50
|
-
ruling : float, optional
|
|
51
|
-
The grating ruling polinomial coefficient of 0th order [lines/m].
|
|
52
|
-
ruling_coeff_linear : float, optional
|
|
53
|
-
The grating ruling polinomial coefficient of 1th order [lines/m^2].
|
|
54
|
-
ruling_coeff_quadratic : float, optional
|
|
55
|
-
The grating ruling polinomial coefficient of 2th order [lines/m^3].
|
|
56
|
-
ruling_coeff_cubic : float, optional
|
|
57
|
-
The grating ruling polinomial coefficient of 3th order [lines/m^4].
|
|
58
|
-
ruling_coeff_quartic : float, optional
|
|
59
|
-
The grating ruling polinomial coefficient of 4th order [lines/m^5].
|
|
60
|
-
coating : str, optional
|
|
61
|
-
The grating coating material.
|
|
62
|
-
coating_thickness : float, optional
|
|
63
|
-
The grating coating thickness in m.
|
|
64
|
-
|
|
65
|
-
"""
|
|
66
|
-
def __init__(self,
|
|
67
|
-
name="Undefined",
|
|
68
|
-
surface_shape=SurfaceShape(),
|
|
69
|
-
boundary_shape=BoundaryShape(),
|
|
70
|
-
ruling=800e3,
|
|
71
|
-
ruling_coeff_linear=0.0,
|
|
72
|
-
ruling_coeff_quadratic=0.0,
|
|
73
|
-
ruling_coeff_cubic=0.0,
|
|
74
|
-
ruling_coeff_quartic=0.0,
|
|
75
|
-
coating=None,
|
|
76
|
-
coating_thickness=None,
|
|
77
|
-
):
|
|
78
|
-
super().__init__(name, surface_shape, boundary_shape)
|
|
79
|
-
|
|
80
|
-
self._ruling = ruling
|
|
81
|
-
self._ruling_coeff_linear = ruling_coeff_linear
|
|
82
|
-
self._ruling_coeff_quadratic = ruling_coeff_quadratic
|
|
83
|
-
self._ruling_coeff_cubic = ruling_coeff_cubic
|
|
84
|
-
self._ruling_coeff_quartic = ruling_coeff_quartic
|
|
85
|
-
self._coating = coating
|
|
86
|
-
self._coating_thickness = coating_thickness
|
|
87
|
-
|
|
88
|
-
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
89
|
-
self._set_support_text([
|
|
90
|
-
("name", "Name" , "" ),
|
|
91
|
-
("surface_shape", "Surface Shape" , "" ),
|
|
92
|
-
("boundary_shape", "Boundary Shape" , "" ),
|
|
93
|
-
("ruling", "Ruling at center" , "lines/m" ),
|
|
94
|
-
("ruling_coeff_linear", "Ruling linear coeff", "lines/m^2"),
|
|
95
|
-
("ruling_coeff_quadratic", "Ruling quadratic coeff", "lines/m^3"),
|
|
96
|
-
("ruling_coeff_cubic", "Ruling cubic coeff", "lines/m^4"),
|
|
97
|
-
("ruling_coeff_quartic", "Ruling quartic coeff", "lines/m^5"),
|
|
98
|
-
("coating", "Coating (element, compound or name)", ""),
|
|
99
|
-
("coating_thickness", "Coating thickness", "m"),
|
|
100
|
-
] )
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
class GratingBlaze(GratingVLS):
|
|
104
|
-
"""
|
|
105
|
-
Constructor.
|
|
106
|
-
|
|
107
|
-
Parameters
|
|
108
|
-
----------
|
|
109
|
-
name : str, optional
|
|
110
|
-
The name of the optical element.
|
|
111
|
-
surface_shape : instance of SurfaceShape, optional
|
|
112
|
-
The geometry of the crystal surface. if None, it is initialized to SurfaceShape().
|
|
113
|
-
boundary_shape : instance of BoundaryShape, optional
|
|
114
|
-
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
115
|
-
ruling : float, optional
|
|
116
|
-
The grating ruling polinomial coefficient of 0th order [lines/m].
|
|
117
|
-
ruling_coeff_linear : float, optional
|
|
118
|
-
The grating ruling polinomial coefficient of 1th order [lines/m^2].
|
|
119
|
-
ruling_coeff_quadratic : float, optional
|
|
120
|
-
The grating ruling polinomial coefficient of 2th order [lines/m^3].
|
|
121
|
-
ruling_coeff_cubic : float, optional
|
|
122
|
-
The grating ruling polinomial coefficient of 3th order [lines/m^4].
|
|
123
|
-
ruling_coeff_quartic : float, optional
|
|
124
|
-
The grating ruling polinomial coefficient of 4th order [lines/m^5].
|
|
125
|
-
coating : str, optional
|
|
126
|
-
The grating coating material.
|
|
127
|
-
coating_thickness : float, optional
|
|
128
|
-
The grating coating thickness in m.
|
|
129
|
-
blaze_angle : float, optional
|
|
130
|
-
The blaze angle in rad.
|
|
131
|
-
antiblaze_angle : float, optional
|
|
132
|
-
The anti-blaze angle in rad.
|
|
133
|
-
|
|
134
|
-
"""
|
|
135
|
-
def __init__(self,
|
|
136
|
-
name="Undefined",
|
|
137
|
-
surface_shape=SurfaceShape(),
|
|
138
|
-
boundary_shape=BoundaryShape(),
|
|
139
|
-
ruling=800e3,
|
|
140
|
-
ruling_coeff_linear=0.0,
|
|
141
|
-
ruling_coeff_quadratic=0.0,
|
|
142
|
-
ruling_coeff_cubic=0.0,
|
|
143
|
-
ruling_coeff_quartic=0.0,
|
|
144
|
-
coating=None,
|
|
145
|
-
coating_thickness=None,
|
|
146
|
-
blaze_angle=0.0,
|
|
147
|
-
antiblaze_angle=90.0,
|
|
148
|
-
):
|
|
149
|
-
super().__init__(name, surface_shape, boundary_shape,
|
|
150
|
-
ruling=ruling,
|
|
151
|
-
ruling_coeff_linear=ruling_coeff_linear,
|
|
152
|
-
ruling_coeff_quadratic=ruling_coeff_quadratic,
|
|
153
|
-
ruling_coeff_cubic=ruling_coeff_cubic,
|
|
154
|
-
ruling_coeff_quartic=ruling_coeff_quartic,
|
|
155
|
-
coating=coating,
|
|
156
|
-
coating_thickness=coating_thickness,
|
|
157
|
-
)
|
|
158
|
-
self._blaze_angle = blaze_angle
|
|
159
|
-
self._antiblaze_angle = antiblaze_angle
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
163
|
-
self._set_support_text([
|
|
164
|
-
("name", "Name", ""),
|
|
165
|
-
("surface_shape", "Surface Shape", ""),
|
|
166
|
-
("boundary_shape", "Boundary Shape", ""),
|
|
167
|
-
("ruling", "Ruling at center", "lines/m"),
|
|
168
|
-
("ruling_coeff_linear", "Ruling linear coeff", "lines/m^2"),
|
|
169
|
-
("ruling_coeff_quadratic", "Ruling quadratic coeff", "lines/m^3"),
|
|
170
|
-
("ruling_coeff_cubic", "Ruling cubic coeff", "lines/m^4"),
|
|
171
|
-
("ruling_coeff_quartic", "Ruling quartic coeff", "lines/m^5"),
|
|
172
|
-
("coating", "Coating (element, compound or name)", ""),
|
|
173
|
-
("coating_thickness", "Coating thickness", "m"),
|
|
174
|
-
("blaze_angle", "Blaze angle", "rad"),
|
|
175
|
-
("antiblaze_angle", "Antiblaze angle", "rad"),
|
|
176
|
-
] )
|
|
177
|
-
|
|
178
|
-
def get_apex_angle(self):
|
|
179
|
-
return 180 - self._blaze_angle - self._antiblaze_angle
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
class GratingLamellar(GratingVLS):
|
|
183
|
-
"""
|
|
184
|
-
Constructor.
|
|
185
|
-
|
|
186
|
-
Parameters
|
|
187
|
-
----------
|
|
188
|
-
name : str, optional
|
|
189
|
-
The name of the optical element.
|
|
190
|
-
surface_shape : instance of SurfaceShape, optional
|
|
191
|
-
The geometry of the crystal surface. if None, it is initialized to SurfaceShape().
|
|
192
|
-
boundary_shape : instance of BoundaryShape, optional
|
|
193
|
-
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
194
|
-
ruling : float, optional
|
|
195
|
-
The grating ruling polinomial coefficient of 0th order [lines/m].
|
|
196
|
-
ruling_coeff_linear : float, optional
|
|
197
|
-
The grating ruling polinomial coefficient of 1th order [lines/m^2].
|
|
198
|
-
ruling_coeff_quadratic : float, optional
|
|
199
|
-
The grating ruling polinomial coefficient of 2th order [lines/m^3].
|
|
200
|
-
ruling_coeff_cubic : float, optional
|
|
201
|
-
The grating ruling polinomial coefficient of 3th order [lines/m^4].
|
|
202
|
-
ruling_coeff_quartic : float, optional
|
|
203
|
-
The grating ruling polinomial coefficient of 4th order [lines/m^5].
|
|
204
|
-
coating : str, optional
|
|
205
|
-
The grating coating material.
|
|
206
|
-
coating_thickness : float, optional
|
|
207
|
-
The grating coating thickness in m.
|
|
208
|
-
height : str, optional
|
|
209
|
-
The height of the grating lamella in m.
|
|
210
|
-
ratio_valley_to_period : float, optional
|
|
211
|
-
The grating ration valley to period.
|
|
212
|
-
|
|
213
|
-
"""
|
|
214
|
-
|
|
215
|
-
def __init__(self,
|
|
216
|
-
name="Undefined",
|
|
217
|
-
surface_shape=SurfaceShape(),
|
|
218
|
-
boundary_shape=BoundaryShape(),
|
|
219
|
-
ruling=800e3,
|
|
220
|
-
ruling_coeff_linear=0.0,
|
|
221
|
-
ruling_coeff_quadratic=0.0,
|
|
222
|
-
ruling_coeff_cubic=0.0,
|
|
223
|
-
coating=None,
|
|
224
|
-
coating_thickness=None,
|
|
225
|
-
height=1e-6,
|
|
226
|
-
ratio_valley_to_period=0.5, # TODO: is better to define ratio valley to height?
|
|
227
|
-
):
|
|
228
|
-
super().__init__(name, surface_shape, boundary_shape,
|
|
229
|
-
ruling=ruling,
|
|
230
|
-
ruling_coeff_linear=ruling_coeff_linear,
|
|
231
|
-
ruling_coeff_quadratic=ruling_coeff_quadratic,
|
|
232
|
-
ruling_coeff_cubic=ruling_coeff_cubic,
|
|
233
|
-
coating=coating,
|
|
234
|
-
coating_thickness=coating_thickness,
|
|
235
|
-
)
|
|
236
|
-
self._height = height
|
|
237
|
-
self._ratio_valley_to_period = ratio_valley_to_period
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
241
|
-
self._set_support_text([
|
|
242
|
-
("name", "Name", ""),
|
|
243
|
-
("surface_shape", "Surface Shape", ""),
|
|
244
|
-
("boundary_shape", "Boundary Shape", ""),
|
|
245
|
-
("ruling", "Ruling at center", "lines/m"),
|
|
246
|
-
("ruling_coeff_linear", "Ruling linear coeff", "lines/m^2"),
|
|
247
|
-
("ruling_coeff_quadratic", "Ruling quadratic coeff", "lines/m^3"),
|
|
248
|
-
("ruling_coeff_cubic", "Ruling cubic coeff", "lines/m^4"),
|
|
249
|
-
("ruling_coeff_quartic", "Ruling quartic coeff", "lines/m^5"),
|
|
250
|
-
("coating", "Coating (element, compound or name)", ""),
|
|
251
|
-
("coating_thickness", "Coating thickness", "m"),
|
|
252
|
-
("height", "Height", "m"),
|
|
253
|
-
("ratio_valley_to_period", "Valley/period ratio", ""),
|
|
254
|
-
] )
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if __name__ == "__main__":
|
|
258
|
-
|
|
259
|
-
grating1 = Grating(name="grating1")
|
|
260
|
-
# grating1.keys()
|
|
261
|
-
print(grating1.info())
|
|
262
|
-
# print(grating1.to_json())
|
|
263
|
-
|
|
264
|
-
grating1 = GratingVLS(name="grating1")
|
|
265
|
-
# grating1.keys()
|
|
266
|
-
print(grating1.info())
|
|
267
|
-
# print(grating1.to_json())
|
|
268
|
-
|
|
269
|
-
grating1 = GratingBlaze(name="grating1")
|
|
270
|
-
# grating1.keys()
|
|
271
|
-
print(grating1.info())
|
|
272
|
-
# print(grating1.to_json())
|
|
273
|
-
|
|
274
|
-
grating1 = GratingLamellar(name="grating1")
|
|
275
|
-
# grating1.keys()
|
|
276
|
-
print(grating1.info())
|
|
277
|
-
# print(grating1.to_json())
|
|
278
|
-
|
|
279
|
-
|
|
1
|
+
from syned.beamline.shape import SurfaceShape, BoundaryShape
|
|
2
|
+
from syned.beamline.optical_element_with_surface_shape import OpticalElementsWithSurfaceShape
|
|
3
|
+
|
|
4
|
+
class Grating(OpticalElementsWithSurfaceShape):
|
|
5
|
+
"""
|
|
6
|
+
Constructor.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
name : str, optional
|
|
11
|
+
The name of the optical element.
|
|
12
|
+
surface_shape : instance of SurfaceShape, optional
|
|
13
|
+
The geometry of the crystal surface. if None, it is initialized to SurfaceShape().
|
|
14
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
15
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
16
|
+
ruling : float, optional
|
|
17
|
+
The grating ruling in lines/m.
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
def __init__(self,
|
|
21
|
+
name="Undefined",
|
|
22
|
+
surface_shape=SurfaceShape(),
|
|
23
|
+
boundary_shape=BoundaryShape(),
|
|
24
|
+
ruling=800e3,
|
|
25
|
+
):
|
|
26
|
+
super().__init__(name, surface_shape, boundary_shape)
|
|
27
|
+
self._ruling = ruling
|
|
28
|
+
|
|
29
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
30
|
+
self._set_support_text([
|
|
31
|
+
("name", "Name" , "" ),
|
|
32
|
+
("surface_shape", "Surface Shape" , "" ),
|
|
33
|
+
("boundary_shape", "Boundary Shape" , "" ),
|
|
34
|
+
("ruling", "Ruling at center" , "lines/m" ),
|
|
35
|
+
] )
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class GratingVLS(Grating):
|
|
39
|
+
"""
|
|
40
|
+
Constructor.
|
|
41
|
+
|
|
42
|
+
Parameters
|
|
43
|
+
----------
|
|
44
|
+
name : str, optional
|
|
45
|
+
The name of the optical element.
|
|
46
|
+
surface_shape : instance of SurfaceShape, optional
|
|
47
|
+
The geometry of the optical element surface. if None, it is initialized to SurfaceShape().
|
|
48
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
49
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
50
|
+
ruling : float, optional
|
|
51
|
+
The grating ruling polinomial coefficient of 0th order [lines/m].
|
|
52
|
+
ruling_coeff_linear : float, optional
|
|
53
|
+
The grating ruling polinomial coefficient of 1th order [lines/m^2].
|
|
54
|
+
ruling_coeff_quadratic : float, optional
|
|
55
|
+
The grating ruling polinomial coefficient of 2th order [lines/m^3].
|
|
56
|
+
ruling_coeff_cubic : float, optional
|
|
57
|
+
The grating ruling polinomial coefficient of 3th order [lines/m^4].
|
|
58
|
+
ruling_coeff_quartic : float, optional
|
|
59
|
+
The grating ruling polinomial coefficient of 4th order [lines/m^5].
|
|
60
|
+
coating : str, optional
|
|
61
|
+
The grating coating material.
|
|
62
|
+
coating_thickness : float, optional
|
|
63
|
+
The grating coating thickness in m.
|
|
64
|
+
|
|
65
|
+
"""
|
|
66
|
+
def __init__(self,
|
|
67
|
+
name="Undefined",
|
|
68
|
+
surface_shape=SurfaceShape(),
|
|
69
|
+
boundary_shape=BoundaryShape(),
|
|
70
|
+
ruling=800e3,
|
|
71
|
+
ruling_coeff_linear=0.0,
|
|
72
|
+
ruling_coeff_quadratic=0.0,
|
|
73
|
+
ruling_coeff_cubic=0.0,
|
|
74
|
+
ruling_coeff_quartic=0.0,
|
|
75
|
+
coating=None,
|
|
76
|
+
coating_thickness=None,
|
|
77
|
+
):
|
|
78
|
+
super().__init__(name, surface_shape, boundary_shape)
|
|
79
|
+
|
|
80
|
+
self._ruling = ruling
|
|
81
|
+
self._ruling_coeff_linear = ruling_coeff_linear
|
|
82
|
+
self._ruling_coeff_quadratic = ruling_coeff_quadratic
|
|
83
|
+
self._ruling_coeff_cubic = ruling_coeff_cubic
|
|
84
|
+
self._ruling_coeff_quartic = ruling_coeff_quartic
|
|
85
|
+
self._coating = coating
|
|
86
|
+
self._coating_thickness = coating_thickness
|
|
87
|
+
|
|
88
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
89
|
+
self._set_support_text([
|
|
90
|
+
("name", "Name" , "" ),
|
|
91
|
+
("surface_shape", "Surface Shape" , "" ),
|
|
92
|
+
("boundary_shape", "Boundary Shape" , "" ),
|
|
93
|
+
("ruling", "Ruling at center" , "lines/m" ),
|
|
94
|
+
("ruling_coeff_linear", "Ruling linear coeff", "lines/m^2"),
|
|
95
|
+
("ruling_coeff_quadratic", "Ruling quadratic coeff", "lines/m^3"),
|
|
96
|
+
("ruling_coeff_cubic", "Ruling cubic coeff", "lines/m^4"),
|
|
97
|
+
("ruling_coeff_quartic", "Ruling quartic coeff", "lines/m^5"),
|
|
98
|
+
("coating", "Coating (element, compound or name)", ""),
|
|
99
|
+
("coating_thickness", "Coating thickness", "m"),
|
|
100
|
+
] )
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class GratingBlaze(GratingVLS):
|
|
104
|
+
"""
|
|
105
|
+
Constructor.
|
|
106
|
+
|
|
107
|
+
Parameters
|
|
108
|
+
----------
|
|
109
|
+
name : str, optional
|
|
110
|
+
The name of the optical element.
|
|
111
|
+
surface_shape : instance of SurfaceShape, optional
|
|
112
|
+
The geometry of the crystal surface. if None, it is initialized to SurfaceShape().
|
|
113
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
114
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
115
|
+
ruling : float, optional
|
|
116
|
+
The grating ruling polinomial coefficient of 0th order [lines/m].
|
|
117
|
+
ruling_coeff_linear : float, optional
|
|
118
|
+
The grating ruling polinomial coefficient of 1th order [lines/m^2].
|
|
119
|
+
ruling_coeff_quadratic : float, optional
|
|
120
|
+
The grating ruling polinomial coefficient of 2th order [lines/m^3].
|
|
121
|
+
ruling_coeff_cubic : float, optional
|
|
122
|
+
The grating ruling polinomial coefficient of 3th order [lines/m^4].
|
|
123
|
+
ruling_coeff_quartic : float, optional
|
|
124
|
+
The grating ruling polinomial coefficient of 4th order [lines/m^5].
|
|
125
|
+
coating : str, optional
|
|
126
|
+
The grating coating material.
|
|
127
|
+
coating_thickness : float, optional
|
|
128
|
+
The grating coating thickness in m.
|
|
129
|
+
blaze_angle : float, optional
|
|
130
|
+
The blaze angle in rad.
|
|
131
|
+
antiblaze_angle : float, optional
|
|
132
|
+
The anti-blaze angle in rad.
|
|
133
|
+
|
|
134
|
+
"""
|
|
135
|
+
def __init__(self,
|
|
136
|
+
name="Undefined",
|
|
137
|
+
surface_shape=SurfaceShape(),
|
|
138
|
+
boundary_shape=BoundaryShape(),
|
|
139
|
+
ruling=800e3,
|
|
140
|
+
ruling_coeff_linear=0.0,
|
|
141
|
+
ruling_coeff_quadratic=0.0,
|
|
142
|
+
ruling_coeff_cubic=0.0,
|
|
143
|
+
ruling_coeff_quartic=0.0,
|
|
144
|
+
coating=None,
|
|
145
|
+
coating_thickness=None,
|
|
146
|
+
blaze_angle=0.0,
|
|
147
|
+
antiblaze_angle=90.0,
|
|
148
|
+
):
|
|
149
|
+
super().__init__(name, surface_shape, boundary_shape,
|
|
150
|
+
ruling=ruling,
|
|
151
|
+
ruling_coeff_linear=ruling_coeff_linear,
|
|
152
|
+
ruling_coeff_quadratic=ruling_coeff_quadratic,
|
|
153
|
+
ruling_coeff_cubic=ruling_coeff_cubic,
|
|
154
|
+
ruling_coeff_quartic=ruling_coeff_quartic,
|
|
155
|
+
coating=coating,
|
|
156
|
+
coating_thickness=coating_thickness,
|
|
157
|
+
)
|
|
158
|
+
self._blaze_angle = blaze_angle
|
|
159
|
+
self._antiblaze_angle = antiblaze_angle
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
163
|
+
self._set_support_text([
|
|
164
|
+
("name", "Name", ""),
|
|
165
|
+
("surface_shape", "Surface Shape", ""),
|
|
166
|
+
("boundary_shape", "Boundary Shape", ""),
|
|
167
|
+
("ruling", "Ruling at center", "lines/m"),
|
|
168
|
+
("ruling_coeff_linear", "Ruling linear coeff", "lines/m^2"),
|
|
169
|
+
("ruling_coeff_quadratic", "Ruling quadratic coeff", "lines/m^3"),
|
|
170
|
+
("ruling_coeff_cubic", "Ruling cubic coeff", "lines/m^4"),
|
|
171
|
+
("ruling_coeff_quartic", "Ruling quartic coeff", "lines/m^5"),
|
|
172
|
+
("coating", "Coating (element, compound or name)", ""),
|
|
173
|
+
("coating_thickness", "Coating thickness", "m"),
|
|
174
|
+
("blaze_angle", "Blaze angle", "rad"),
|
|
175
|
+
("antiblaze_angle", "Antiblaze angle", "rad"),
|
|
176
|
+
] )
|
|
177
|
+
|
|
178
|
+
def get_apex_angle(self):
|
|
179
|
+
return 180 - self._blaze_angle - self._antiblaze_angle
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class GratingLamellar(GratingVLS):
|
|
183
|
+
"""
|
|
184
|
+
Constructor.
|
|
185
|
+
|
|
186
|
+
Parameters
|
|
187
|
+
----------
|
|
188
|
+
name : str, optional
|
|
189
|
+
The name of the optical element.
|
|
190
|
+
surface_shape : instance of SurfaceShape, optional
|
|
191
|
+
The geometry of the crystal surface. if None, it is initialized to SurfaceShape().
|
|
192
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
193
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
194
|
+
ruling : float, optional
|
|
195
|
+
The grating ruling polinomial coefficient of 0th order [lines/m].
|
|
196
|
+
ruling_coeff_linear : float, optional
|
|
197
|
+
The grating ruling polinomial coefficient of 1th order [lines/m^2].
|
|
198
|
+
ruling_coeff_quadratic : float, optional
|
|
199
|
+
The grating ruling polinomial coefficient of 2th order [lines/m^3].
|
|
200
|
+
ruling_coeff_cubic : float, optional
|
|
201
|
+
The grating ruling polinomial coefficient of 3th order [lines/m^4].
|
|
202
|
+
ruling_coeff_quartic : float, optional
|
|
203
|
+
The grating ruling polinomial coefficient of 4th order [lines/m^5].
|
|
204
|
+
coating : str, optional
|
|
205
|
+
The grating coating material.
|
|
206
|
+
coating_thickness : float, optional
|
|
207
|
+
The grating coating thickness in m.
|
|
208
|
+
height : str, optional
|
|
209
|
+
The height of the grating lamella in m.
|
|
210
|
+
ratio_valley_to_period : float, optional
|
|
211
|
+
The grating ration valley to period.
|
|
212
|
+
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
def __init__(self,
|
|
216
|
+
name="Undefined",
|
|
217
|
+
surface_shape=SurfaceShape(),
|
|
218
|
+
boundary_shape=BoundaryShape(),
|
|
219
|
+
ruling=800e3,
|
|
220
|
+
ruling_coeff_linear=0.0,
|
|
221
|
+
ruling_coeff_quadratic=0.0,
|
|
222
|
+
ruling_coeff_cubic=0.0,
|
|
223
|
+
coating=None,
|
|
224
|
+
coating_thickness=None,
|
|
225
|
+
height=1e-6,
|
|
226
|
+
ratio_valley_to_period=0.5, # TODO: is better to define ratio valley to height?
|
|
227
|
+
):
|
|
228
|
+
super().__init__(name, surface_shape, boundary_shape,
|
|
229
|
+
ruling=ruling,
|
|
230
|
+
ruling_coeff_linear=ruling_coeff_linear,
|
|
231
|
+
ruling_coeff_quadratic=ruling_coeff_quadratic,
|
|
232
|
+
ruling_coeff_cubic=ruling_coeff_cubic,
|
|
233
|
+
coating=coating,
|
|
234
|
+
coating_thickness=coating_thickness,
|
|
235
|
+
)
|
|
236
|
+
self._height = height
|
|
237
|
+
self._ratio_valley_to_period = ratio_valley_to_period
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
241
|
+
self._set_support_text([
|
|
242
|
+
("name", "Name", ""),
|
|
243
|
+
("surface_shape", "Surface Shape", ""),
|
|
244
|
+
("boundary_shape", "Boundary Shape", ""),
|
|
245
|
+
("ruling", "Ruling at center", "lines/m"),
|
|
246
|
+
("ruling_coeff_linear", "Ruling linear coeff", "lines/m^2"),
|
|
247
|
+
("ruling_coeff_quadratic", "Ruling quadratic coeff", "lines/m^3"),
|
|
248
|
+
("ruling_coeff_cubic", "Ruling cubic coeff", "lines/m^4"),
|
|
249
|
+
("ruling_coeff_quartic", "Ruling quartic coeff", "lines/m^5"),
|
|
250
|
+
("coating", "Coating (element, compound or name)", ""),
|
|
251
|
+
("coating_thickness", "Coating thickness", "m"),
|
|
252
|
+
("height", "Height", "m"),
|
|
253
|
+
("ratio_valley_to_period", "Valley/period ratio", ""),
|
|
254
|
+
] )
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
if __name__ == "__main__":
|
|
258
|
+
|
|
259
|
+
grating1 = Grating(name="grating1")
|
|
260
|
+
# grating1.keys()
|
|
261
|
+
print(grating1.info())
|
|
262
|
+
# print(grating1.to_json())
|
|
263
|
+
|
|
264
|
+
grating1 = GratingVLS(name="grating1")
|
|
265
|
+
# grating1.keys()
|
|
266
|
+
print(grating1.info())
|
|
267
|
+
# print(grating1.to_json())
|
|
268
|
+
|
|
269
|
+
grating1 = GratingBlaze(name="grating1")
|
|
270
|
+
# grating1.keys()
|
|
271
|
+
print(grating1.info())
|
|
272
|
+
# print(grating1.to_json())
|
|
273
|
+
|
|
274
|
+
grating1 = GratingLamellar(name="grating1")
|
|
275
|
+
# grating1.keys()
|
|
276
|
+
print(grating1.info())
|
|
277
|
+
# print(grating1.to_json())
|
|
278
|
+
|
|
279
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
from syned.beamline.optical_element import OpticalElement
|
|
2
|
-
|
|
3
|
-
class IdealElement(OpticalElement):
|
|
4
|
-
def __init__(self, name="Undefined", boundary_shape=None):
|
|
5
|
-
"""
|
|
6
|
-
Base for ideal optical elements (e.g., screen, ideal lenses).
|
|
7
|
-
|
|
8
|
-
Parameters
|
|
9
|
-
----------
|
|
10
|
-
name : str, optional
|
|
11
|
-
The name of the optical element.
|
|
12
|
-
boundary_shape : instance of BoundaryShape, optional
|
|
13
|
-
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
14
|
-
|
|
15
|
-
"""
|
|
1
|
+
from syned.beamline.optical_element import OpticalElement
|
|
2
|
+
|
|
3
|
+
class IdealElement(OpticalElement):
|
|
4
|
+
def __init__(self, name="Undefined", boundary_shape=None):
|
|
5
|
+
"""
|
|
6
|
+
Base for ideal optical elements (e.g., screen, ideal lenses).
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
name : str, optional
|
|
11
|
+
The name of the optical element.
|
|
12
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
13
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
16
|
OpticalElement.__init__(self, name=name, boundary_shape=boundary_shape)
|