syned 1.0.48__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 -275
- syned/util/__init__.py +21 -21
- syned/util/json_tools.py +196 -198
- syned/widget/widget_decorator.py +66 -66
- {syned-1.0.48.dist-info → syned-1.0.49.dist-info}/METADATA +88 -87
- syned-1.0.49.dist-info/RECORD +52 -0
- {syned-1.0.48.dist-info → syned-1.0.49.dist-info}/WHEEL +1 -1
- {syned-1.0.48.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.48.dist-info/RECORD +0 -54
- {syned-1.0.48.dist-info → syned-1.0.49.dist-info}/top_level.txt +0 -0
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
3
|
-
Base class for all insertion devices: wiggler, undulator
|
|
4
|
-
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from numpy import pi
|
|
8
|
-
import scipy.constants as codata
|
|
9
|
-
|
|
10
|
-
from syned.storage_ring.magnetic_structure import MagneticStructure
|
|
11
|
-
|
|
12
|
-
class InsertionDevice(MagneticStructure):
|
|
13
|
-
"""
|
|
14
|
-
Base clase for the Insertion Device (ID) (common class for wigglers and undulators).
|
|
15
|
-
|
|
16
|
-
Parameters
|
|
17
|
-
----------
|
|
18
|
-
K_vertical : float, optional
|
|
19
|
-
The deflection K parameter corresponding to magnetic field in the vertical direction.
|
|
20
|
-
K_horizontal : float, optional
|
|
21
|
-
The deflection K parameter corresponding to magnetic field in the horizontal direction.
|
|
22
|
-
period_length : float, optional
|
|
23
|
-
The ID period in m.
|
|
24
|
-
number_of_periods : float, optional
|
|
25
|
-
The number of periods. It may be a float, considering that number_of_periods = ID_length / period_length.
|
|
26
|
-
|
|
27
|
-
"""
|
|
28
|
-
def __init__(self,
|
|
29
|
-
K_vertical = 0.0,
|
|
30
|
-
K_horizontal = 0.0,
|
|
31
|
-
period_length = 0.0,
|
|
32
|
-
number_of_periods = 1.0):
|
|
33
|
-
MagneticStructure.__init__(self)
|
|
34
|
-
|
|
35
|
-
self._K_vertical = K_vertical
|
|
36
|
-
self._K_horizontal = K_horizontal
|
|
37
|
-
self._period_length = period_length
|
|
38
|
-
self._number_of_periods = number_of_periods
|
|
39
|
-
|
|
40
|
-
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
41
|
-
self._set_support_text([
|
|
42
|
-
("K_vertical" , "K value (vertical)" , "" ),
|
|
43
|
-
("K_horizontal" , "K value (horizontal)", "" ),
|
|
44
|
-
("period_length" , "Period length" , "m" ),
|
|
45
|
-
("number_of_periods" , "Number of periods" , "" ),
|
|
46
|
-
] )
|
|
47
|
-
|
|
48
|
-
def K_vertical(self):
|
|
49
|
-
"""
|
|
50
|
-
Returns K vertical.
|
|
51
|
-
|
|
52
|
-
Returns
|
|
53
|
-
-------
|
|
54
|
-
float
|
|
55
|
-
|
|
56
|
-
"""
|
|
57
|
-
return self._K_vertical
|
|
58
|
-
|
|
59
|
-
def K_horizontal(self):
|
|
60
|
-
"""
|
|
61
|
-
Returns K horizontal.
|
|
62
|
-
|
|
63
|
-
Returns
|
|
64
|
-
-------
|
|
65
|
-
float
|
|
66
|
-
|
|
67
|
-
"""
|
|
68
|
-
return self._K_horizontal
|
|
69
|
-
|
|
70
|
-
def period_length(self):
|
|
71
|
-
"""
|
|
72
|
-
Returns the ID period in m.
|
|
73
|
-
|
|
74
|
-
Returns
|
|
75
|
-
-------
|
|
76
|
-
float
|
|
77
|
-
|
|
78
|
-
"""
|
|
79
|
-
return self._period_length
|
|
80
|
-
|
|
81
|
-
def number_of_periods(self):
|
|
82
|
-
"""
|
|
83
|
-
Returns the number of periods.
|
|
84
|
-
|
|
85
|
-
Returns
|
|
86
|
-
-------
|
|
87
|
-
float
|
|
88
|
-
|
|
89
|
-
"""
|
|
90
|
-
return self._number_of_periods
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
#
|
|
94
|
-
# some easy calculations
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
def K(self):
|
|
98
|
-
"""
|
|
99
|
-
Returns K vertical.
|
|
100
|
-
|
|
101
|
-
Returns
|
|
102
|
-
-------
|
|
103
|
-
float
|
|
104
|
-
|
|
105
|
-
"""
|
|
106
|
-
return self.K_vertical()
|
|
107
|
-
|
|
108
|
-
def length(self):
|
|
109
|
-
"""
|
|
110
|
-
Returns the ID length in m.
|
|
111
|
-
|
|
112
|
-
Returns
|
|
113
|
-
-------
|
|
114
|
-
float
|
|
115
|
-
|
|
116
|
-
"""
|
|
117
|
-
return self.number_of_periods() * self.period_length()
|
|
118
|
-
|
|
119
|
-
def magnetic_field_vertical(self):
|
|
120
|
-
"""
|
|
121
|
-
Returns the peak magnetic field in T in the vertical direction.
|
|
122
|
-
|
|
123
|
-
Returns
|
|
124
|
-
-------
|
|
125
|
-
float
|
|
126
|
-
|
|
127
|
-
"""
|
|
128
|
-
return self.__magnetic_field_from_K(self.K_vertical())
|
|
129
|
-
|
|
130
|
-
def magnetic_field_horizontal(self):
|
|
131
|
-
"""
|
|
132
|
-
Returns the peak magnetic field in T in the horizontal direction.
|
|
133
|
-
|
|
134
|
-
Returns
|
|
135
|
-
-------
|
|
136
|
-
float
|
|
137
|
-
|
|
138
|
-
"""
|
|
139
|
-
return self.__magnetic_field_from_K(self.K_horizontal())
|
|
140
|
-
|
|
141
|
-
def set_K_vertical_from_magnetic_field(self, B_vertical):
|
|
142
|
-
"""
|
|
143
|
-
Set the vertical K value given the corresponding peak magnetic field.
|
|
144
|
-
|
|
145
|
-
Parameters
|
|
146
|
-
----------
|
|
147
|
-
B_vertical : float
|
|
148
|
-
Peak magnetic field in T.
|
|
149
|
-
|
|
150
|
-
"""
|
|
151
|
-
self._K_vertical = self.__K_from_magnetic_field(B_vertical)
|
|
152
|
-
|
|
153
|
-
def set_K_horizontal_from_magnetic_field(self, B_horizontal):
|
|
154
|
-
"""
|
|
155
|
-
Set the horizontal K value given the corresponding peak magnetic field.
|
|
156
|
-
|
|
157
|
-
Parameters
|
|
158
|
-
----------
|
|
159
|
-
B_vertical : float
|
|
160
|
-
Peak magnetic field in T.
|
|
161
|
-
|
|
162
|
-
"""
|
|
163
|
-
self._K_horizontal = self.__K_from_magnetic_field(B_horizontal)
|
|
164
|
-
|
|
165
|
-
def __magnetic_field_from_K(self, K):
|
|
166
|
-
return K * 2 * pi * codata.m_e * codata.c / (codata.e * self.period_length())
|
|
167
|
-
|
|
168
|
-
def __K_from_magnetic_field(self, B):
|
|
169
|
-
return B /(2 * pi * codata.m_e * codata.c / (codata.e * self.period_length()))
|
|
1
|
+
"""
|
|
2
|
+
|
|
3
|
+
Base class for all insertion devices: wiggler, undulator
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from numpy import pi
|
|
8
|
+
import scipy.constants as codata
|
|
9
|
+
|
|
10
|
+
from syned.storage_ring.magnetic_structure import MagneticStructure
|
|
11
|
+
|
|
12
|
+
class InsertionDevice(MagneticStructure):
|
|
13
|
+
"""
|
|
14
|
+
Base clase for the Insertion Device (ID) (common class for wigglers and undulators).
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
K_vertical : float, optional
|
|
19
|
+
The deflection K parameter corresponding to magnetic field in the vertical direction.
|
|
20
|
+
K_horizontal : float, optional
|
|
21
|
+
The deflection K parameter corresponding to magnetic field in the horizontal direction.
|
|
22
|
+
period_length : float, optional
|
|
23
|
+
The ID period in m.
|
|
24
|
+
number_of_periods : float, optional
|
|
25
|
+
The number of periods. It may be a float, considering that number_of_periods = ID_length / period_length.
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
def __init__(self,
|
|
29
|
+
K_vertical = 0.0,
|
|
30
|
+
K_horizontal = 0.0,
|
|
31
|
+
period_length = 0.0,
|
|
32
|
+
number_of_periods = 1.0):
|
|
33
|
+
MagneticStructure.__init__(self)
|
|
34
|
+
|
|
35
|
+
self._K_vertical = K_vertical
|
|
36
|
+
self._K_horizontal = K_horizontal
|
|
37
|
+
self._period_length = period_length
|
|
38
|
+
self._number_of_periods = number_of_periods
|
|
39
|
+
|
|
40
|
+
# support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
|
|
41
|
+
self._set_support_text([
|
|
42
|
+
("K_vertical" , "K value (vertical)" , "" ),
|
|
43
|
+
("K_horizontal" , "K value (horizontal)", "" ),
|
|
44
|
+
("period_length" , "Period length" , "m" ),
|
|
45
|
+
("number_of_periods" , "Number of periods" , "" ),
|
|
46
|
+
] )
|
|
47
|
+
|
|
48
|
+
def K_vertical(self):
|
|
49
|
+
"""
|
|
50
|
+
Returns K vertical.
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
float
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
return self._K_vertical
|
|
58
|
+
|
|
59
|
+
def K_horizontal(self):
|
|
60
|
+
"""
|
|
61
|
+
Returns K horizontal.
|
|
62
|
+
|
|
63
|
+
Returns
|
|
64
|
+
-------
|
|
65
|
+
float
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
return self._K_horizontal
|
|
69
|
+
|
|
70
|
+
def period_length(self):
|
|
71
|
+
"""
|
|
72
|
+
Returns the ID period in m.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
float
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
return self._period_length
|
|
80
|
+
|
|
81
|
+
def number_of_periods(self):
|
|
82
|
+
"""
|
|
83
|
+
Returns the number of periods.
|
|
84
|
+
|
|
85
|
+
Returns
|
|
86
|
+
-------
|
|
87
|
+
float
|
|
88
|
+
|
|
89
|
+
"""
|
|
90
|
+
return self._number_of_periods
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
#
|
|
94
|
+
# some easy calculations
|
|
95
|
+
#
|
|
96
|
+
|
|
97
|
+
def K(self):
|
|
98
|
+
"""
|
|
99
|
+
Returns K vertical.
|
|
100
|
+
|
|
101
|
+
Returns
|
|
102
|
+
-------
|
|
103
|
+
float
|
|
104
|
+
|
|
105
|
+
"""
|
|
106
|
+
return self.K_vertical()
|
|
107
|
+
|
|
108
|
+
def length(self):
|
|
109
|
+
"""
|
|
110
|
+
Returns the ID length in m.
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
float
|
|
115
|
+
|
|
116
|
+
"""
|
|
117
|
+
return self.number_of_periods() * self.period_length()
|
|
118
|
+
|
|
119
|
+
def magnetic_field_vertical(self):
|
|
120
|
+
"""
|
|
121
|
+
Returns the peak magnetic field in T in the vertical direction.
|
|
122
|
+
|
|
123
|
+
Returns
|
|
124
|
+
-------
|
|
125
|
+
float
|
|
126
|
+
|
|
127
|
+
"""
|
|
128
|
+
return self.__magnetic_field_from_K(self.K_vertical())
|
|
129
|
+
|
|
130
|
+
def magnetic_field_horizontal(self):
|
|
131
|
+
"""
|
|
132
|
+
Returns the peak magnetic field in T in the horizontal direction.
|
|
133
|
+
|
|
134
|
+
Returns
|
|
135
|
+
-------
|
|
136
|
+
float
|
|
137
|
+
|
|
138
|
+
"""
|
|
139
|
+
return self.__magnetic_field_from_K(self.K_horizontal())
|
|
140
|
+
|
|
141
|
+
def set_K_vertical_from_magnetic_field(self, B_vertical):
|
|
142
|
+
"""
|
|
143
|
+
Set the vertical K value given the corresponding peak magnetic field.
|
|
144
|
+
|
|
145
|
+
Parameters
|
|
146
|
+
----------
|
|
147
|
+
B_vertical : float
|
|
148
|
+
Peak magnetic field in T.
|
|
149
|
+
|
|
150
|
+
"""
|
|
151
|
+
self._K_vertical = self.__K_from_magnetic_field(B_vertical)
|
|
152
|
+
|
|
153
|
+
def set_K_horizontal_from_magnetic_field(self, B_horizontal):
|
|
154
|
+
"""
|
|
155
|
+
Set the horizontal K value given the corresponding peak magnetic field.
|
|
156
|
+
|
|
157
|
+
Parameters
|
|
158
|
+
----------
|
|
159
|
+
B_vertical : float
|
|
160
|
+
Peak magnetic field in T.
|
|
161
|
+
|
|
162
|
+
"""
|
|
163
|
+
self._K_horizontal = self.__K_from_magnetic_field(B_horizontal)
|
|
164
|
+
|
|
165
|
+
def __magnetic_field_from_K(self, K):
|
|
166
|
+
return K * 2 * pi * codata.m_e * codata.c / (codata.e * self.period_length())
|
|
167
|
+
|
|
168
|
+
def __K_from_magnetic_field(self, B):
|
|
169
|
+
return B /(2 * pi * codata.m_e * codata.c / (codata.e * self.period_length()))
|