syned 1.0.47__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/__init__.py +0 -0
- syned/__test/__init__.py +46 -0
- syned/__test/test.py +28 -0
- syned/beamline/__init__.py +1 -0
- syned/beamline/beamline.py +155 -0
- syned/beamline/beamline_element.py +76 -0
- syned/beamline/element_coordinates.py +199 -0
- syned/beamline/optical_element.py +47 -0
- syned/beamline/optical_element_with_surface_shape.py +126 -0
- syned/beamline/optical_elements/__init__.py +1 -0
- syned/beamline/optical_elements/absorbers/__init__.py +0 -0
- syned/beamline/optical_elements/absorbers/absorber.py +21 -0
- syned/beamline/optical_elements/absorbers/beam_stopper.py +64 -0
- syned/beamline/optical_elements/absorbers/filter.py +61 -0
- syned/beamline/optical_elements/absorbers/holed_filter.py +67 -0
- syned/beamline/optical_elements/absorbers/slit.py +81 -0
- syned/beamline/optical_elements/crystals/__init__.py +1 -0
- syned/beamline/optical_elements/crystals/crystal.py +70 -0
- syned/beamline/optical_elements/gratings/__init__.py +1 -0
- syned/beamline/optical_elements/gratings/grating.py +279 -0
- syned/beamline/optical_elements/ideal_elements/__init__.py +1 -0
- syned/beamline/optical_elements/ideal_elements/ideal_element.py +16 -0
- syned/beamline/optical_elements/ideal_elements/ideal_fzp.py +183 -0
- syned/beamline/optical_elements/ideal_elements/ideal_lens.py +54 -0
- syned/beamline/optical_elements/ideal_elements/screen.py +16 -0
- syned/beamline/optical_elements/mirrors/__init__.py +1 -0
- syned/beamline/optical_elements/mirrors/mirror.py +39 -0
- syned/beamline/optical_elements/multilayers/__init__.py +46 -0
- syned/beamline/optical_elements/multilayers/multilayer.py +45 -0
- syned/beamline/optical_elements/refractors/__init__.py +1 -0
- syned/beamline/optical_elements/refractors/crl.py +79 -0
- syned/beamline/optical_elements/refractors/interface.py +61 -0
- syned/beamline/optical_elements/refractors/lens.py +105 -0
- syned/beamline/shape.py +2803 -0
- syned/storage_ring/__init__.py +1 -0
- syned/storage_ring/electron_beam.py +804 -0
- syned/storage_ring/empty_light_source.py +40 -0
- syned/storage_ring/light_source.py +90 -0
- syned/storage_ring/magnetic_structure.py +8 -0
- syned/storage_ring/magnetic_structures/__init__.py +1 -0
- syned/storage_ring/magnetic_structures/bending_magnet.py +329 -0
- syned/storage_ring/magnetic_structures/insertion_device.py +169 -0
- syned/storage_ring/magnetic_structures/undulator.py +413 -0
- syned/storage_ring/magnetic_structures/wiggler.py +27 -0
- syned/syned_object.py +264 -0
- syned/util/__init__.py +22 -0
- syned/util/json_tools.py +198 -0
- syned/widget/__init__.py +0 -0
- syned/widget/widget_decorator.py +67 -0
- syned-1.0.47.dist-info/METADATA +88 -0
- syned-1.0.47.dist-info/RECORD +54 -0
- syned-1.0.47.dist-info/WHEEL +5 -0
- syned-1.0.47.dist-info/licenses/LICENSE +20 -0
- syned-1.0.47.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
from syned.beamline.optical_element import OpticalElement
|
|
3
|
+
from syned.beamline.shape import BoundaryShape
|
|
4
|
+
|
|
5
|
+
class Absorber(OpticalElement):
|
|
6
|
+
"""
|
|
7
|
+
Base class for optical element category "absorbers" (filters, slits, etc.)
|
|
8
|
+
|
|
9
|
+
Constructor.
|
|
10
|
+
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
name : str
|
|
14
|
+
The name of the optical element.
|
|
15
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
16
|
+
if None, it is initialized to BoundaryShape().
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
def __init__(self, name="Undefined", boundary_shape=None):
|
|
20
|
+
if boundary_shape is None: boundary_shape = BoundaryShape()
|
|
21
|
+
OpticalElement.__init__(self, name=name, boundary_shape=boundary_shape)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
from syned.beamline.shape import BoundaryShape
|
|
3
|
+
from syned.beamline.shape import Rectangle, Ellipse
|
|
4
|
+
|
|
5
|
+
from syned.beamline.optical_elements.absorbers.absorber import Absorber
|
|
6
|
+
|
|
7
|
+
class BeamStopper(Absorber):
|
|
8
|
+
"""
|
|
9
|
+
Beam-stopper or obstruction.
|
|
10
|
+
|
|
11
|
+
Constructor.
|
|
12
|
+
|
|
13
|
+
Note that:
|
|
14
|
+
Slit BeamStopper Filter HoledFilter
|
|
15
|
+
beam pass at center Yes No Yes No
|
|
16
|
+
apply attenuation No No Yes Yes
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
name : str
|
|
21
|
+
The name of the optical element.
|
|
22
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
23
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
def __init__(self, name="Undefined", boundary_shape=None):
|
|
27
|
+
if boundary_shape is None: boundary_shape = BoundaryShape()
|
|
28
|
+
Absorber.__init__(self, name=name, boundary_shape=boundary_shape)
|
|
29
|
+
|
|
30
|
+
def set_rectangle(self,width=3e-3,height=4e-3):
|
|
31
|
+
"""
|
|
32
|
+
Sets the stopper as a rectangle.
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
width : float, optional
|
|
37
|
+
The rectangle width.
|
|
38
|
+
length : float, optional
|
|
39
|
+
The rectangle length.
|
|
40
|
+
center_x : float, optional
|
|
41
|
+
The center coordinate X.
|
|
42
|
+
center_y : float, optional
|
|
43
|
+
The center coordinate Y.
|
|
44
|
+
|
|
45
|
+
"""
|
|
46
|
+
self._boundary_shape=Rectangle(-0.5*width,0.5*width,-0.5*height,0.5*height)
|
|
47
|
+
|
|
48
|
+
def set_circle(self,radius=3e-3):
|
|
49
|
+
"""
|
|
50
|
+
Sets the stopper as a circle.
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
radius : float
|
|
55
|
+
The radius of the circle.
|
|
56
|
+
center_x : float
|
|
57
|
+
The x coordinate of the center of the circle.
|
|
58
|
+
center_y : float
|
|
59
|
+
The y coordinate of the center of the circle.
|
|
60
|
+
|
|
61
|
+
"""
|
|
62
|
+
self._boundary_shape=Ellipse(-0.5*radius,0.5*radius,-0.5*radius,0.5*radius)
|
|
63
|
+
|
|
64
|
+
#TODO: add set_ellipse (like in slit).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
|
|
2
|
+
from syned.beamline.optical_elements.absorbers.absorber import Absorber
|
|
3
|
+
|
|
4
|
+
class Filter(Absorber):
|
|
5
|
+
"""
|
|
6
|
+
Filter or absorber or attenuator.
|
|
7
|
+
|
|
8
|
+
Note that:
|
|
9
|
+
Slit BeamStopper Filter HoledFilter
|
|
10
|
+
beam pass at center Yes No Yes No
|
|
11
|
+
apply attenuation No No Yes Yes
|
|
12
|
+
|
|
13
|
+
Constructor.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
name : str
|
|
18
|
+
The name of the optical element.
|
|
19
|
+
material : str
|
|
20
|
+
A string defining the material.
|
|
21
|
+
thickness : float
|
|
22
|
+
The filter thickness in m.
|
|
23
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
24
|
+
if None, it is initialized to BoundaryShape().
|
|
25
|
+
"""
|
|
26
|
+
def __init__(self,
|
|
27
|
+
name="Undefined",
|
|
28
|
+
material="Be",
|
|
29
|
+
thickness=1e-3,
|
|
30
|
+
boundary_shape=None):
|
|
31
|
+
Absorber.__init__(self, name=name, boundary_shape=boundary_shape)
|
|
32
|
+
self._material = material
|
|
33
|
+
self._thickness = thickness
|
|
34
|
+
|
|
35
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
36
|
+
self._set_support_text([
|
|
37
|
+
("material" , "Material (symbol, formula or name)", "" ),
|
|
38
|
+
("thickness" , "Thickness ", "m" ),
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
def get_material(self):
|
|
42
|
+
"""
|
|
43
|
+
Returns the material name.
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
str
|
|
48
|
+
|
|
49
|
+
"""
|
|
50
|
+
return self._material
|
|
51
|
+
|
|
52
|
+
def get_thickness(self):
|
|
53
|
+
"""
|
|
54
|
+
Retuirns the filter thickness in m.
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
-------
|
|
58
|
+
float
|
|
59
|
+
|
|
60
|
+
"""
|
|
61
|
+
return self._thickness
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#
|
|
2
|
+
# this is a filter with a hole (holed-filter)
|
|
3
|
+
# Slit BeamStopper Filter HoledFilter
|
|
4
|
+
# beam pass at center Yes No Yes No
|
|
5
|
+
# apply attenuation No No Yes Yes
|
|
6
|
+
#
|
|
7
|
+
#
|
|
8
|
+
from syned.beamline.optical_elements.absorbers.absorber import Absorber
|
|
9
|
+
|
|
10
|
+
class HoledFilter(Absorber):
|
|
11
|
+
"""
|
|
12
|
+
Filter or absorber or attenuator with a hole.
|
|
13
|
+
|
|
14
|
+
Note that:
|
|
15
|
+
Slit BeamStopper Filter HoledFilter
|
|
16
|
+
beam pass at center Yes No Yes No
|
|
17
|
+
apply attenuation No No Yes Yes
|
|
18
|
+
|
|
19
|
+
Constructor.
|
|
20
|
+
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
name : str
|
|
24
|
+
The name of the optical element.
|
|
25
|
+
material : str
|
|
26
|
+
A string defining the material.
|
|
27
|
+
thickness : float
|
|
28
|
+
The filter thickness in m.
|
|
29
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
30
|
+
Defines the geometry of the hole. if None, it is initialized to BoundaryShape().
|
|
31
|
+
"""
|
|
32
|
+
def __init__(self,
|
|
33
|
+
name="Undefined",
|
|
34
|
+
material="Be",
|
|
35
|
+
thickness=1e-3,
|
|
36
|
+
boundary_shape=None):
|
|
37
|
+
Absorber.__init__(self, name=name, boundary_shape=boundary_shape)
|
|
38
|
+
self._material = material
|
|
39
|
+
self._thickness = thickness
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
43
|
+
self._set_support_text([
|
|
44
|
+
("material" , "Material (symbol, formula or name)", "" ),
|
|
45
|
+
("thickness" , "Thickness ", "m" ),
|
|
46
|
+
] )
|
|
47
|
+
def get_material(self):
|
|
48
|
+
"""
|
|
49
|
+
Returns the material name.
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
str
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
return self._material
|
|
57
|
+
|
|
58
|
+
def get_thickness(self):
|
|
59
|
+
"""
|
|
60
|
+
Retuirns the filter thickness in m.
|
|
61
|
+
|
|
62
|
+
Returns
|
|
63
|
+
-------
|
|
64
|
+
float
|
|
65
|
+
|
|
66
|
+
"""
|
|
67
|
+
return self._thickness
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
from syned.beamline.shape import BoundaryShape
|
|
3
|
+
from syned.beamline.shape import Rectangle, Ellipse, Circle
|
|
4
|
+
|
|
5
|
+
from syned.beamline.optical_elements.absorbers.absorber import Absorber
|
|
6
|
+
|
|
7
|
+
class Slit(Absorber):
|
|
8
|
+
"""
|
|
9
|
+
Slit or aperture.
|
|
10
|
+
|
|
11
|
+
Constructor.
|
|
12
|
+
|
|
13
|
+
Note that:
|
|
14
|
+
Slit BeamStopper Filter HoledFilter
|
|
15
|
+
beam pass at center Yes No Yes No
|
|
16
|
+
apply attenuation No No Yes Yes
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
name : str
|
|
21
|
+
The name of the optical element.
|
|
22
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
23
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
def __init__(self, name="Undefined", boundary_shape=None):
|
|
27
|
+
if boundary_shape is None:
|
|
28
|
+
boundary_shape = BoundaryShape()
|
|
29
|
+
Absorber.__init__(self, name=name, boundary_shape=boundary_shape)
|
|
30
|
+
|
|
31
|
+
def set_rectangle(self,width=3e-3,height=4e-3,center_x=0.0,center_y=0.0):
|
|
32
|
+
"""
|
|
33
|
+
Sets the aperture as a rectangle.
|
|
34
|
+
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
width : float, optional
|
|
38
|
+
The rectangle width.
|
|
39
|
+
length : float, optional
|
|
40
|
+
The rectangle length.
|
|
41
|
+
center_x : float, optional
|
|
42
|
+
The center coordinate X.
|
|
43
|
+
center_y : float, optional
|
|
44
|
+
The center coordinate Y.
|
|
45
|
+
|
|
46
|
+
"""
|
|
47
|
+
self._boundary_shape=Rectangle(-0.5*width+center_x,0.5*width+center_x,-0.5*height+center_y,0.5*height+center_y)
|
|
48
|
+
|
|
49
|
+
def set_circle(self,radius=3e-3,center_x=0.0,center_y=0.0):
|
|
50
|
+
"""
|
|
51
|
+
Sets the aperture as a circle.
|
|
52
|
+
|
|
53
|
+
Parameters
|
|
54
|
+
----------
|
|
55
|
+
radius : float
|
|
56
|
+
The radius of the circle.
|
|
57
|
+
center_x : float
|
|
58
|
+
The x coordinate of the center of the circle.
|
|
59
|
+
center_y : float
|
|
60
|
+
The y coordinate of the center of the circle.
|
|
61
|
+
|
|
62
|
+
"""
|
|
63
|
+
self._boundary_shape=Circle(radius,center_x,center_y)
|
|
64
|
+
|
|
65
|
+
def set_ellipse(self,width=3e-3,height=4e-3,center_x=0.0,center_y=0.0):
|
|
66
|
+
"""
|
|
67
|
+
Sets the aperture as an ellipse.
|
|
68
|
+
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
width : float, optional
|
|
72
|
+
The ellipse width (2a).
|
|
73
|
+
height : float, optional
|
|
74
|
+
The ellipse height (2b).
|
|
75
|
+
center_x : float, optional
|
|
76
|
+
The ellipse center coordinate X.
|
|
77
|
+
center_y : float, optional
|
|
78
|
+
The ellipse center coordinate Y.
|
|
79
|
+
|
|
80
|
+
"""
|
|
81
|
+
self._boundary_shape=Ellipse(-0.5*width+center_x,0.5*width+center_x,-0.5*height+center_y,0.5*height+center_y)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from syned.beamline.shape import SurfaceShape
|
|
2
|
+
from syned.beamline.optical_element_with_surface_shape import OpticalElementsWithSurfaceShape
|
|
3
|
+
|
|
4
|
+
class DiffractionGeometry:
|
|
5
|
+
BRAGG = 0
|
|
6
|
+
LAUE = 1
|
|
7
|
+
|
|
8
|
+
class Crystal(OpticalElementsWithSurfaceShape):
|
|
9
|
+
"""
|
|
10
|
+
Constructor.
|
|
11
|
+
|
|
12
|
+
Parameters
|
|
13
|
+
----------
|
|
14
|
+
name : str, optional
|
|
15
|
+
The name of the optical element.
|
|
16
|
+
surface_shape : instance of SurfaceShape, optional
|
|
17
|
+
The geometry of the crystal surface. if None, it is initialized to SurfaceShape().
|
|
18
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
19
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
20
|
+
material : str, optional
|
|
21
|
+
The material name.
|
|
22
|
+
diffraction_geometry : int (as defined in DiffractionGeometry, optional
|
|
23
|
+
BRAGG = 0, LAUE = 1.
|
|
24
|
+
miller_index_h : int, optional
|
|
25
|
+
The Miller index H.
|
|
26
|
+
miller_index_k : int, optional
|
|
27
|
+
The Miller index K.
|
|
28
|
+
miller_index_l : int, optional
|
|
29
|
+
The Miller index L.
|
|
30
|
+
asymmetry_angle : float, optional
|
|
31
|
+
The asymmetry angle in rad.
|
|
32
|
+
thickness : float, optional
|
|
33
|
+
The crystal thickness in m.
|
|
34
|
+
|
|
35
|
+
"""
|
|
36
|
+
def __init__(self,
|
|
37
|
+
name="Undefined",
|
|
38
|
+
surface_shape=SurfaceShape(), # TODO: this should be None
|
|
39
|
+
boundary_shape=None,
|
|
40
|
+
material="Si",
|
|
41
|
+
diffraction_geometry=DiffractionGeometry.BRAGG,
|
|
42
|
+
miller_index_h=1,
|
|
43
|
+
miller_index_k=1,
|
|
44
|
+
miller_index_l=1,
|
|
45
|
+
asymmetry_angle=0.0,
|
|
46
|
+
thickness=0.0,
|
|
47
|
+
):
|
|
48
|
+
super().__init__(name, surface_shape, boundary_shape)
|
|
49
|
+
self._material = material
|
|
50
|
+
self._diffraction_geometry = diffraction_geometry
|
|
51
|
+
self._miller_index_h = miller_index_h
|
|
52
|
+
self._miller_index_k = miller_index_k
|
|
53
|
+
self._miller_index_l = miller_index_l
|
|
54
|
+
self._asymmetry_angle = asymmetry_angle
|
|
55
|
+
self._thickness = thickness
|
|
56
|
+
|
|
57
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
58
|
+
self._set_support_text([
|
|
59
|
+
("name", "Name" , "" ),
|
|
60
|
+
("surface_shape", "Surface Shape" , "" ),
|
|
61
|
+
("boundary_shape", "Boundary Shape" , "" ),
|
|
62
|
+
("material", "Material (name)" , "" ),
|
|
63
|
+
("diffraction_geometry","Diffraction Geometry", "" ),
|
|
64
|
+
("miller_index_h", "Miller index h", "" ),
|
|
65
|
+
("miller_index_k", "Miller index k", "" ),
|
|
66
|
+
("miller_index_l", "Miller index l", "" ),
|
|
67
|
+
("asymmetry_angle", "Asymmetry angle", "rad"),
|
|
68
|
+
("thickness", "Thickness", "m"),
|
|
69
|
+
] )
|
|
70
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +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
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +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
|
+
"""
|
|
16
|
+
OpticalElement.__init__(self, name=name, boundary_shape=boundary_shape)
|