syned 1.0.34__tar.gz → 1.0.35__tar.gz

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 (75) hide show
  1. {syned-1.0.34/syned.egg-info → syned-1.0.35}/PKG-INFO +1 -1
  2. {syned-1.0.34 → syned-1.0.35}/setup.py +1 -1
  3. {syned-1.0.34 → syned-1.0.35}/syned/version.py +3 -3
  4. {syned-1.0.34 → syned-1.0.35/syned.egg-info}/PKG-INFO +1 -1
  5. {syned-1.0.34 → syned-1.0.35}/syned.egg-info/SOURCES.txt +0 -14
  6. syned-1.0.34/syned/tools/__init__.py +0 -46
  7. syned-1.0.34/syned/tools/benders/__init__.py +0 -46
  8. syned-1.0.34/syned/tools/benders/bender_io.py +0 -123
  9. syned-1.0.34/syned/tools/benders/bender_manager.py +0 -170
  10. syned-1.0.34/syned/tools/benders/fixed_rods_bender_manager.py +0 -405
  11. syned-1.0.34/syned/tools/benders/flexural_hinge_bender_manager.py +0 -461
  12. syned-1.0.34/syned/tools/diaboloid/__init__.py +0 -46
  13. syned-1.0.34/syned/tools/diaboloid/diaboloid_calculator.py +0 -467
  14. syned-1.0.34/syned/tools/diaboloid/fqs.py +0 -542
  15. syned-1.0.34/syned/tools/error_profile/__init__.py +0 -46
  16. syned-1.0.34/syned/tools/error_profile/error_profile_calculator.py +0 -581
  17. syned-1.0.34/syned/tools/hybrid_beam/__init__.py +0 -46
  18. syned-1.0.34/syned/tools/hybrid_undulator/__init__.py +0 -46
  19. syned-1.0.34/syned/tools/thermal_load/__init__.py +0 -46
  20. {syned-1.0.34 → syned-1.0.35}/LICENSE +0 -0
  21. {syned-1.0.34 → syned-1.0.35}/MANIFEST.in +0 -0
  22. {syned-1.0.34 → syned-1.0.35}/README.rst +0 -0
  23. {syned-1.0.34 → syned-1.0.35}/examples/__init__.py +0 -0
  24. {syned-1.0.34 → syned-1.0.35}/examples/example_beamline.py +0 -0
  25. {syned-1.0.34 → syned-1.0.35}/examples/example_double_slit.py +0 -0
  26. {syned-1.0.34 → syned-1.0.35}/examples/example_json_input_output.py +0 -0
  27. {syned-1.0.34 → syned-1.0.35}/setup.cfg +0 -0
  28. {syned-1.0.34 → syned-1.0.35}/syned/__init__.py +0 -0
  29. {syned-1.0.34 → syned-1.0.35}/syned/beamline/__init__.py +0 -0
  30. {syned-1.0.34 → syned-1.0.35}/syned/beamline/beamline.py +0 -0
  31. {syned-1.0.34 → syned-1.0.35}/syned/beamline/beamline_element.py +0 -0
  32. {syned-1.0.34 → syned-1.0.35}/syned/beamline/element_coordinates.py +0 -0
  33. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_element.py +0 -0
  34. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_element_with_surface_shape.py +0 -0
  35. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/__init__.py +0 -0
  36. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/absorbers/__init__.py +0 -0
  37. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/absorbers/absorber.py +0 -0
  38. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/absorbers/beam_stopper.py +0 -0
  39. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/absorbers/filter.py +0 -0
  40. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/absorbers/holed_filter.py +0 -0
  41. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/absorbers/slit.py +0 -0
  42. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/crystals/__init__.py +0 -0
  43. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/crystals/crystal.py +0 -0
  44. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/gratings/__init__.py +0 -0
  45. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/gratings/grating.py +0 -0
  46. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/ideal_elements/__init__.py +0 -0
  47. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/ideal_elements/ideal_element.py +0 -0
  48. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/ideal_elements/ideal_lens.py +0 -0
  49. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/ideal_elements/screen.py +0 -0
  50. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/mirrors/__init__.py +0 -0
  51. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/mirrors/mirror.py +0 -0
  52. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/refractors/__init__.py +0 -0
  53. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/refractors/crl.py +0 -0
  54. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/refractors/interface.py +0 -0
  55. {syned-1.0.34 → syned-1.0.35}/syned/beamline/optical_elements/refractors/lens.py +0 -0
  56. {syned-1.0.34 → syned-1.0.35}/syned/beamline/shape.py +0 -0
  57. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/__init__.py +0 -0
  58. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/electron_beam.py +0 -0
  59. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/empty_light_source.py +0 -0
  60. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/light_source.py +0 -0
  61. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/magnetic_structure.py +0 -0
  62. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/magnetic_structures/__init__.py +0 -0
  63. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/magnetic_structures/bending_magnet.py +0 -0
  64. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/magnetic_structures/insertion_device.py +0 -0
  65. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/magnetic_structures/undulator.py +0 -0
  66. {syned-1.0.34 → syned-1.0.35}/syned/storage_ring/magnetic_structures/wiggler.py +0 -0
  67. {syned-1.0.34 → syned-1.0.35}/syned/syned_object.py +0 -0
  68. {syned-1.0.34 → syned-1.0.35}/syned/util/__init__.py +0 -0
  69. {syned-1.0.34 → syned-1.0.35}/syned/util/json_tools.py +0 -0
  70. {syned-1.0.34 → syned-1.0.35}/syned/widget/__init__.py +0 -0
  71. {syned-1.0.34 → syned-1.0.35}/syned/widget/widget_decorator.py +0 -0
  72. {syned-1.0.34 → syned-1.0.35}/syned.egg-info/dependency_links.txt +0 -0
  73. {syned-1.0.34 → syned-1.0.35}/syned.egg-info/not-zip-safe +0 -0
  74. {syned-1.0.34 → syned-1.0.35}/syned.egg-info/requires.txt +0 -0
  75. {syned-1.0.34 → syned-1.0.35}/syned.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: syned
