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 +1 @@
1
-
1
+
@@ -1,155 +1,155 @@
1
- """
2
- Represents a beamline. The beamline is composed by a light source ans a list of beamline elements.
3
- """
4
-
5
- from syned.syned_object import SynedObject
6
- from syned.storage_ring.light_source import LightSource
7
- from syned.storage_ring.empty_light_source import EmptyLightSource
8
- from syned.beamline.beamline_element import BeamlineElement
9
-
10
- from collections import OrderedDict
11
-
12
- class Beamline(SynedObject):
13
- """
14
- Constructor.
15
-
16
- Parameters
17
- ----------
18
- light_source : instance of LightSource
19
- The light source
20
- beamline_elements_list : list
21
- The beamline elements (each one an instance of BeamlineElement).
22
- """
23
- def __init__(self, light_source=LightSource(), beamline_elements_list=None):
24
- self._light_source = light_source
25
- if beamline_elements_list is None:
26
- self._beamline_elements_list = []
27
- else:
28
- self._beamline_elements_list = beamline_elements_list
29
-
30
- # support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
31
- self._set_support_text([
32
- ("light_source", "Light Source", ""),
33
- ("beamline_elements_list", "Beamline Elements", ""),
34
- ] )
35
-
36
-
37
- # overwrites the SynedObject method for dealing with list
38
- def to_dictionary(self):
39
- """
40
- Returns a dictionary with the object fields.
41
-
42
- Returns
43
- -------
44
- dict
45
- A dictionary with the data.
46
-
47
- """
48
- dict_to_save = OrderedDict()
49
- dict_to_save.update({"CLASS_NAME":self.__class__.__name__})
50
-
51
- dict_to_save["light_source"] = self._light_source.to_dictionary()
52
- dict_to_save["beamline_elements_list"] = [el.to_dictionary() for el in self._beamline_elements_list]
53
-
54
- return dict_to_save
55
-
56
-
57
-
58
- def get_light_source(self):
59
- """
60
- Returns the light source
61
-
62
- Returns
63
- -------
64
- instance of LightSource
65
-
66
- """
67
- return self._light_source
68
-
69
- def get_beamline_elements(self):
70
- """
71
- returns the beamline elements.
72
-
73
- Returns
74
- -------
75
- list
76
-
77
- """
78
- return self._beamline_elements_list
79
-
80
- def set_light_source(self, light_source=LightSource()):
81
- """
82
- Sets a light source.
83
-
84
- Parameters
85
- ----------
86
- light_source : instance of LightSource
87
-
88
- """
89
- if not (isinstance(light_source,LightSource) or isinstance(light_source,EmptyLightSource)):
90
- raise Exception("Input class must be of type: "+LightSource.__name__+" or "+EmptyLightSource.__name__)
91
- else:
92
- self._light_source = light_source
93
-
94
- def append_beamline_element(self, beamline_element=BeamlineElement()):
95
- """
96
- Appends a beamline element.
97
-
98
- Parameters
99
- ----------
100
- beamline_element : instance of BeamlineElement.
101
-
102
- """
103
- if not isinstance(beamline_element,BeamlineElement):
104
- raise Exception("Input class must be of type: "+BeamlineElement.__name__)
105
- else:
106
- self._beamline_elements_list.append(beamline_element)
107
-
108
- def get_beamline_elements_number(self):
109
- """
110
- Gets the number of beamline elements stored.
111
-
112
- Returns
113
- -------
114
- int
115
-
116
- """
117
- return len(self._beamline_elements_list)
118
-
119
- def get_beamline_element_at(self, index):
120
- """
121
- gets an individual beamline element.
122
-
123
- Parameters
124
- ----------
125
- index : int
126
- The index of the beamline element to be retrieved.
127
-
128
- Returns
129
- -------
130
- instance of BeamlineElement
131
- The wanted beamline element (referenced, not copied).
132
-
133
- """
134
- if index >= len(self._beamline_elements_list):
135
- raise IndexError("Index " + str(index) + " out of bounds")
136
-
137
- return self._beamline_elements_list[index]
138
-
139
- # TODO: remove: probably this is not needed, as the deepcopy in SynedObject makes the work.
140
- def duplicate(self):
141
- """
142
- Returns a copy of the beamline element instance.
143
-
144
- Returns
145
- -------
146
- BeamlineElement instance
147
- A copy of the object instance.
148
-
149
- """
150
- beamline_elements_list = []
151
- for beamline_element in self._beamline_elements_list:
152
- beamline_elements_list.append(beamline_element)
153
-
154
- return Beamline(light_source=self._light_source,
155
- beamline_elements_list = beamline_elements_list)
1
+ """
2
+ Represents a beamline. The beamline is composed by a light source ans a list of beamline elements.
3
+ """
4
+
5
+ from syned.syned_object import SynedObject
6
+ from syned.storage_ring.light_source import LightSource
7
+ from syned.storage_ring.empty_light_source import EmptyLightSource
8
+ from syned.beamline.beamline_element import BeamlineElement
9
+
10
+ from collections import OrderedDict
11
+
12
+ class Beamline(SynedObject):
13
+ """
14
+ Constructor.
15
+
16
+ Parameters
17
+ ----------
18
+ light_source : instance of LightSource
19
+ The light source
20
+ beamline_elements_list : list
21
+ The beamline elements (each one an instance of BeamlineElement).
22
+ """
23
+ def __init__(self, light_source=LightSource(), beamline_elements_list=None):
24
+ self._light_source = light_source
25
+ if beamline_elements_list is None:
26
+ self._beamline_elements_list = []
27
+ else:
28
+ self._beamline_elements_list = beamline_elements_list
29
+
30
+ # support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
31
+ self._set_support_text([
32
+ ("light_source", "Light Source", ""),
33
+ ("beamline_elements_list", "Beamline Elements", ""),
34
+ ] )
35
+
36
+
37
+ # overwrites the SynedObject method for dealing with list
38
+ def to_dictionary(self):
39
+ """
40
+ Returns a dictionary with the object fields.
41
+
42
+ Returns
43
+ -------
44
+ dict
45
+ A dictionary with the data.
46
+
47
+ """
48
+ dict_to_save = OrderedDict()
49
+ dict_to_save.update({"CLASS_NAME":self.__class__.__name__})
50
+
51
+ dict_to_save["light_source"] = self._light_source.to_dictionary()
52
+ dict_to_save["beamline_elements_list"] = [el.to_dictionary() for el in self._beamline_elements_list]
53
+
54
+ return dict_to_save
55
+
56
+
57
+
58
+ def get_light_source(self):
59
+ """
60
+ Returns the light source
61
+
62
+ Returns
63
+ -------
64
+ instance of LightSource
65
+
66
+ """
67
+ return self._light_source
68
+
69
+ def get_beamline_elements(self):
70
+ """
71
+ returns the beamline elements.
72
+
73
+ Returns
74
+ -------
75
+ list
76
+
77
+ """
78
+ return self._beamline_elements_list
79
+
80
+ def set_light_source(self, light_source=LightSource()):
81
+ """
82
+ Sets a light source.
83
+
84
+ Parameters
85
+ ----------
86
+ light_source : instance of LightSource
87
+
88
+ """
89
+ if not (isinstance(light_source,LightSource) or isinstance(light_source,EmptyLightSource)):
90
+ raise Exception("Input class must be of type: "+LightSource.__name__+" or "+EmptyLightSource.__name__)
91
+ else:
92
+ self._light_source = light_source
93
+
94
+ def append_beamline_element(self, beamline_element=BeamlineElement()):
95
+ """
96
+ Appends a beamline element.
97
+
98
+ Parameters
99
+ ----------
100
+ beamline_element : instance of BeamlineElement.
101
+
102
+ """
103
+ if not isinstance(beamline_element,BeamlineElement):
104
+ raise Exception("Input class must be of type: "+BeamlineElement.__name__)
105
+ else:
106
+ self._beamline_elements_list.append(beamline_element)
107
+
108
+ def get_beamline_elements_number(self):
109
+ """
110
+ Gets the number of beamline elements stored.
111
+
112
+ Returns
113
+ -------
114
+ int
115
+
116
+ """
117
+ return len(self._beamline_elements_list)
118
+
119
+ def get_beamline_element_at(self, index):
120
+ """
121
+ gets an individual beamline element.
122
+
123
+ Parameters
124
+ ----------
125
+ index : int
126
+ The index of the beamline element to be retrieved.
127
+
128
+ Returns
129
+ -------
130
+ instance of BeamlineElement
131
+ The wanted beamline element (referenced, not copied).
132
+
133
+ """
134
+ if index >= len(self._beamline_elements_list):
135
+ raise IndexError("Index " + str(index) + " out of bounds")
136
+
137
+ return self._beamline_elements_list[index]
138
+
139
+ # TODO: remove: probably this is not needed, as the deepcopy in SynedObject makes the work.
140
+ def duplicate(self):
141
+ """
142
+ Returns a copy of the beamline element instance.
143
+
144
+ Returns
145
+ -------
146
+ BeamlineElement instance
147
+ A copy of the object instance.
148
+
149
+ """
150
+ beamline_elements_list = []
151
+ for beamline_element in self._beamline_elements_list:
152
+ beamline_elements_list.append(beamline_element)
153
+
154
+ return Beamline(light_source=self._light_source,
155
+ beamline_elements_list = beamline_elements_list)
@@ -1,76 +1,76 @@
1
- """
2
- Base class for all beamline elements. A beamline element is composed by an optical element (instance of OpticalElement)
3
- and its position in th ebeamline (an instance of ElementCoordinates).
4
- """
5
-
6
- from syned.syned_object import SynedObject
7
- from syned.beamline.optical_element import OpticalElement
8
- from syned.beamline.element_coordinates import ElementCoordinates
9
-
10
- class BeamlineElement(SynedObject):
11
- """
12
- Constructor
13
-
14
- Parameters
15
- ----------
16
- optical_element : instance of OpticalElement
17
- coordinates : instance of ElementCoordinates
18
- """
19
- def __init__(self, optical_element=OpticalElement(), coordinates=ElementCoordinates()):
20
- self._optical_element = optical_element
21
- self._coordinates = coordinates
22
- # support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
23
- self._set_support_text([
24
- ("optical_element", "Optical Element", ""),
25
- ("coordinates", "Element coordinates", ""),
26
- ] )
27
-
28
- def get_optical_element(self):
29
- """
30
- Returns the optical element.
31
-
32
- Returns
33
- -------
34
- instance of OpticalElement
35
-
36
- """
37
- return self._optical_element
38
-
39
- def get_coordinates(self):
40
- """
41
- Returns the element coordinates.
42
-
43
- Returns
44
- -------
45
- instance of ElementCoordinates
46
-
47
- """
48
- return self._coordinates
49
-
50
- def set_optical_element(self, value):
51
- """
52
- Sets the optical element.
53
-
54
- Parameters
55
- ----------
56
- value : instance of OpticalElement
57
-
58
- """
59
- if isinstance(value, OpticalElement):
60
- self._optical_element = value
61
- else:
62
- raise Exception("entry is not an instance of OpticalElement")
63
-
64
- def set_coordinates(self, value):
65
- """
66
- Sets the coordinates.
67
-
68
- Parameters
69
- ----------
70
- value : instance of ElementCoordinates.
71
-
72
- """
73
- if isinstance(value, ElementCoordinates):
74
- self._coordinates = value
75
- else:
76
- raise Exception("entry is not an instance of ElementCoordinates")
1
+ """
2
+ Base class for all beamline elements. A beamline element is composed by an optical element (instance of OpticalElement)
3
+ and its position in th ebeamline (an instance of ElementCoordinates).
4
+ """
5
+
6
+ from syned.syned_object import SynedObject
7
+ from syned.beamline.optical_element import OpticalElement
8
+ from syned.beamline.element_coordinates import ElementCoordinates
9
+
10
+ class BeamlineElement(SynedObject):
11
+ """
12
+ Constructor
13
+
14
+ Parameters
15
+ ----------
16
+ optical_element : instance of OpticalElement
17
+ coordinates : instance of ElementCoordinates
18
+ """
19
+ def __init__(self, optical_element=OpticalElement(), coordinates=ElementCoordinates()):
20
+ self._optical_element = optical_element
21
+ self._coordinates = coordinates
22
+ # support text containg name of variable, help text and unit. Will be stored in self._support_dictionary
23
+ self._set_support_text([
24
+ ("optical_element", "Optical Element", ""),
25
+ ("coordinates", "Element coordinates", ""),
26
+ ] )
27
+
28
+ def get_optical_element(self):
29
+ """
30
+ Returns the optical element.
31
+
32
+ Returns
33
+ -------
34
+ instance of OpticalElement
35
+
36
+ """
37
+ return self._optical_element
38
+
39
+ def get_coordinates(self):
40
+ """
41
+ Returns the element coordinates.
42
+
43
+ Returns
44
+ -------
45
+ instance of ElementCoordinates
46
+
47
+ """
48
+ return self._coordinates
49
+
50
+ def set_optical_element(self, value):
51
+ """
52
+ Sets the optical element.
53
+
54
+ Parameters
55
+ ----------
56
+ value : instance of OpticalElement
57
+
58
+ """
59
+ if isinstance(value, OpticalElement):
60
+ self._optical_element = value
61
+ else:
62
+ raise Exception("entry is not an instance of OpticalElement")
63
+
64
+ def set_coordinates(self, value):
65
+ """
66
+ Sets the coordinates.
67
+
68
+ Parameters
69
+ ----------
70
+ value : instance of ElementCoordinates.
71
+
72
+ """
73
+ if isinstance(value, ElementCoordinates):
74
+ self._coordinates = value
75
+ else:
76
+ raise Exception("entry is not an instance of ElementCoordinates")