wofryokona 0.0.1__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 (32) hide show
  1. wofryokona-0.0.1/LICENSE +28 -0
  2. wofryokona-0.0.1/MANIFEST.in +4 -0
  3. wofryokona-0.0.1/PKG-INFO +34 -0
  4. wofryokona-0.0.1/README.md +2 -0
  5. wofryokona-0.0.1/setup.cfg +4 -0
  6. wofryokona-0.0.1/setup.py +122 -0
  7. wofryokona-0.0.1/wofryokona/__init__.py +46 -0
  8. wofryokona-0.0.1/wofryokona/beamline/__init__.py +46 -0
  9. wofryokona-0.0.1/wofryokona/beamline/okona_beamline.py +138 -0
  10. wofryokona-0.0.1/wofryokona/beamline/okona_beamline_element.py +90 -0
  11. wofryokona-0.0.1/wofryokona/beamline/optical_elements/__init__.py +46 -0
  12. wofryokona-0.0.1/wofryokona/beamline/optical_elements/absorbers/__init__.py +46 -0
  13. wofryokona-0.0.1/wofryokona/beamline/optical_elements/absorbers/okona_slit.py +109 -0
  14. wofryokona-0.0.1/wofryokona/beamline/optical_elements/ideal_elements/__init__.py +46 -0
  15. wofryokona-0.0.1/wofryokona/beamline/optical_elements/ideal_elements/okona_detector.py +114 -0
  16. wofryokona-0.0.1/wofryokona/beamline/optical_elements/mirrors/__init__.py +46 -0
  17. wofryokona-0.0.1/wofryokona/beamline/optical_elements/mirrors/okona_mirror.py +306 -0
  18. wofryokona-0.0.1/wofryokona/beamline/optical_elements/okona_optical_element.py +84 -0
  19. wofryokona-0.0.1/wofryokona/propagator/__init__.py +46 -0
  20. wofryokona-0.0.1/wofryokona/propagator/okona_propagation_manager.py +94 -0
  21. wofryokona-0.0.1/wofryokona/storage_ring/__init__.py +46 -0
  22. wofryokona-0.0.1/wofryokona/storage_ring/okona_light_source.py +159 -0
  23. wofryokona-0.0.1/wofryokona/util/__init__.py +46 -0
  24. wofryokona-0.0.1/wofryokona/util/okona_object.py +49 -0
  25. wofryokona-0.0.1/wofryokona/util/plots.py +240 -0
  26. wofryokona-0.0.1/wofryokona/util/surface_errors.py +94 -0
  27. wofryokona-0.0.1/wofryokona.egg-info/PKG-INFO +34 -0
  28. wofryokona-0.0.1/wofryokona.egg-info/SOURCES.txt +30 -0
  29. wofryokona-0.0.1/wofryokona.egg-info/dependency_links.txt +1 -0
  30. wofryokona-0.0.1/wofryokona.egg-info/not-zip-safe +1 -0
  31. wofryokona-0.0.1/wofryokona.egg-info/requires.txt +3 -0
  32. wofryokona-0.0.1/wofryokona.egg-info/top_level.txt +1 -0
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Organization managing the OASYS project
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ recursive-include wofryokona *.pyx
2
+ recursive-include wofryokona *.py
3
+
4
+ include README.md
@@ -0,0 +1,34 @@
1
+ Metadata-Version: 2.4
2
+ Name: wofryokona
3
+ Version: 0.0.1
4
+ Summary: WOFRY for OKONA library
5
+ Home-page: https://github.com/oasys-kit/wofryokona
6
+ Download-URL: https://github.com/oasys-kit/wofryokona
7
+ Author: Luca Rebuffi
8
+ Author-email: lrebuffi@anl.gov
9
+ License: GPLv3
10
+ Keywords: dictionary,glossary,synchrotronsimulation
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: X11 Applications :: Qt
13
+ Classifier: Environment :: Console
14
+ Classifier: Environment :: Plugins
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Intended Audience :: Science/Research
17
+ License-File: LICENSE
18
+ Requires-Dist: setuptools
19
+ Requires-Dist: okona>=0.0.1
20
+ Requires-Dist: wofry>=1.0.33
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: download-url
26
+ Dynamic: home-page
27
+ Dynamic: keywords
28
+ Dynamic: license
29
+ Dynamic: license-file
30
+ Dynamic: requires-dist
31
+ Dynamic: summary
32
+
33
+ # wofryOKONA
34
+ wofry adapter for the library OKONA
@@ -0,0 +1,2 @@
1
+ # wofryOKONA
2
+ wofry adapter for the library OKONA
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,122 @@
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
+ # ----------------------------------------------------------------------- #
47
+
48
+ import os
49
+
50
+ try:
51
+ from setuptools import find_packages, setup
52
+ except AttributeError:
53
+ from setuptools import find_packages, setup
54
+
55
+ NAME = 'wofryokona'
56
+ VERSION = '0.0.1'
57
+ ISRELEASED = False
58
+
59
+ DESCRIPTION = 'WOFRY for OKONA library'
60
+ README_FILE = os.path.join(os.path.dirname(__file__), 'README.md')
61
+ LONG_DESCRIPTION = open(README_FILE).read()
62
+ AUTHOR = 'Luca Rebuffi'
63
+ AUTHOR_EMAIL = 'lrebuffi@anl.gov'
64
+ URL = 'https://github.com/oasys-kit/wofryokona'
65
+ DOWNLOAD_URL = 'https://github.com/oasys-kit/wofryokona'
66
+ LICENSE = 'GPLv3'
67
+
68
+ KEYWORDS = [
69
+ 'dictionary',
70
+ 'glossary',
71
+ 'synchrotron'
72
+ 'simulation',
73
+ ]
74
+
75
+ CLASSIFIERS = [
76
+ 'Development Status :: 4 - Beta',
77
+ 'Environment :: X11 Applications :: Qt',
78
+ 'Environment :: Console',
79
+ 'Environment :: Plugins',
80
+ 'Programming Language :: Python :: 3',
81
+ 'Intended Audience :: Science/Research',
82
+ ]
83
+
84
+ SETUP_REQUIRES = [
85
+ 'setuptools',
86
+ ]
87
+
88
+ INSTALL_REQUIRES = (
89
+ 'setuptools',
90
+ 'okona>=0.0.1',
91
+ 'wofry>=1.0.33'
92
+ )
93
+
94
+ PACKAGES = ["wofryokona",
95
+ "wofryokona.beamline",
96
+ "wofryokona.beamline.optical_elements",
97
+ "wofryokona.propagator",
98
+ "wofryokona.storage_ring",
99
+ "wofryokona.util"]
100
+
101
+ PACKAGE_DATA = {}
102
+
103
+ if __name__ == '__main__':
104
+ setup(
105
+ name = NAME,
106
+ version = VERSION,
107
+ description = DESCRIPTION,
108
+ long_description = LONG_DESCRIPTION,
109
+ author = AUTHOR,
110
+ author_email = AUTHOR_EMAIL,
111
+ url = URL,
112
+ download_url = DOWNLOAD_URL,
113
+ license = LICENSE,
114
+ keywords = KEYWORDS,
115
+ classifiers = CLASSIFIERS,
116
+ packages = PACKAGES,
117
+ package_data = PACKAGE_DATA,
118
+ setup_requires = SETUP_REQUIRES,
119
+ install_requires = INSTALL_REQUIRES,
120
+ include_package_data = True,
121
+ zip_safe = False,
122
+ )
@@ -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,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,138 @@
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
+ # ----------------------------------------------------------------------- #
47
+ from typing import List
48
+
49
+ from okona.beamline_manager import BeamlineProcessor
50
+
51
+ from syned.beamline.beamline import Beamline
52
+
53
+ from wofryokona.beamline.okona_beamline_element import OKONABeamlineElement
54
+ from wofryokona.storage_ring.okona_light_source import OKONALightSource, OKONASourceType
55
+ from wofryokona.util.okona_object import OKONAObject
56
+
57
+
58
+ class OKONABeamline(Beamline, OKONAObject):
59
+ def __init__(self,
60
+ light_source: OKONALightSource,
61
+ beamline_elements_list: List[OKONABeamlineElement] = None):
62
+ Beamline.__init__(self, light_source, beamline_elements_list)
63
+
64
+ def to_okona_beamline_config(self, simulation_plane: str, wavelength: float, **kwargs):
65
+ beamline_config = {'wavelength': wavelength}
66
+
67
+ elements_config = []
68
+ not_belonging_distance = 0.0
69
+ for beamline_element in self.get_beamline_elements():
70
+ be_config = beamline_element.to_okona_beamline_element_config(simulation_plane=simulation_plane, wavelength=wavelength, **kwargs)
71
+ if beamline_element.belongs(simulation_plane=simulation_plane):
72
+ be_config['distance'] += not_belonging_distance
73
+ elements_config.append(be_config)
74
+ else:
75
+ not_belonging_distance += be_config['distance']
76
+
77
+ beamline_config.update(self.get_light_source().okona_source_config)
78
+ beamline_config.update({'elements' : elements_config})
79
+
80
+ processor = BeamlineProcessor(wavelength)
81
+ beamline_config = processor.process_ashenbach_cutoff(beamline_config)
82
+ beamline_config = processor.process_sampling_points(beamline_config)
83
+
84
+ return beamline_config
85
+
86
+ def to_python_code(self):
87
+ script = "import numpy as np"
88
+ script += "\nfrom matplotlib import pyplot as plt"
89
+ script += "\nfrom wofryokona.beamline.okona_beamline import OKONABeamline"
90
+ script += "\nfrom wofryokona.beamline.okona_beamline_element import OKONABeamlineElement"
91
+ script += "\nfrom wofryokona.storage_ring.okona_light_source import OKONALightSource"
92
+ script += "\nfrom wofryokona.beamline.optical_elements.absorbers.okona_slit import OKONASlitElement"
93
+ script += "\nfrom wofryokona.beamline.optical_elements.ideal_elements.okona_detector import OKONADetectorElement"
94
+ script += "\nfrom wofryokona.beamline.optical_elements.mirrors.okona_mirror import OKONAPlaneMirrorElement, OKONAEllipticalMirrorElement"
95
+ script += "\nfrom wofryokona.propagator.okona_propagation_manager import OKONAPropagationManager, OKONAPropagationModes"
96
+ script += "\nfrom wofryokona.util.plots import *"
97
+
98
+ script += "\n\n# ---------- Light Source ------------\n"
99
+
100
+ light_source: OKONALightSource = self.get_light_source()
101
+
102
+ if light_source is None: script += "\nlight_source = None"
103
+ else: script += "\n" + light_source.to_python_code()
104
+
105
+ script += "\n\n# ---------- Beamline Elements ------------\n"
106
+
107
+ beamline_elements = self.get_beamline_elements()
108
+
109
+ if beamline_elements is None: script += "\nbeamline_elements = None"
110
+ else:
111
+ script += "\nbeamline_elements = []"
112
+ for i, beamline_element in enumerate(beamline_elements):
113
+ script += f"\n\n# ------- # B.E. {i+1}"
114
+ script += "\n" + beamline_element.to_python_code()
115
+ script += "\n\nbeamline_elements.append(beamline_element)"
116
+
117
+ script +="\n\n# ---------- Run Simulation ------------\n"
118
+
119
+ script += f"\n\nbeamline = OKONABeamline(light_source=light_source,"
120
+ script += f"\n beamline_elements_list=beamline_elements)"
121
+ script += "\n\nPROPAGATION_MODE = OKONAPropagationModes.WAVE_OPTICS"
122
+ script += "\nRUN_PARALLEL = True"
123
+ script += "\n\nresults = OKONAPropagationManager.do_propagation(beamline=beamline,"
124
+ script += "\n propagation_mode=PROPAGATION_MODE,"
125
+ script += "\n parallel=RUN_PARALLEL)"
126
+
127
+ script += "\n\n# ---------- Plot Results ------------\n"
128
+ script += "\nfigure = plt.figure(1, figsize=(8, 6))"
129
+ script += "\ndraw_source_figure(figure, results)"
130
+ script += "\n\nfigure = plt.figure(2, figsize=(8, 6))"
131
+ script += "\ndraw_detector_figure(figure, results)"
132
+ script += "\n\nfigures_oe = [plt.figure(3+i, figsize=(8, 6)) for i, oe in enumerate(get_oe_names(results))]"
133
+ script += "\ndraw_oe_intensity_figures(figures_oe, results)"
134
+ script += "\n\nfigures_errors = [plt.figure(len(figures_oe)+1+i, figsize=(8, 6)) for i, oe in enumerate(get_oe_with_surface_errors_names(results))]"
135
+ script += "\ndraw_oe_surface_errors_figures(figures_errors, results)"
136
+ script += "\n\nplt.show()"
137
+
138
+ return script
@@ -0,0 +1,90 @@
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
+ # ----------------------------------------------------------------------- #
47
+ from typing import Any
48
+
49
+ from syned.beamline.beamline_element import BeamlineElement
50
+ from syned.beamline.element_coordinates import ElementCoordinates
51
+ from wofryokona.beamline.optical_elements.okona_optical_element import OKONAOpticalElement
52
+ from wofryokona.storage_ring.okona_light_source import OKONASimulationPlane
53
+ from wofryokona.util.okona_object import OKONAObject
54
+
55
+
56
+ class OKONAPropagators:
57
+ FRESNEL = 'fresnel'
58
+ HUYGENS = 'huygens'
59
+
60
+ class OKONAHighPassWavelengthCutoff:
61
+ ASHENBACH = 'ashenbach'
62
+
63
+ class OKONABeamlineElement(BeamlineElement, OKONAObject):
64
+ def __init__(self,
65
+ optical_element: OKONAOpticalElement,
66
+ coordinates: ElementCoordinates,
67
+ distance: float = 0.0,
68
+ propagator: str = OKONAPropagators.FRESNEL,
69
+ max_points_before : float | None = None,
70
+ high_pass_wavelength_cutoff_m: Any = None,
71
+ ):
72
+ self._distance = distance
73
+ self._propagator = propagator
74
+ self._max_points_before = max_points_before
75
+ self._high_pass_wavelength_cutoff_m = high_pass_wavelength_cutoff_m
76
+
77
+ BeamlineElement.__init__(self, optical_element, coordinates)
78
+
79
+ @property
80
+ def distance(self): return self._distance
81
+
82
+ def belongs(self, simulation_plane: str = OKONASimulationPlane.VERTICAL): return True
83
+
84
+ def to_okona_beamline_element_config(self, simulation_plane: str = OKONASimulationPlane.VERTICAL, **kwargs) -> dict:
85
+ config = self.get_optical_element().to_okona_config(simulation_plane, **kwargs)
86
+
87
+ config.update({'distance' : self._distance, 'propagator': self._propagator})
88
+ if self._max_points_before is not None: config['max_points_before'] = self._max_points_before
89
+
90
+ return config
@@ -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,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
+ # ----------------------------------------------------------------------- #