3
- Version: 1.0.34
3
+ Version: 1.0.35
4
4
  Summary: SYNED (SYNchrotron Elements Dictionary) kernel library
5
5
  Home-page: https://github.com/oasys-kit/syned
6
6
  Download-URL: https://github.com/oasys-kit/syned
@@ -11,7 +11,7 @@ except AttributeError:
11
11
 
12
12
  NAME = 'syned'
13
13
 
14
- VERSION = '1.0.34'
14
+ VERSION = '1.0.35'
15
15
  ISRELEASED = True
16
16
 
17
17
  DESCRIPTION = 'SYNED (SYNchrotron Elements Dictionary) kernel library'
@@ -1,8 +1,8 @@
1
1
 
2
2
  # THIS FILE IS GENERATED FROM syned SETUP.PY
3
- short_version = '1.0.34'
4
- version = '1.0.34'
5
- full_version = '1.0.34'
3
+ short_version = '1.0.35'
4
+ version = '1.0.35'
5
+ full_version = '1.0.35'
6
6
  git_revision = ''
7
7
  release = True
8
8
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: syned
3
- Version: 1.0.34
3
+ Version: 1.0.35
4
4
  Summary: SYNED (SYNchrotron Elements Dictionary) kernel library
5
5
  Home-page: https://github.com/oasys-kit/syned
6
6
  Download-URL: https://github.com/oasys-kit/syned
@@ -53,20 +53,6 @@ syned/storage_ring/magnetic_structures/bending_magnet.py
53
53
  syned/storage_ring/magnetic_structures/insertion_device.py
54
54
  syned/storage_ring/magnetic_structures/undulator.py
55
55
  syned/storage_ring/magnetic_structures/wiggler.py
56
- syned/tools/__init__.py
57
- syned/tools/benders/__init__.py
58
- syned/tools/benders/bender_io.py
59
- syned/tools/benders/bender_manager.py
60
- syned/tools/benders/fixed_rods_bender_manager.py
61
- syned/tools/benders/flexural_hinge_bender_manager.py
62
- syned/tools/diaboloid/__init__.py
63
- syned/tools/diaboloid/diaboloid_calculator.py
64
- syned/tools/diaboloid/fqs.py
65
- syned/tools/error_profile/__init__.py
66
- syned/tools/error_profile/error_profile_calculator.py
67
- syned/tools/hybrid_beam/__init__.py
68
- syned/tools/hybrid_undulator/__init__.py
69
- syned/tools/thermal_load/__init__.py
70
56
  syned/util/__init__.py
71
57
  syned/util/json_tools.py
