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,183 @@
|
|
|
1
|
+
import numpy
|
|
2
|
+
from syned.beamline.optical_elements.ideal_elements.ideal_element import IdealElement
|
|
3
|
+
|
|
4
|
+
class IdealFZP(IdealElement):
|
|
5
|
+
"""
|
|
6
|
+
Defines an ideal Fresnel Zone Plate.
|
|
7
|
+
|
|
8
|
+
Constructor.
|
|
9
|
+
|
|
10
|
+
Parameters
|
|
11
|
+
----------
|
|
12
|
+
name : str, optional
|
|
13
|
+
The name of the optical element.
|
|
14
|
+
focusing_direction : int
|
|
15
|
+
0=None, 1=x (sagittal), 2=z (meridional), 3=2D focusing.
|
|
16
|
+
focal : float
|
|
17
|
+
The focal length in meters.
|
|
18
|
+
nominal_wavelength : float
|
|
19
|
+
The nominal wavelength in m for where the focal length is defined.
|
|
20
|
+
diameter : float
|
|
21
|
+
The FZP diameter in m.
|
|
22
|
+
|
|
23
|
+
"""
|
|
24
|
+
def __init__(self,
|
|
25
|
+
name="Undefined",
|
|
26
|
+
focusing_direction=3, # 0=None, 1=x (sagittal), 2=z (meridional), 3=2D focusing.
|
|
27
|
+
focal=1.0, # focal distance (m)
|
|
28
|
+
nominal_wavelength=1e-10, # nominal wavelength in m
|
|
29
|
+
# r0=10.0e-6, # inner zone radius (m)
|
|
30
|
+
diameter=0.001, # FZP diameter in m
|
|
31
|
+
):
|
|
32
|
+
IdealElement.__init__(self, name=name)
|
|
33
|
+
self._focusing_direction = focusing_direction
|
|
34
|
+
self._focal = focal
|
|
35
|
+
self._nominal_wavelength = nominal_wavelength
|
|
36
|
+
self._diameter = diameter
|
|
37
|
+
|
|
38
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
39
|
+
self._set_support_text([
|
|
40
|
+
("name" , "Name" , ""),
|
|
41
|
+
("boundary_shape" , "" , ""),
|
|
42
|
+
("focusing_direction", "Focusing direction: 0=None, 1=1D along X, 2=1D along Z, 3=2D", ""),
|
|
43
|
+
("focal" , "Focal length" , "m"),
|
|
44
|
+
("nominal_wavelength", "Nominal wavelength" , "m"),
|
|
45
|
+
("diameter" , "FZP diameter" , "m"),
|
|
46
|
+
] )
|
|
47
|
+
|
|
48
|
+
def focusing_direction(self):
|
|
49
|
+
"""
|
|
50
|
+
Returns the focusing direction.
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
int
|
|
55
|
+
0=None,
|
|
56
|
+
1=1D along X,
|
|
57
|
+
2=1D along Z,
|
|
58
|
+
3=2D.
|
|
59
|
+
"""
|
|
60
|
+
return self._focusing_direction
|
|
61
|
+
|
|
62
|
+
def focal(self):
|
|
63
|
+
"""
|
|
64
|
+
Returns the focal length.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
float
|
|
69
|
+
|
|
70
|
+
"""
|
|
71
|
+
return self._focal
|
|
72
|
+
|
|
73
|
+
def nominal_wavelength(self):
|
|
74
|
+
"""
|
|
75
|
+
Returns the nominal wavelength.
|
|
76
|
+
|
|
77
|
+
Returns
|
|
78
|
+
-------
|
|
79
|
+
float
|
|
80
|
+
|
|
81
|
+
"""
|
|
82
|
+
return self._nominal_wavelength
|
|
83
|
+
|
|
84
|
+
def diameter(self):
|
|
85
|
+
"""
|
|
86
|
+
Returns the FZP diameter.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
float
|
|
91
|
+
|
|
92
|
+
"""
|
|
93
|
+
return self._diameter
|
|
94
|
+
|
|
95
|
+
#
|
|
96
|
+
# calculated. The exact expression is rn = sqrt( n lambda f + (n lambda / 2)**2 )
|
|
97
|
+
#
|
|
98
|
+
def rn(self):
|
|
99
|
+
return 0.5 * self.diameter()
|
|
100
|
+
|
|
101
|
+
def r0(self):
|
|
102
|
+
"""
|
|
103
|
+
Returns the innermost radius (approximated calculation r0=sqrt(wavelength * focal)).
|
|
104
|
+
|
|
105
|
+
Returns
|
|
106
|
+
-------
|
|
107
|
+
float
|
|
108
|
+
|
|
109
|
+
"""
|
|
110
|
+
return numpy.sqrt(self.nominal_wavelength() * self.focal())
|
|
111
|
+
|
|
112
|
+
def r0_exact(self):
|
|
113
|
+
"""
|
|
114
|
+
Returns the innermost radius (exact calculation r0=sqrt(wavelength * focal + (wavelength/2)**2)).
|
|
115
|
+
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
118
|
+
float
|
|
119
|
+
|
|
120
|
+
"""
|
|
121
|
+
return numpy.sqrt(self.nominal_wavelength() * self.focal() + (0.5 * self.nominal_wavelength())**2)
|
|
122
|
+
|
|
123
|
+
def n_vs_r(self, r): # approximated if f >> diameter; eq 855 in Michette
|
|
124
|
+
"""
|
|
125
|
+
Returns the zone number for a given distance r (approximated calculation).
|
|
126
|
+
|
|
127
|
+
Returns
|
|
128
|
+
-------
|
|
129
|
+
float
|
|
130
|
+
|
|
131
|
+
"""
|
|
132
|
+
return (r ** 2 / self.nominal_wavelength() / self.focal())
|
|
133
|
+
|
|
134
|
+
def n_exact_vs_r(self, r): # Exact, solving n from rn = sqrt( n lambda f + (n lambda / 2)**2 )
|
|
135
|
+
"""
|
|
136
|
+
Returns the zone number for a given distance r
|
|
137
|
+
(exact calculation solving n from rn = sqrt( n lambda f + (n lambda / 2)**2).
|
|
138
|
+
|
|
139
|
+
Returns
|
|
140
|
+
-------
|
|
141
|
+
float
|
|
142
|
+
|
|
143
|
+
"""
|
|
144
|
+
nn = -2 * self.focal() + 2 * numpy.sqrt(self.focal()**2 + r**2)
|
|
145
|
+
return nn / self.nominal_wavelength()
|
|
146
|
+
|
|
147
|
+
def n(self):
|
|
148
|
+
"""
|
|
149
|
+
Returns the zone number for a outermost zone (approximated calculation).
|
|
150
|
+
|
|
151
|
+
Returns
|
|
152
|
+
-------
|
|
153
|
+
float
|
|
154
|
+
|
|
155
|
+
"""
|
|
156
|
+
return self.n_vs_r( self.rn() )
|
|
157
|
+
|
|
158
|
+
def n_exact(self):
|
|
159
|
+
"""
|
|
160
|
+
Returns the zone number for a outermost zone (exact calculation using n_exact_vs_r() ).
|
|
161
|
+
|
|
162
|
+
Returns
|
|
163
|
+
-------
|
|
164
|
+
float
|
|
165
|
+
|
|
166
|
+
"""
|
|
167
|
+
return self.n_exact_vs_r(self.rn())
|
|
168
|
+
|
|
169
|
+
if __name__ == "__main__":
|
|
170
|
+
fzp = IdealFZP(
|
|
171
|
+
name = "Undefined",
|
|
172
|
+
focusing_direction = 3, # 0=None, 1=x (sagittal), 2=z (meridional), 3=2D focusing.
|
|
173
|
+
focal = 1.0, # focal distance (m)
|
|
174
|
+
nominal_wavelength = 1e-10, # nominal wavelength in m
|
|
175
|
+
diameter = 0.001, # FZP diameter in m
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
print(fzp.info())
|
|
179
|
+
print("r0, r0_exact: ", fzp.r0(), fzp.r0_exact())
|
|
180
|
+
print("rn: ", fzp.rn())
|
|
181
|
+
print("n, n_exact: ", fzp.n(), fzp.n_exact())
|
|
182
|
+
|
|
183
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from syned.beamline.optical_elements.ideal_elements.ideal_element import IdealElement
|
|
2
|
+
|
|
3
|
+
class IdealLens(IdealElement):
|
|
4
|
+
"""
|
|
5
|
+
Defines an ideal lens. It converts a plane wave into:
|
|
6
|
+
* an spherical converging wave (if focal_x=focal_y).
|
|
7
|
+
* a toroidal converging wave (if focal_x != focal_y).
|
|
8
|
+
* a cylindrical wave (if focal_x or focal_y is infinity).
|
|
9
|
+
|
|
10
|
+
Constructor.
|
|
11
|
+
|
|
12
|
+
Parameters
|
|
13
|
+
----------
|
|
14
|
+
name : str, optional
|
|
15
|
+
The name of the optical element.
|
|
16
|
+
focal_x : float
|
|
17
|
+
The focal length in meters along the X direction.
|
|
18
|
+
focal_y : float
|
|
19
|
+
The focal length in meters along the Y direction.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
def __init__(self, name="Undefined", focal_x=1.0, focal_y=1.0):
|
|
23
|
+
IdealElement.__init__(self, name=name)
|
|
24
|
+
self._focal_x = focal_x
|
|
25
|
+
self._focal_y = focal_y
|
|
26
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
27
|
+
self._set_support_text([
|
|
28
|
+
("name" , "Name" , ""),
|
|
29
|
+
("boundary_shape", "" , ""),
|
|
30
|
+
("focal_x" , "Focal length in x [horizontal]", "m" ),
|
|
31
|
+
("focal_y" , "Focal length in y [vertical]" , "m" ),
|
|
32
|
+
] )
|
|
33
|
+
|
|
34
|
+
def focal_x(self):
|
|
35
|
+
"""
|
|
36
|
+
Returns the focal length in the X direction.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
float
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
return self._focal_x
|
|
44
|
+
|
|
45
|
+
def focal_y(self):
|
|
46
|
+
"""
|
|
47
|
+
Returns the focal length in the Y direction.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
float
|
|
52
|
+
|
|
53
|
+
"""
|
|
54
|
+
return self._focal_y
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from syned.beamline.optical_elements.ideal_elements.ideal_element import IdealElement
|
|
2
|
+
|
|
3
|
+
class Screen(IdealElement):
|
|
4
|
+
"""
|
|
5
|
+
Defines an ideal screen (a plane perpendiculat to the optical axis).
|
|
6
|
+
|
|
7
|
+
Constructor.
|
|
8
|
+
|
|
9
|
+
Parameters
|
|
10
|
+
----------
|
|
11
|
+
name : str, optional
|
|
12
|
+
The name of the optical element.
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
def __init__(self, name="Undefined"):
|
|
16
|
+
IdealElement.__init__(self, name=name)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from syned.beamline.shape import SurfaceShape
|
|
2
|
+
from syned.beamline.optical_element_with_surface_shape import OpticalElementsWithSurfaceShape
|
|
3
|
+
|
|
4
|
+
class Mirror(OpticalElementsWithSurfaceShape):
|
|
5
|
+
"""
|
|
6
|
+
Constructor.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
name : str
|
|
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
|
+
coating : str, optional
|
|
17
|
+
The grating coating material.
|
|
18
|
+
coating_thickness : float, optional
|
|
19
|
+
The grating coating thickness in m.
|
|
20
|
+
"""
|
|
21
|
+
def __init__(self,
|
|
22
|
+
name="Undefined",
|
|
23
|
+
surface_shape=SurfaceShape(),
|
|
24
|
+
boundary_shape=None,
|
|
25
|
+
coating=None,
|
|
26
|
+
coating_thickness=None):
|
|
27
|
+
|
|
28
|
+
super().__init__(name, surface_shape, boundary_shape)
|
|
29
|
+
self._coating = coating
|
|
30
|
+
self._coating_thickness = coating_thickness
|
|
31
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
32
|
+
self._set_support_text([
|
|
33
|
+
("name", "Name" , "" ),
|
|
34
|
+
("surface_shape", "Surface shape", "" ),
|
|
35
|
+
("boundary_shape", "Boundary shape", "" ),
|
|
36
|
+
("coating", "Coating (element, compound or name)", "" ),
|
|
37
|
+
("coating_thickness", "Coating thickness", "m"),
|
|
38
|
+
] )
|
|
39
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# ----------------------------------------------------------------------- #
|
|
4
|
+
# Copyright (c) 2025, UChicago Argonne, LLC. All rights reserved. #
|
|
5
|
+
# #
|
|
6
|
+
# Copyright 2025. UChicago Argonne, LLC. This software was produced #
|
|
7
|
+
# under U.S. Government contract DE-AC02-06CH11357 for Argonne National #
|
|
8
|
+
# Laboratory (ANL), which is operated by UChicago Argonne, LLC for the #
|
|
9
|
+
# U.S. Department of Energy. The U.S. Government has rights to use, #
|
|
10
|
+
# reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR #
|
|
11
|
+
# UChicago Argonne, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR #
|
|
12
|
+
# ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is #
|
|
13
|
+
# modified to produce derivative works, such modified software should #
|
|
14
|
+
# be clearly marked, so as not to confuse it with the version available #
|
|
15
|
+
# from ANL. #
|
|
16
|
+
# #
|
|
17
|
+
# Additionally, redistribution and use in source and binary forms, with #
|
|
18
|
+
# or without modification, are permitted provided that the following #
|
|
19
|
+
# conditions are met: #
|
|
20
|
+
# #
|
|
21
|
+
# * Redistributions of source code must retain the above copyright #
|
|
22
|
+
# notice, this list of conditions and the following disclaimer. #
|
|
23
|
+
# #
|
|
24
|
+
# * Redistributions in binary form must reproduce the above copyright #
|
|
25
|
+
# notice, this list of conditions and the following disclaimer in #
|
|
26
|
+
# the documentation and/or other materials provided with the #
|
|
27
|
+
# distribution. #
|
|
28
|
+
# #
|
|
29
|
+
# * Neither the name of UChicago Argonne, LLC, Argonne National #
|
|
30
|
+
# Laboratory, ANL, the U.S. Government, nor the names of its #
|
|
31
|
+
# contributors may be used to endorse or promote products derived #
|
|
32
|
+
# from this software without specific prior written permission. #
|
|
33
|
+
# #
|
|
34
|
+
# THIS SOFTWARE IS PROVIDED BY UChicago Argonne, LLC AND CONTRIBUTORS #
|
|
35
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
|
|
36
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS #
|
|
37
|
+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UChicago #
|
|
38
|
+
# Argonne, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, #
|
|
39
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, #
|
|
40
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
|
|
41
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #
|
|
42
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT #
|
|
43
|
+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #
|
|
44
|
+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
|
|
45
|
+
# POSSIBILITY OF SUCH DAMAGE. #
|
|
46
|
+
# ----------------------------------------------------------------------- #
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from syned.beamline.shape import SurfaceShape
|
|
2
|
+
from syned.beamline.optical_element_with_surface_shape import OpticalElementsWithSurfaceShape
|
|
3
|
+
|
|
4
|
+
class Multilayer(OpticalElementsWithSurfaceShape):
|
|
5
|
+
"""
|
|
6
|
+
Constructor.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
name : str
|
|
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
|
+
structure : str, optional
|
|
17
|
+
The multilayer structure e.g. [B,W]x50+Si.
|
|
18
|
+
period : float, optional
|
|
19
|
+
The period of the repeated bilayer in A.
|
|
20
|
+
Gamma : float, optional
|
|
21
|
+
The gamma factor.
|
|
22
|
+
"""
|
|
23
|
+
def __init__(self,
|
|
24
|
+
name="Undefined",
|
|
25
|
+
surface_shape=SurfaceShape(),
|
|
26
|
+
boundary_shape=None,
|
|
27
|
+
structure='[B/W]x50+Si',
|
|
28
|
+
period=25.0,
|
|
29
|
+
Gamma=0.5,
|
|
30
|
+
):
|
|
31
|
+
|
|
32
|
+
super().__init__(name, surface_shape, boundary_shape)
|
|
33
|
+
self._structure = structure
|
|
34
|
+
self._period = period
|
|
35
|
+
self._Gamma = Gamma
|
|
36
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
37
|
+
self._set_support_text([
|
|
38
|
+
("name", "Name" , "" ),
|
|
39
|
+
("surface_shape", "Surface shape", "" ),
|
|
40
|
+
("boundary_shape", "Boundary shape", "" ),
|
|
41
|
+
("structure", "structure ([Odd,Even]xN+Substrate)", "" ),
|
|
42
|
+
("period", "period of the repeated structure", "A"),
|
|
43
|
+
("Gamma", "Gamma factor [thickness ratio Even)/(Odd+Even)", ""),
|
|
44
|
+
] )
|
|
45
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from syned.beamline.optical_elements.refractors.lens import Lens
|
|
2
|
+
|
|
3
|
+
class CRL(Lens):
|
|
4
|
+
"""
|
|
5
|
+
Defines a Compound refractive lens (CRL). It is composed by a number (n_lens) of identical lenses.
|
|
6
|
+
|
|
7
|
+
Constructor.
|
|
8
|
+
|
|
9
|
+
Parameters
|
|
10
|
+
----------
|
|
11
|
+
name : str, optional
|
|
12
|
+
The name of the optical element.
|
|
13
|
+
n_lens : int, optional
|
|
14
|
+
The number of (identical) lenses.
|
|
15
|
+
surface_shape1 : instance of SurfaceShape, optional
|
|
16
|
+
The geometry of the lens surface 1. if None, it is initialized to SurfaceShape().
|
|
17
|
+
surface_shape2 : instance of SurfaceShape, optional
|
|
18
|
+
The geometry of the lens surface 2. if None, it is initialized to SurfaceShape().
|
|
19
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
20
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
21
|
+
material : str
|
|
22
|
+
A string defining the material within the two surfaces.
|
|
23
|
+
thickness : float
|
|
24
|
+
The distance between the two surfaces at the center of the lens in m.
|
|
25
|
+
piling_thickness : float, optional
|
|
26
|
+
The piling distance in m, or spatial periodicity in the stack. In other words, the distance from the
|
|
27
|
+
lens1-surface1 to the lens2-surface1.
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
def __init__(self,
|
|
31
|
+
name="Undefined",
|
|
32
|
+
n_lens=1,
|
|
33
|
+
surface_shape1=None,
|
|
34
|
+
surface_shape2=None,
|
|
35
|
+
boundary_shape=None,
|
|
36
|
+
material="",
|
|
37
|
+
thickness=0.0,
|
|
38
|
+
piling_thickness=0.0):
|
|
39
|
+
super().__init__(name=name,
|
|
40
|
+
surface_shape1=surface_shape1,
|
|
41
|
+
surface_shape2=surface_shape2,
|
|
42
|
+
boundary_shape=boundary_shape,
|
|
43
|
+
material=material,
|
|
44
|
+
thickness=thickness)
|
|
45
|
+
self._n_lens = n_lens
|
|
46
|
+
self._piling_thickness = piling_thickness
|
|
47
|
+
|
|
48
|
+
# support text contaning name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
49
|
+
self._set_support_text([
|
|
50
|
+
("name", "Name" , "" ),
|
|
51
|
+
("n_lens", "N Lens" , "" ),
|
|
52
|
+
("surface_shapes", "Surface shapes", "" ),
|
|
53
|
+
("boundary_shape", "Boundary shape", "" ),
|
|
54
|
+
("material", "Material (element, compound or name)", "" ),
|
|
55
|
+
("thickness", "Thickness", "m"),
|
|
56
|
+
("piling_thickness", "Piling Thickness", "m")
|
|
57
|
+
] )
|
|
58
|
+
|
|
59
|
+
def get_n_lens(self):
|
|
60
|
+
"""
|
|
61
|
+
Returns the number of lenses.
|
|
62
|
+
|
|
63
|
+
Returns
|
|
64
|
+
-------
|
|
65
|
+
int
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
return self._n_lens
|
|
69
|
+
|
|
70
|
+
def get_piling_thickness(self):
|
|
71
|
+
"""
|
|
72
|
+
Returns the piling thickness.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
float
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
return self._piling_thickness
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from syned.beamline.shape import SurfaceShape
|
|
2
|
+
from syned.beamline.optical_element_with_surface_shape import OpticalElementsWithSurfaceShape
|
|
3
|
+
|
|
4
|
+
class Interface(OpticalElementsWithSurfaceShape):
|
|
5
|
+
def __init__(self,
|
|
6
|
+
name="Undefined",
|
|
7
|
+
surface_shape=SurfaceShape(),
|
|
8
|
+
boundary_shape=None,
|
|
9
|
+
material_object=None,
|
|
10
|
+
material_image=None,):
|
|
11
|
+
"""
|
|
12
|
+
Defines an interface (a surface with different materials in side 1 and side 2).
|
|
13
|
+
|
|
14
|
+
Parameters
|
|
15
|
+
----------
|
|
16
|
+
name : str, optional
|
|
17
|
+
The name of the optical element.
|
|
18
|
+
surface_shape : instance of SurfaceShape, optional
|
|
19
|
+
The geometry of the crystal surface. if None, it is initialized to SurfaceShape().
|
|
20
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
21
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
22
|
+
material_object : str, optional
|
|
23
|
+
The material in side 1 (object side).
|
|
24
|
+
material_image : str, optional
|
|
25
|
+
The material in side 2 (object image).
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
super().__init__(name, surface_shape, boundary_shape)
|
|
30
|
+
self._material_object = material_object
|
|
31
|
+
self._material_image = material_image
|
|
32
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
33
|
+
self._set_support_text([
|
|
34
|
+
("name", "Name" , "" ),
|
|
35
|
+
("surface_shape", "Surface shape", "" ),
|
|
36
|
+
("boundary_shape", "Boundary shape", "" ),
|
|
37
|
+
("material_object", "Material in object side (element, compound, name or refraction index)", "" ),
|
|
38
|
+
("material_image", "Material in image side (element, compound, name or refraction index)", ""),
|
|
39
|
+
] )
|
|
40
|
+
|
|
41
|
+
def get_material_object(self):
|
|
42
|
+
"""
|
|
43
|
+
Returns the material of side 1 (object).
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
str
|
|
48
|
+
|
|
49
|
+
"""
|
|
50
|
+
return self._material_object
|
|
51
|
+
|
|
52
|
+
def get_material_image(self):
|
|
53
|
+
"""
|
|
54
|
+
Returns the material of side 2 (image).
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
-------
|
|
58
|
+
str
|
|
59
|
+
|
|
60
|
+
"""
|
|
61
|
+
return self._material_image
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
from syned.beamline.optical_element_with_surface_shape import OpticalElementsWithMultipleShapes
|
|
2
|
+
from syned.beamline.shape import Plane
|
|
3
|
+
|
|
4
|
+
class Lens(OpticalElementsWithMultipleShapes):
|
|
5
|
+
def __init__(self,
|
|
6
|
+
name="Undefined",
|
|
7
|
+
surface_shape1=None,
|
|
8
|
+
surface_shape2=None,
|
|
9
|
+
boundary_shape=None,
|
|
10
|
+
material="",
|
|
11
|
+
thickness=0.0):
|
|
12
|
+
"""
|
|
13
|
+
Defines a lens. It is composed by two surfaces (surface_shape1 and surface_shape2) and a material
|
|
14
|
+
within them.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
name : str, optional
|
|
19
|
+
The name of the optical element.
|
|
20
|
+
surface_shape1 : instance of SurfaceShape, optional
|
|
21
|
+
The geometry of the lens surface 1. if None, it is initialized to SurfaceShape().
|
|
22
|
+
surface_shape2 : instance of SurfaceShape, optional
|
|
23
|
+
The geometry of the lens surface 2. if None, it is initialized to SurfaceShape().
|
|
24
|
+
boundary_shape : instance of BoundaryShape, optional
|
|
25
|
+
The geometry of the slit aperture. if None, it is initialized to BoundaryShape().
|
|
26
|
+
material : str
|
|
27
|
+
A string defining the material within the two surfaces.
|
|
28
|
+
thickness : float
|
|
29
|
+
The distance between the two surfaces at the center of the lens in m.
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
if surface_shape1 is None: surface_shape1 = Plane()
|
|
34
|
+
if surface_shape2 is None: surface_shape2 = Plane()
|
|
35
|
+
|
|
36
|
+
super(Lens, self).__init__(name=name,
|
|
37
|
+
boundary_shape=boundary_shape,
|
|
38
|
+
surface_shapes=[surface_shape1, surface_shape2])
|
|
39
|
+
self._material = material
|
|
40
|
+
self._thickness = thickness
|
|
41
|
+
|
|
42
|
+
# support text contaning name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
43
|
+
self._set_support_text([
|
|
44
|
+
("name", "Name" , "" ),
|
|
45
|
+
("surface_shapes", "Surface shapes", ""),
|
|
46
|
+
("boundary_shape", "Boundary shape", "" ),
|
|
47
|
+
("material", "Material (element, compound or name)", "" ),
|
|
48
|
+
("thickness", "Thickness", "m"),
|
|
49
|
+
] )
|
|
50
|
+
|
|
51
|
+
def get_thickness(self):
|
|
52
|
+
"""
|
|
53
|
+
Returns the lens thickness in m.
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
float
|
|
58
|
+
|
|
59
|
+
"""
|
|
60
|
+
return self._thickness
|
|
61
|
+
|
|
62
|
+
def get_material(self):
|
|
63
|
+
"""
|
|
64
|
+
Returns the lens material.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
str
|
|
69
|
+
|
|
70
|
+
"""
|
|
71
|
+
return self._material
|
|
72
|
+
|
|
73
|
+
def get_boundary_shape(self):
|
|
74
|
+
"""
|
|
75
|
+
Returns the boundary shape.
|
|
76
|
+
|
|
77
|
+
Returns
|
|
78
|
+
-------
|
|
79
|
+
instance of BoundaryShape
|
|
80
|
+
|
|
81
|
+
"""
|
|
82
|
+
return self._boundary_shape
|
|
83
|
+
|
|
84
|
+
def get_surface_shape1(self):
|
|
85
|
+
"""
|
|
86
|
+
Returns the shape of surface 1.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
instance of SurfaceShape
|
|
91
|
+
|
|
92
|
+
"""
|
|
93
|
+
return self.get_surface_shape(index=0)
|
|
94
|
+
|
|
95
|
+
def get_surface_shape2(self):
|
|
96
|
+
"""
|
|
97
|
+
Returns the shape of surface 2.
|
|
98
|
+
|
|
99
|
+
Returns
|
|
100
|
+
-------
|
|
101
|
+
instance of SurfaceShape
|
|
102
|
+
|
|
103
|
+
"""
|
|
104
|
+
return self.get_surface_shape(index=1)
|
|
105
|
+
|