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.
Files changed (52) hide show
  1. syned/beamline/__init__.py +1 -1
  2. syned/beamline/beamline.py +155 -155
  3. syned/beamline/beamline_element.py +76 -76
  4. syned/beamline/element_coordinates.py +199 -199
  5. syned/beamline/optical_element.py +47 -47
  6. syned/beamline/optical_element_with_surface_shape.py +126 -126
  7. syned/beamline/optical_elements/__init__.py +1 -1
  8. syned/beamline/optical_elements/absorbers/absorber.py +21 -21
  9. syned/beamline/optical_elements/absorbers/beam_stopper.py +63 -63
  10. syned/beamline/optical_elements/absorbers/filter.py +61 -61
  11. syned/beamline/optical_elements/absorbers/holed_filter.py +67 -67
  12. syned/beamline/optical_elements/absorbers/slit.py +80 -80
  13. syned/beamline/optical_elements/crystals/__init__.py +1 -1
  14. syned/beamline/optical_elements/crystals/crystal.py +70 -70
  15. syned/beamline/optical_elements/gratings/__init__.py +1 -1
  16. syned/beamline/optical_elements/gratings/grating.py +279 -279
  17. syned/beamline/optical_elements/ideal_elements/__init__.py +1 -1
  18. syned/beamline/optical_elements/ideal_elements/ideal_element.py +15 -15
  19. syned/beamline/optical_elements/ideal_elements/ideal_fzp.py +183 -183
  20. syned/beamline/optical_elements/ideal_elements/ideal_lens.py +54 -54
  21. syned/beamline/optical_elements/ideal_elements/screen.py +15 -15
  22. syned/beamline/optical_elements/mirrors/__init__.py +1 -1
  23. syned/beamline/optical_elements/mirrors/mirror.py +39 -39
  24. syned/beamline/optical_elements/multilayers/__init__.py +46 -46
  25. syned/beamline/optical_elements/multilayers/multilayer.py +45 -45
  26. syned/beamline/optical_elements/refractors/__init__.py +1 -1
  27. syned/beamline/optical_elements/refractors/crl.py +79 -79
  28. syned/beamline/optical_elements/refractors/interface.py +60 -60
  29. syned/beamline/optical_elements/refractors/lens.py +105 -105
  30. syned/beamline/shape.py +2884 -2803
  31. syned/storage_ring/__init__.py +1 -1
  32. syned/storage_ring/electron_beam.py +804 -804
  33. syned/storage_ring/empty_light_source.py +40 -40
  34. syned/storage_ring/light_source.py +90 -90
  35. syned/storage_ring/magnetic_structure.py +8 -8
  36. syned/storage_ring/magnetic_structures/__init__.py +1 -1
  37. syned/storage_ring/magnetic_structures/bending_magnet.py +329 -329
  38. syned/storage_ring/magnetic_structures/insertion_device.py +169 -169
  39. syned/storage_ring/magnetic_structures/undulator.py +413 -413
  40. syned/storage_ring/magnetic_structures/wiggler.py +27 -27
  41. syned/syned_object.py +273 -264
  42. syned/util/__init__.py +21 -21
  43. syned/util/json_tools.py +196 -198
  44. syned/widget/widget_decorator.py +66 -66
  45. {syned-1.0.47.dist-info → syned-1.0.49.dist-info}/METADATA +88 -88
  46. syned-1.0.49.dist-info/RECORD +52 -0
  47. {syned-1.0.47.dist-info → syned-1.0.49.dist-info}/WHEEL +1 -1
  48. {syned-1.0.47.dist-info → syned-1.0.49.dist-info}/licenses/LICENSE +20 -20
  49. syned/__test/__init__.py +0 -46
  50. syned/__test/test.py +0 -28
  51. syned-1.0.47.dist-info/RECORD +0 -54
  52. {syned-1.0.47.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()))