72
58
  syned/widget/__init__.py
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # ----------------------------------------------------------------------- #
4
- # Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
5
- # #
6
- # Copyright 2023. 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
- # ----------------------------------------------------------------------- #
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # ----------------------------------------------------------------------- #
4
- # Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
5
- # #
6
- # Copyright 2023. 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
- # ----------------------------------------------------------------------- #
@@ -1,123 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # ----------------------------------------------------------------------- #
4
- # Copyright (c) 2021, UChicago Argonne, LLC. All rights reserved. #
5
- # #
6
- # Copyright 2021. 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
- # ----------------------------------------------------------------------- #
47
-
48
- class BenderStructuralParameters:
49
- def __init__(self,
50
- dim_x_minus=None,
51
- dim_x_plus=None,
52
- bender_bin_x=None,
53
- dim_y_minus=None,
54
- dim_y_plus=None,
55
- bender_bin_y=None,
56
- p=None,
57
- q=None,
58
- grazing_angle=None,
59
- E=None,
60
- h=None,
61
- figure_error_mesh=None,
62
- workspace_units_to_m=None,
63
- workspace_units_to_mm=None):
64
- self.dim_x_minus = dim_x_minus
65
- self.dim_x_plus = dim_x_plus
66
- self.bender_bin_x = bender_bin_x
67
- self.dim_y_minus = dim_y_minus
68
- self.dim_y_plus = dim_y_plus
69
- self.bender_bin_y = bender_bin_y
70
- self.p = p
71
- self.q = q
72
- self.grazing_angle = grazing_angle
73
- self.E = E
74
- self.h = h
75
- self.figure_error_mesh = figure_error_mesh
76
- self.workspace_units_to_m = workspace_units_to_m
77
- self.workspace_units_to_mm = workspace_units_to_mm
78
-
79
- # ----------------------------------------------------------------------
80
- # Bender FIT
81
- # ----------------------------------------------------------------------
82
-
83
- class BenderFitParameters():
84
- def __init__(self,
85
- optimized_length = None,
86
- n_fit_steps=None):
87
- self.optimized_length = optimized_length
88
- self.n_fit_steps = n_fit_steps
89
-
90
- class BenderOuputData:
91
- def __init__(self,
92
- x=None,
93
- y=None,
94
- ideal_profile=None,
95
- bender_profile=None,
96
- correction_profile=None,
97
- titles=None,
98
- z_bender_correction=None,
99
- z_figure_error=None,
100
- z_bender_correction_no_figure_error=None):
101
- self.x = x
102
- self.y = y
103
- self.ideal_profile = ideal_profile
104
- self.bender_profile = bender_profile
105
- self.correction_profile = correction_profile
106
- self.titles = titles
107
- self.z_bender_correction = z_bender_correction
108
- self.z_figure_error = z_figure_error
109
- self.z_bender_correction_no_figure_error=z_bender_correction_no_figure_error
110
-
111
- # ----------------------------------------------------------------------
112
- # Bender Movements
113
- # ----------------------------------------------------------------------
114
-
115
- class BenderMovement():
116
- def __init__(self, position_upstream=None, position_downstream=None):
117
- self.__position_upstream = position_upstream
118
- self.__position_downstream = position_downstream
119
-
120
- @property
121
- def position_upstream(self): return self.__position_upstream
122
- @property
123
- def position_downstream(self): return self.__position_downstream
@@ -1,170 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # ----------------------------------------------------------------------- #
4
- # Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
5
- # #
6
- # Copyright 2023. 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
- # ----------------------------------------------------------------------- #
47
-
48
- import numpy
49
-
50
- from syned.tools.benders.bender_io import BenderOuputData, BenderFitParameters, BenderStructuralParameters, BenderMovement
51
-
52
- class AbstractBenderManager:
53
- def __init__(self, bender_structural_parameters : BenderStructuralParameters):
54
- self._bender_structural_parameters = bender_structural_parameters
55
-
56
- @property
57
- def bender_structural_parameters(self): return self._bender_structural_parameters
58
-
59
- def fit_bender_at_focus_position(self, bender_fit_parameters: BenderFitParameters) -> BenderOuputData: raise NotImplementedError
60
- def get_bender_shape_from_movement(self, bender_movement: BenderMovement) -> BenderOuputData: raise NotImplementedError
61
-
62
- def get_q_upstream(self, bender_movement : BenderMovement): raise NotImplementedError
63
- def get_q_downstream(self, bender_movement : BenderMovement): raise NotImplementedError
64
-
65
- def calculate_ideal_surface(self, q=None, sign=-1):
66
- c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 = self.get_conic_coefficients(q)
67
-
68
- x = numpy.linspace(-self.bender_structural_parameters.dim_x_minus, self.bender_structural_parameters.dim_x_plus, self.bender_structural_parameters.bender_bin_x + 1)
69
- y = numpy.linspace(-self.bender_structural_parameters.dim_y_minus, self.bender_structural_parameters.dim_y_plus, self.bender_structural_parameters.bender_bin_y + 1)
70
-
71
- xx, yy = numpy.meshgrid(x, y)
72
-
73
- c = c1 * (xx ** 2) + c2 * (yy ** 2) + c4 * xx * yy + c7 * xx + c8 * yy + c10
74
- b = c5 * yy + c6 * xx + c9
75
- a = c3
76
-
77
- z = (-b + sign * numpy.sqrt(b ** 2 - 4 * a * c)) / (2 * a)
78
- z[b ** 2 - 4 * a * c < 0] = numpy.nan
79
-
80
- return x, y, z.T
81
-
82
- def get_conic_coefficients(self, q=None):
83
- theta_grazing = self.bender_structural_parameters.grazing_angle
84
- ssour = self.bender_structural_parameters.p
85
- simag = q if not q is None else self.bender_structural_parameters.q
86
-
87
- theta = (numpy.pi / 2) - theta_grazing
88
-
89
- ax_maj = (ssour + simag) / 2
90
- ax_min = numpy.sqrt(simag * ssour) * numpy.cos(theta)
91
- eccentricity = numpy.sqrt(ax_maj ** 2 - ax_min ** 2) / ax_maj
92
- #
93
- # The center is computed on the basis of the object and image positions
94
- #
95
- y_center = (ssour - simag) * 0.5 / eccentricity
96
- z_center = -numpy.sqrt(1 - y_center ** 2 / ax_maj ** 2) * ax_min
97
- #
98
- # Computes now the normal in the mirror center.
99
- #
100
- rn_center = numpy.zeros(3)
101
- rn_center[0] = 0.0
102
- rn_center[1] = -2 * y_center / ax_maj ** 2
103
- rn_center[2] = -2 * z_center / ax_min ** 2
104
- rn_center /= numpy.sqrt((rn_center ** 2).sum())
105
- #
106
- # Computes the tangent versor in the mirror center.
107
- #
108
- rt_center = numpy.zeros(3)
109
- rt_center[0] = 0.0
110
- rt_center[1] = rn_center[2]
111
- rt_center[2] = -rn_center[1]
112
-
113
- # Computes now the quadric coefficient with the mirror center
114
- # located at (0,0,0) and normal along (0,0,1)
115
-
116
- A = 1 / ax_min ** 2
117
- B = 1 / ax_maj ** 2
118
- C = A
119
-
120
- c1 = 0.0 # A if ellipsoid and 0 if cylinder -> managed benders are only cylinders
121
- c2 = B * rt_center[1] ** 2 + C * rt_center[2] ** 2
122
- c3 = B * rn_center[1] ** 2 + C * rn_center[2] ** 2
123
- c4 = 0.0
124
- c5 = 2 * (B * rn_center[1] * rt_center[1] + C * rn_center[2] * rt_center[2])
125
- c6 = 0.0
126
- c7 = 0.0
127
- c8 = 0.0
128
- c9 = 2 * (B * y_center * rn_center[1] + C * z_center * rn_center[2])
129
- c10 = 0.0
130
-
131
- return c1, c2, c3, c4, c5, c6, c7, c8, c9, c10
132
-
133
- class CalibrationParameters:
134
- __parameters_upstream = [0.0, 0.0]
135
- __parameters_downstream = [0.0, 0.0]
136
-
137
- def __init__(self, parameters_upstream, parameters_downstream):
138
- self.__parameters_upstream = parameters_upstream
139
- self.__parameters_downstream = parameters_downstream
140
-
141
- @property
142
- def upstream(self): return self.__parameters_upstream
143
- @property
144
- def downstream(self): return self.__parameters_downstream
145
-
146
- class StandardBenderManager(AbstractBenderManager):
147
- def __init__(self, bender_structural_parameters : BenderStructuralParameters):
148
- super(StandardBenderManager, self).__init__(bender_structural_parameters=bender_structural_parameters)
149
-
150
- def get_q_upstream(self, bender_movement : BenderMovement): return bender_movement.position_upstream # position coincides with q -> direct calculation
151
- def get_q_downstream(self, bender_movement : BenderMovement): return bender_movement.position_downstream
152
-
153
- class CalibratedBenderManager(AbstractBenderManager):
154
- def __init__(self, bender_structural_parameters : BenderStructuralParameters, calibration_parameters : CalibrationParameters):
155
- super(CalibrationParameters, self).__init__(bender_structural_parameters=bender_structural_parameters)
156
- self._calibration_parameters = calibration_parameters
157
-
158
-
159
- def get_q_upstream(self, bender_movement : BenderMovement):
160
- if bender_movement.position_upstream is None: return None
161
- return CalibratedBenderManager.__get_q_from_calibration(bender_movement.position_upstream,
162
- self._calibration_parameters.upstream)
163
-
164
- def get_q_downstream(self, bender_movement : BenderMovement):
165
- if bender_movement.position_downstream is None: return None
166
- return CalibratedBenderManager.__get_q_from_calibration(bender_movement.position_downstream,
167
- self._calibration_parameters.downstream)
168
-
169
- @classmethod # 1/q = p0*pos + p1
170
- def __get_q_from_calibration(cls, position, parameters): return 1 / (parameters[0] * position + parameters[1])