OASYS2-SYNED 1.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 (76) hide show
  1. oasys2_syned-1.0.1/MANIFEST.in +6 -0
  2. oasys2_syned-1.0.1/OASYS2_SYNED.egg-info/PKG-INFO +31 -0
  3. oasys2_syned-1.0.1/OASYS2_SYNED.egg-info/SOURCES.txt +74 -0
  4. oasys2_syned-1.0.1/OASYS2_SYNED.egg-info/dependency_links.txt +1 -0
  5. oasys2_syned-1.0.1/OASYS2_SYNED.egg-info/entry_points.txt +8 -0
  6. oasys2_syned-1.0.1/OASYS2_SYNED.egg-info/not-zip-safe +1 -0
  7. oasys2_syned-1.0.1/OASYS2_SYNED.egg-info/requires.txt +2 -0
  8. oasys2_syned-1.0.1/OASYS2_SYNED.egg-info/top_level.txt +1 -0
  9. oasys2_syned-1.0.1/PKG-INFO +31 -0
  10. oasys2_syned-1.0.1/README.md +2 -0
  11. oasys2_syned-1.0.1/orangecontrib/__init__.py +0 -0
  12. oasys2_syned-1.0.1/orangecontrib/syned/__init__.py +0 -0
  13. oasys2_syned-1.0.1/orangecontrib/syned/widgets/__init__.py +0 -0
  14. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/__init__.py +20 -0
  15. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/beam_stopper.png +0 -0
  16. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/beamline_elements.png +0 -0
  17. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/crystal.png +0 -0
  18. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/filter.png +0 -0
  19. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/grating.png +0 -0
  20. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/ideal_lens.png +0 -0
  21. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/mirror.png +0 -0
  22. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/screen.png +0 -0
  23. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/icons/slit.png +0 -0
  24. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/ow_beam_stopper.py +22 -0
  25. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/ow_crystal.py +127 -0
  26. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/ow_filter.py +47 -0
  27. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/ow_grating.py +180 -0
  28. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/ow_ideal_lens.py +43 -0
  29. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/ow_mirror.py +73 -0
  30. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/ow_screen.py +25 -0
  31. oasys2_syned-1.0.1/orangecontrib/syned/widgets/beamline_elements/ow_slits.py +22 -0
  32. oasys2_syned-1.0.1/orangecontrib/syned/widgets/gui/__init__.py +0 -0
  33. oasys2_syned-1.0.1/orangecontrib/syned/widgets/gui/misc/multiple_height_profile_simualtor_S.png +0 -0
  34. oasys2_syned-1.0.1/orangecontrib/syned/widgets/gui/misc/multiple_height_profile_simualtor_T.png +0 -0
  35. oasys2_syned-1.0.1/orangecontrib/syned/widgets/gui/misc/predabam_usage.png +0 -0
  36. oasys2_syned-1.0.1/orangecontrib/syned/widgets/gui/ow_insertion_device.py +38 -0
  37. oasys2_syned-1.0.1/orangecontrib/syned/widgets/gui/ow_light_source.py +429 -0
  38. oasys2_syned-1.0.1/orangecontrib/syned/widgets/gui/ow_optical_element.py +626 -0
  39. oasys2_syned-1.0.1/orangecontrib/syned/widgets/light_sources/__init__.py +20 -0
  40. oasys2_syned-1.0.1/orangecontrib/syned/widgets/light_sources/icons/bm.png +0 -0
  41. oasys2_syned-1.0.1/orangecontrib/syned/widgets/light_sources/icons/light_sources.png +0 -0
  42. oasys2_syned-1.0.1/orangecontrib/syned/widgets/light_sources/icons/undulator.png +0 -0
  43. oasys2_syned-1.0.1/orangecontrib/syned/widgets/light_sources/icons/wiggler.png +0 -0
  44. oasys2_syned-1.0.1/orangecontrib/syned/widgets/light_sources/ow_bm_light_source.py +58 -0
  45. oasys2_syned-1.0.1/orangecontrib/syned/widgets/light_sources/ow_undulator_light_source.py +211 -0
  46. oasys2_syned-1.0.1/orangecontrib/syned/widgets/light_sources/ow_wiggler_light_source.py +38 -0
  47. oasys2_syned-1.0.1/orangecontrib/syned/widgets/loops/__init__.py +20 -0
  48. oasys2_syned-1.0.1/orangecontrib/syned/widgets/loops/icons/loops.png +0 -0
  49. oasys2_syned-1.0.1/orangecontrib/syned/widgets/loops/icons/simulator_S.png +0 -0
  50. oasys2_syned-1.0.1/orangecontrib/syned/widgets/loops/icons/simulator_T.png +0 -0
  51. oasys2_syned-1.0.1/orangecontrib/syned/widgets/loops/ow_multiple_height_profile_simulator_S.py +103 -0
  52. oasys2_syned-1.0.1/orangecontrib/syned/widgets/loops/ow_multiple_height_profile_simulator_T.py +103 -0
  53. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/__init__.py +20 -0
  54. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/dabam.png +0 -0
  55. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/devil.png +0 -0
  56. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/file_reader.png +0 -0
  57. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/file_writer.png +0 -0
  58. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/predabam.png +0 -0
  59. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/renderer.png +0 -0
  60. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/simulator.png +0 -0
  61. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/thickness_reader.png +0 -0
  62. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/icons/util.png +0 -0
  63. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/misc/dabam_height_profile_usage.png +0 -0
  64. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/misc/diaboloid_usage.png +0 -0
  65. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/misc/height_error_profile_usage.png +0 -0
  66. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/ow_beamline_renderer.py +243 -0
  67. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/ow_dabam_height_profile.py +52 -0
  68. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/ow_diaboloid.py +359 -0
  69. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/ow_file_reader.py +99 -0
  70. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/ow_file_writer.py +107 -0
  71. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/ow_height_profile_simulator.py +64 -0
  72. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/pre_dabam.py +652 -0
  73. oasys2_syned-1.0.1/orangecontrib/syned/widgets/tools/thickness_file_reader.py +297 -0
  74. oasys2_syned-1.0.1/pyproject.toml +3 -0
  75. oasys2_syned-1.0.1/setup.cfg +4 -0
  76. oasys2_syned-1.0.1/setup.py +85 -0
@@ -0,0 +1,6 @@
1
+ recursive-include orangecontrib *.pyx
2
+ recursive-include orangecontrib *.py
3
+
4
+ recursive-include orangecontrib/syned/widgets *.png *.svg *.ico *.jpg *.bmp
5
+
6
+ include README.md
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: OASYS2-SYNED
3
+ Version: 1.0.1
4
+ Summary: SYNED SYNchrotron Elements Dictionary
5
+ Home-page: https://github.com/oasys-kit/OASYS2-SYNED
6
+ Download-URL: https://github.com/oasys-kit/OASYS2-SYNED
7
+ Author: Manuel Sanchez del Rio, Luca Rebuffi
8
+ Author-email: lrebuffi@anl.gov
9
+ License: GPLv3
10
+ Keywords: simulator,oasys2
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
+ Requires-Dist: oasys2>=0.0.1
18
+ Requires-Dist: syned-gui-2>=1.0.0
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: download-url
24
+ Dynamic: home-page
25
+ Dynamic: keywords
26
+ Dynamic: license
27
+ Dynamic: requires-dist
28
+ Dynamic: summary
29
+
30
+ # OASYS-SYNED
31
+ Widgets for SYNED (SYNchrotron Elements Dictionary) library
@@ -0,0 +1,74 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ OASYS2_SYNED.egg-info/PKG-INFO
6
+ OASYS2_SYNED.egg-info/SOURCES.txt
7
+ OASYS2_SYNED.egg-info/dependency_links.txt
8
+ OASYS2_SYNED.egg-info/entry_points.txt
9
+ OASYS2_SYNED.egg-info/not-zip-safe
10
+ OASYS2_SYNED.egg-info/requires.txt
11
+ OASYS2_SYNED.egg-info/top_level.txt
12
+ orangecontrib/__init__.py
13
+ orangecontrib/syned/__init__.py
14
+ orangecontrib/syned/widgets/__init__.py
15
+ orangecontrib/syned/widgets/beamline_elements/__init__.py
16
+ orangecontrib/syned/widgets/beamline_elements/ow_beam_stopper.py
17
+ orangecontrib/syned/widgets/beamline_elements/ow_crystal.py
18
+ orangecontrib/syned/widgets/beamline_elements/ow_filter.py
19
+ orangecontrib/syned/widgets/beamline_elements/ow_grating.py
20
+ orangecontrib/syned/widgets/beamline_elements/ow_ideal_lens.py
21
+ orangecontrib/syned/widgets/beamline_elements/ow_mirror.py
22
+ orangecontrib/syned/widgets/beamline_elements/ow_screen.py
23
+ orangecontrib/syned/widgets/beamline_elements/ow_slits.py
24
+ orangecontrib/syned/widgets/beamline_elements/icons/beam_stopper.png
25
+ orangecontrib/syned/widgets/beamline_elements/icons/beamline_elements.png
26
+ orangecontrib/syned/widgets/beamline_elements/icons/crystal.png
27
+ orangecontrib/syned/widgets/beamline_elements/icons/filter.png
28
+ orangecontrib/syned/widgets/beamline_elements/icons/grating.png
29
+ orangecontrib/syned/widgets/beamline_elements/icons/ideal_lens.png
30
+ orangecontrib/syned/widgets/beamline_elements/icons/mirror.png
31
+ orangecontrib/syned/widgets/beamline_elements/icons/screen.png
32
+ orangecontrib/syned/widgets/beamline_elements/icons/slit.png
33
+ orangecontrib/syned/widgets/gui/__init__.py
34
+ orangecontrib/syned/widgets/gui/ow_insertion_device.py
35
+ orangecontrib/syned/widgets/gui/ow_light_source.py
36
+ orangecontrib/syned/widgets/gui/ow_optical_element.py
37
+ orangecontrib/syned/widgets/gui/misc/multiple_height_profile_simualtor_S.png
38
+ orangecontrib/syned/widgets/gui/misc/multiple_height_profile_simualtor_T.png
39
+ orangecontrib/syned/widgets/gui/misc/predabam_usage.png
40
+ orangecontrib/syned/widgets/light_sources/__init__.py
41
+ orangecontrib/syned/widgets/light_sources/ow_bm_light_source.py
42
+ orangecontrib/syned/widgets/light_sources/ow_undulator_light_source.py
43
+ orangecontrib/syned/widgets/light_sources/ow_wiggler_light_source.py
44
+ orangecontrib/syned/widgets/light_sources/icons/bm.png
45
+ orangecontrib/syned/widgets/light_sources/icons/light_sources.png
46
+ orangecontrib/syned/widgets/light_sources/icons/undulator.png
47
+ orangecontrib/syned/widgets/light_sources/icons/wiggler.png
48
+ orangecontrib/syned/widgets/loops/__init__.py
49
+ orangecontrib/syned/widgets/loops/ow_multiple_height_profile_simulator_S.py
50
+ orangecontrib/syned/widgets/loops/ow_multiple_height_profile_simulator_T.py
51
+ orangecontrib/syned/widgets/loops/icons/loops.png
52
+ orangecontrib/syned/widgets/loops/icons/simulator_S.png
53
+ orangecontrib/syned/widgets/loops/icons/simulator_T.png
54
+ orangecontrib/syned/widgets/tools/__init__.py
55
+ orangecontrib/syned/widgets/tools/ow_beamline_renderer.py
56
+ orangecontrib/syned/widgets/tools/ow_dabam_height_profile.py
57
+ orangecontrib/syned/widgets/tools/ow_diaboloid.py
58
+ orangecontrib/syned/widgets/tools/ow_file_reader.py
59
+ orangecontrib/syned/widgets/tools/ow_file_writer.py
60
+ orangecontrib/syned/widgets/tools/ow_height_profile_simulator.py
61
+ orangecontrib/syned/widgets/tools/pre_dabam.py
62
+ orangecontrib/syned/widgets/tools/thickness_file_reader.py
63
+ orangecontrib/syned/widgets/tools/icons/dabam.png
64
+ orangecontrib/syned/widgets/tools/icons/devil.png
65
+ orangecontrib/syned/widgets/tools/icons/file_reader.png
66
+ orangecontrib/syned/widgets/tools/icons/file_writer.png
67
+ orangecontrib/syned/widgets/tools/icons/predabam.png
68
+ orangecontrib/syned/widgets/tools/icons/renderer.png
69
+ orangecontrib/syned/widgets/tools/icons/simulator.png
70
+ orangecontrib/syned/widgets/tools/icons/thickness_reader.png
71
+ orangecontrib/syned/widgets/tools/icons/util.png
72
+ orangecontrib/syned/widgets/tools/misc/dabam_height_profile_usage.png
73
+ orangecontrib/syned/widgets/tools/misc/diaboloid_usage.png
74
+ orangecontrib/syned/widgets/tools/misc/height_error_profile_usage.png
@@ -0,0 +1,8 @@
1
+ [oasys2.addons]
2
+ syned = orangecontrib.syned
3
+
4
+ [oasys2.widgets]
5
+ Syned: Light Sources = orangecontrib.syned.widgets.light_sources
6
+ Syned: Loops = orangecontrib.syned.widgets.loops
7
+ Syned: Optical Elements = orangecontrib.syned.widgets.beamline_elements
8
+ Syned: Tools = orangecontrib.syned.widgets.tools
@@ -0,0 +1,2 @@
1
+ oasys2>=0.0.1
2
+ syned-gui-2>=1.0.0
@@ -0,0 +1 @@
1
+ orangecontrib
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: OASYS2-SYNED
3
+ Version: 1.0.1
4
+ Summary: SYNED SYNchrotron Elements Dictionary
5
+ Home-page: https://github.com/oasys-kit/OASYS2-SYNED
6
+ Download-URL: https://github.com/oasys-kit/OASYS2-SYNED
7
+ Author: Manuel Sanchez del Rio, Luca Rebuffi
8
+ Author-email: lrebuffi@anl.gov
9
+ License: GPLv3
10
+ Keywords: simulator,oasys2
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
+ Requires-Dist: oasys2>=0.0.1
18
+ Requires-Dist: syned-gui-2>=1.0.0
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: download-url
24
+ Dynamic: home-page
25
+ Dynamic: keywords
26
+ Dynamic: license
27
+ Dynamic: requires-dist
28
+ Dynamic: summary
29
+
30
+ # OASYS-SYNED
31
+ Widgets for SYNED (SYNchrotron Elements Dictionary) library
@@ -0,0 +1,2 @@
1
+ # OASYS-SYNED
2
+ Widgets for SYNED (SYNchrotron Elements Dictionary) library
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ """
2
+ =========
3
+ Associate
4
+ =========
5
+
6
+ Widgets for association rules.
7
+
8
+ """
9
+
10
+ # Category description for the widget registry
11
+
12
+ NAME = "Syned \u23F5 Optical Elements"
13
+
14
+ DESCRIPTION = "Widgets for Syned"
15
+
16
+ BACKGROUND = "#dec0a0"
17
+
18
+ ICON = "icons/beamline_elements.png"
19
+
20
+ PRIORITY = 2.1
@@ -0,0 +1,22 @@
1
+
2
+ from oasys2.canvas.util.canvas_util import add_widget_parameters_to_module
3
+
4
+ from orangecontrib.syned.widgets.gui.ow_optical_element import OWOpticalElementWithBoundaryShape
5
+
6
+ from syned.beamline.optical_elements.absorbers.beam_stopper import BeamStopper
7
+
8
+ class OWBeamStopper(OWOpticalElementWithBoundaryShape):
9
+
10
+ name = "Beam Stopper"
11
+ description = "Syned: Beam Stopper"
12
+ icon = "icons/beam_stopper.png"
13
+ priority = 1
14
+
15
+ def __init__(self):
16
+ super().__init__(allow_angle_radial=False, allow_angle_azimuthal=False)
17
+
18
+ def get_optical_element(self):
19
+ return BeamStopper(name=self.oe_name,
20
+ boundary_shape=self.get_boundary_shape())
21
+
22
+ add_widget_parameters_to_module(__name__)
@@ -0,0 +1,127 @@
1
+ import numpy
2
+
3
+ from orangewidget import gui
4
+ from orangewidget.settings import Setting
5
+
6
+ from oasys2.widget import gui as oasysgui
7
+ from oasys2.widget.util import congruence
8
+ from oasys2.canvas.util.canvas_util import add_widget_parameters_to_module
9
+ from oasys2.widget.util.widget_util import ChemicalFormulaParser
10
+
11
+ from orangecontrib.syned.widgets.gui.ow_optical_element import OWOpticalElementWithSurfaceShape
12
+
13
+ from syned.beamline.optical_elements.crystals.crystal import Crystal, DiffractionGeometry
14
+
15
+
16
+ class OWCrystal(OWOpticalElementWithSurfaceShape):
17
+
18
+ name = "Crystal"
19
+ description = "Syned: Crystal"
20
+ icon = "icons/crystal.png"
21
+ priority = 7
22
+
23
+ material = Setting("Si")
24
+ miller_index_h = Setting(1)
25
+ miller_index_k = Setting(1)
26
+ miller_index_l = Setting(1)
27
+ asymmetry_flag = Setting(0)
28
+ asymmetry_angle = Setting(0.0)
29
+ thickness_thin_or_thick = Setting(0) # 0=thin, 1=thick
30
+ thickness = Setting(0.0)
31
+ diffraction_geometry = Setting(DiffractionGeometry.BRAGG)
32
+
33
+ def __init__(self):
34
+ super().__init__()
35
+
36
+ def draw_specific_box(self):
37
+
38
+ self.tab_shape = oasysgui.createTabPage(self.tabs_setting, "Surface Shape")
39
+ self.tab_cry = oasysgui.createTabPage(self.tabs_setting, "Crystal Setting")
40
+
41
+ super().draw_specific_box(self.tab_shape)
42
+
43
+ self.crystal_box = oasysgui.widgetBox(self.tab_cry, "Crystal", addSpace=True, orientation="vertical")
44
+
45
+ oasysgui.lineEdit(self.crystal_box, self, "material", "Material [descriptor]", labelWidth=260, valueType=str, orientation="horizontal")
46
+
47
+
48
+ oasysgui.lineEdit(self.crystal_box, self, "miller_index_h", "Miller Index h", labelWidth=260, valueType=int, orientation="horizontal")
49
+ oasysgui.lineEdit(self.crystal_box, self, "miller_index_k", "Miller Index j", labelWidth=260, valueType=int, orientation="horizontal")
50
+ oasysgui.lineEdit(self.crystal_box, self, "miller_index_l", "Miller Index l", labelWidth=260, valueType=int, orientation="horizontal")
51
+
52
+
53
+ self.geometry_box = oasysgui.widgetBox(self.tab_cry, "Geometry", addSpace=True, orientation="vertical")
54
+ gui.comboBox(self.geometry_box, self, "diffraction_geometry", label="Diffraction Geometry", labelWidth=350,
55
+ items=["Bragg", "Laue"],
56
+ sendSelectedValue=False, orientation="horizontal")
57
+
58
+
59
+ # thickness
60
+ self.thickness_box = oasysgui.widgetBox(self.tab_cry, "Thickness", addSpace=True, orientation="vertical")
61
+ gui.comboBox(self.thickness_box, self, "thickness_thin_or_thick", label="Thickness model", labelWidth=350,
62
+ items=["Thin", "Thick"],
63
+ callback=self.set_visibility,
64
+ sendSelectedValue=False, orientation="horizontal")
65
+
66
+ self.thickness_subbox = oasysgui.widgetBox(self.thickness_box, "", addSpace=True, orientation="vertical")
67
+
68
+ oasysgui.lineEdit(self.thickness_subbox, self, "thickness", "Thickness [m]", labelWidth=260, valueType=float, orientation="horizontal")
69
+
70
+ # asymmetry
71
+ self.asymmetry_box = oasysgui.widgetBox(self.tab_cry, "Asymmetry", addSpace=True, orientation="vertical")
72
+ gui.comboBox(self.asymmetry_box, self, "asymmetry_flag", label="Asymetric cut", labelWidth=350,
73
+ items=["No", "Yes"],
74
+ callback=self.set_visibility,
75
+ sendSelectedValue=False, orientation="horizontal")
76
+
77
+ self.asymmetry_subbox = oasysgui.widgetBox(self.asymmetry_box, "", addSpace=True, orientation="vertical")
78
+
79
+
80
+ oasysgui.lineEdit(self.asymmetry_subbox, self, "asymmetry_angle", "Asymmetry Angle [deg]", labelWidth=260, valueType=float, orientation="horizontal")
81
+
82
+ self.set_visibility()
83
+
84
+ def set_visibility(self):
85
+ self.thickness_subbox.setVisible(self.thickness_thin_or_thick == 0)
86
+ self.asymmetry_subbox.setVisible(self.asymmetry_flag == 1)
87
+
88
+ def get_optical_element(self):
89
+
90
+ if self.thickness_thin_or_thick == 1: #
91
+ thickness = 1e5
92
+ else:
93
+ thickness = self.thickness
94
+
95
+ if self.asymmetry_angle == 0:
96
+ if self.diffraction_geometry == DiffractionGeometry.BRAGG:
97
+ asymmetry_angle = 0.0
98
+ elif self.diffraction_geometry == DiffractionGeometry.LAUE:
99
+ asymmetry_angle = 90.0
100
+ else:
101
+ asymmetry_angle = self.asymmetry_angle
102
+
103
+ return Crystal(name=self.oe_name,
104
+ boundary_shape=self.get_boundary_shape(),
105
+ surface_shape=self.get_surface_shape(),
106
+ material=self.material,
107
+ miller_index_h=self.miller_index_h,
108
+ miller_index_k=self.miller_index_k,
109
+ miller_index_l=self.miller_index_l,
110
+ diffraction_geometry=self.diffraction_geometry,
111
+ asymmetry_angle=numpy.radians(asymmetry_angle),
112
+ thickness=thickness)
113
+
114
+ def check_data(self):
115
+ super().check_data()
116
+
117
+ congruence.checkEmptyString(self.material, "Material")
118
+ ChemicalFormulaParser.parse_formula(self.material)
119
+ if self.thickness_thin_or_thick == 0:
120
+ congruence.checkStrictlyPositiveNumber(self.thickness, "Thickness")
121
+ if self.asymmetry_flag == 1:
122
+ congruence.checkNumber(self.asymmetry_angle, "Asymmetry angle")
123
+ congruence.checkNumber(self.miller_index_h, "Miller index h")
124
+ congruence.checkNumber(self.miller_index_k, "Miller index k")
125
+ congruence.checkNumber(self.miller_index_l, "Miller index l")
126
+
127
+ add_widget_parameters_to_module(__name__)
@@ -0,0 +1,47 @@
1
+ import os, sys
2
+
3
+ from orangewidget.settings import Setting
4
+ from oasys2.widget import gui as oasysgui
5
+ from oasys2.widget.util import congruence
6
+ from oasys2.widget.util.widget_util import ChemicalFormulaParser
7
+ from oasys2.canvas.util.canvas_util import add_widget_parameters_to_module
8
+
9
+ from orangecontrib.syned.widgets.gui.ow_optical_element import OWOpticalElement
10
+
11
+ from syned.beamline.optical_elements.absorbers.filter import Filter
12
+
13
+ class OWFilter(OWOpticalElement):
14
+
15
+ name = "Filter"
16
+ description = "Syned: Filter"
17
+ icon = "icons/filter.png"
18
+ priority = 3
19
+
20
+ thickness = Setting(1e-6)
21
+ material = Setting("Si")
22
+
23
+ def __init__(self):
24
+ super().__init__(allow_angle_radial=False, allow_angle_azimuthal=False)
25
+
26
+ def draw_specific_box(self):
27
+
28
+ self.filter_box = oasysgui.widgetBox(self.tab_bas, "Filter Setting", addSpace=True, orientation="vertical")
29
+
30
+ oasysgui.lineEdit(self.filter_box, self, "material", "Material [Chemical Formula]", labelWidth=200, valueType=str, orientation="horizontal")
31
+ oasysgui.lineEdit(self.filter_box, self, "thickness", "Thickness [m]", labelWidth=260, valueType=float, orientation="horizontal")
32
+
33
+
34
+ def get_optical_element(self):
35
+ return Filter(name=self.oe_name,
36
+ material=self.material,
37
+ thickness=self.thickness)
38
+
39
+ def check_data(self):
40
+ super().check_data()
41
+
42
+ congruence.checkEmptyString(self.material, "Material")
43
+ ChemicalFormulaParser.parse_formula(self.material)
44
+ congruence.checkStrictlyPositiveNumber(self.thickness, "Thickness")
45
+
46
+ add_widget_parameters_to_module(__name__)
47
+
@@ -0,0 +1,180 @@
1
+
2
+ from orangewidget.settings import Setting
3
+ from orangewidget import gui
4
+
5
+ from oasys2.widget import gui as oasysgui
6
+ from oasys2.widget.util import congruence
7
+ from oasys2.canvas.util.canvas_util import add_widget_parameters_to_module
8
+
9
+ from orangecontrib.syned.widgets.gui.ow_optical_element import OWOpticalElementWithSurfaceShape
10
+ from syned.beamline.optical_elements.gratings.grating import Grating, GratingVLS, GratingBlaze, GratingLamellar
11
+
12
+ from numpy import pi
13
+
14
+
15
+ class OWGrating(OWOpticalElementWithSurfaceShape):
16
+
17
+ name = "Grating"
18
+ description = "Syned: Grating"
19
+ icon = "icons/grating.png"
20
+ priority = 8
21
+
22
+ ruling_at_center = Setting(800e3)
23
+
24
+ coating_flag = 0
25
+ coating_material = Setting("Pt")
26
+ coating_thickness = Setting(0.0)
27
+
28
+ grating_kind = 0 # 0=Undefined, 1=Lamellar, 2=Blaze
29
+ ruling_type = 0 # 0=constant, 1=VLS
30
+ vls_coeff_1 = Setting(0.0)
31
+ vls_coeff_2 = Setting(0.0)
32
+ vls_coeff_3 = Setting(0.0)
33
+ vls_coeff_4 = Setting(0.0)
34
+
35
+ lamellar_height = 1e-6
36
+ lamellar_ratio = 0.5
37
+ angle_blaze_deg = 0.2
38
+ angle_antiblaze_deg = 90.0
39
+
40
+ def __init__(self):
41
+ super().__init__()
42
+
43
+ def draw_specific_box(self):
44
+
45
+ self.tab_shape = oasysgui.createTabPage(self.tabs_setting, "Surface Shape")
46
+ self.tab_gra = oasysgui.createTabPage(self.tabs_setting, "Grating Setting")
47
+
48
+ super().draw_specific_box(self.tab_shape)
49
+
50
+ self.ruling_box = oasysgui.widgetBox(self.tab_gra, "Ruling", addSpace=True, orientation="vertical")
51
+
52
+
53
+
54
+ gui.comboBox(self.ruling_box, self, "ruling_type", label="Ruling type", labelWidth=350,
55
+ items=["Constant", "Variable Line Spacing (VLS)"],
56
+ callback=self.set_visibility,
57
+ sendSelectedValue=False, orientation="horizontal")
58
+
59
+ oasysgui.lineEdit(self.ruling_box, self, "ruling_at_center", "Ruling at Center [lines/m]", labelWidth=180, valueType=float, orientation="horizontal")
60
+
61
+
62
+ self.ruling_subbox = oasysgui.widgetBox(self.ruling_box, "", addSpace=False, orientation="horizontal",)
63
+ ruling_subbox_left = oasysgui.widgetBox(self.ruling_subbox, "", addSpace=False, orientation="vertical",)
64
+ ruling_subbox_right = oasysgui.widgetBox(self.ruling_subbox, "", addSpace=False, orientation="vertical",)
65
+
66
+ oasysgui.lineEdit(ruling_subbox_left, self, "vls_coeff_1", "b1 lines/m^2", labelWidth=115, valueType=float, orientation="horizontal")
67
+ oasysgui.lineEdit(ruling_subbox_left, self, "vls_coeff_2", "b2 lines/m^3", labelWidth=115, valueType=float, orientation="horizontal")
68
+ oasysgui.lineEdit(ruling_subbox_right, self, "vls_coeff_3", "b3 lines/m^4", labelWidth=115, valueType=float, orientation="horizontal")
69
+ oasysgui.lineEdit(ruling_subbox_right, self, "vls_coeff_4", "b4 lines/m^5", labelWidth=115, valueType=float, orientation="horizontal")
70
+
71
+
72
+ self.coating_box = oasysgui.widgetBox(self.tab_gra, "Coating", addSpace=True, orientation="vertical")
73
+
74
+ gui.comboBox(self.coating_box, self, "coating_flag", label="Define coating", labelWidth=350,
75
+ items=["No", "Yes"],
76
+ callback=self.set_visibility,
77
+ sendSelectedValue=False, orientation="horizontal")
78
+
79
+ self.coating_subbox = oasysgui.widgetBox(self.coating_box, "", addSpace=True, orientation="vertical")
80
+ oasysgui.lineEdit(self.coating_subbox, self, "coating_material", "Material [Chemical Formula]", labelWidth=260, valueType=str, orientation="horizontal")
81
+ oasysgui.lineEdit(self.coating_subbox, self, "coating_thickness", "Thickness [m]", labelWidth=260, valueType=float, orientation="horizontal")
82
+
83
+ self.kind_box = oasysgui.widgetBox(self.tab_gra, "Kind", addSpace=True, orientation="vertical")
84
+
85
+ gui.comboBox(self.kind_box, self, "grating_kind", label="Ruling Shape", labelWidth=350,
86
+ items=["Undefined", "Lamellar", "Blaze"],
87
+ callback=self.set_visibility,
88
+ sendSelectedValue=False, orientation="horizontal")
89
+
90
+ self.kind_box_lamellar = oasysgui.widgetBox(self.kind_box, "", addSpace=True, orientation="vertical")
91
+ self.kind_box_blaze = oasysgui.widgetBox(self.kind_box, "", addSpace=True, orientation="vertical")
92
+
93
+ oasysgui.lineEdit(self.kind_box_lamellar, self, "lamellar_height", "Heigh [m]", labelWidth=180, valueType=str, orientation="horizontal")
94
+ oasysgui.lineEdit(self.kind_box_lamellar, self, "lamellar_ratio", "Valley/period ratio [m]", labelWidth=180, valueType=str, orientation="horizontal")
95
+
96
+ oasysgui.lineEdit(self.kind_box_blaze, self, "angle_blaze_deg", "Blaze angle [deg]", labelWidth=180, valueType=str, orientation="horizontal")
97
+ oasysgui.lineEdit(self.kind_box_blaze, self, "angle_antiblaze_deg", "Antiblaze angle [deg]", labelWidth=180, valueType=str, orientation="horizontal")
98
+
99
+ self.set_visibility()
100
+
101
+ def set_visibility(self):
102
+ self.kind_box_lamellar.setVisible(self.grating_kind == 1)
103
+ self.kind_box_blaze.setVisible(self.grating_kind == 2)
104
+
105
+ self.ruling_subbox.setVisible(self.ruling_type == 1)
106
+ self.coating_subbox.setVisible(self.coating_flag == 1)
107
+
108
+ def get_optical_element(self):
109
+
110
+ if self.ruling_type == 0:
111
+ b1 = 0.0
112
+ b2 = 0.0
113
+ b3 = 0.0
114
+ b4 = 0.0
115
+ else:
116
+ b1 = self.vls_coeff_1
117
+ b2 = self.vls_coeff_2
118
+ b3 = self.vls_coeff_3
119
+ b4 = self.vls_coeff_4
120
+
121
+ if self.coating_flag == 0:
122
+ coating_material = None
123
+ coating_thickness = None
124
+ else:
125
+ coating_material = self.coating_material
126
+ coating_thickness = self.coating_thickness
127
+
128
+
129
+ if self.grating_kind == 0: # undefined grating type
130
+ if self.coating_flag == 0: # for compatibility with previous versions
131
+ return Grating(name=self.oe_name,
132
+ boundary_shape=self.get_boundary_shape(),
133
+ surface_shape=self.get_surface_shape(),
134
+ ruling=self.ruling_at_center)
135
+ else:
136
+ return GratingVLS(name=self.oe_name,
137
+ boundary_shape=self.get_boundary_shape(),
138
+ surface_shape=self.get_surface_shape(),
139
+ ruling=self.ruling_at_center,
140
+ ruling_coeff_linear=b1,
141
+ ruling_coeff_quadratic=b2,
142
+ ruling_coeff_cubic=b3,
143
+ ruling_coeff_quartic=b4,
144
+ coating=coating_material,
145
+ coating_thickness=coating_thickness,
146
+ )
147
+ elif self.grating_kind == 1:
148
+ return GratingLamellar(name=self.oe_name,
149
+ boundary_shape=self.get_boundary_shape(),
150
+ surface_shape=self.get_surface_shape(),
151
+ ruling=self.ruling_at_center,
152
+ ruling_coeff_linear=b1,
153
+ ruling_coeff_quadratic=b2,
154
+ ruling_coeff_cubic=b3,
155
+ ruling_coeff_quartic=b4,
156
+ coating=coating_material,
157
+ coating_thickness=coating_thickness,
158
+ height=self.lamellar_height,
159
+ ratio_valley_to_period=self.lamellar_ratio)
160
+ elif self.grating_kind == 2:
161
+ return GratingBlaze(name=self.oe_name,
162
+ boundary_shape=self.get_boundary_shape(),
163
+ surface_shape=self.get_surface_shape(),
164
+ ruling=self.ruling_at_center,
165
+ ruling_coeff_linear=b1,
166
+ ruling_coeff_quadratic=b2,
167
+ ruling_coeff_cubic=b3,
168
+ ruling_coeff_quartic=b4,
169
+ coating=coating_material,
170
+ coating_thickness=coating_thickness,
171
+ blaze_angle=self.angle_blaze_deg*pi/180,
172
+ antiblaze_angle=self.angle_antiblaze_deg*pi/180)
173
+
174
+ def check_data(self):
175
+ super().check_data()
176
+
177
+ congruence.checkStrictlyPositiveNumber(self.ruling_at_center, "Ruling at Center")
178
+
179
+ add_widget_parameters_to_module(__name__)
180
+
@@ -0,0 +1,43 @@
1
+ from orangewidget.settings import Setting
2
+ from oasys2.widget import gui as oasysgui
3
+ from oasys2.widget.util import congruence
4
+ from oasys2.canvas.util.canvas_util import add_widget_parameters_to_module
5
+
6
+ from orangecontrib.syned.widgets.gui.ow_optical_element import OWOpticalElement
7
+
8
+ from syned.beamline.optical_elements.ideal_elements.ideal_lens import IdealLens
9
+
10
+ class OWIdealLens(OWOpticalElement):
11
+
12
+ name = "Ideal Lens"
13
+ description = "Syned: Ideal Lens"
14
+ icon = "icons/ideal_lens.png"
15
+ priority = 5
16
+
17
+ focal_x = Setting(0.0)
18
+ focal_y = Setting(0.0)
19
+
20
+ def __init__(self):
21
+ super().__init__()
22
+
23
+ def draw_specific_box(self):
24
+
25
+ self.filter_box = oasysgui.widgetBox(self.tab_bas, "Ideal Lens Setting", addSpace=True, orientation="vertical")
26
+
27
+ oasysgui.lineEdit(self.filter_box, self, "focal_x", "Horizontal Focal Length [m]", labelWidth=260, valueType=float, orientation="horizontal")
28
+ oasysgui.lineEdit(self.filter_box, self, "focal_y", "Vertical Focal Length [m]", labelWidth=260, valueType=float, orientation="horizontal")
29
+
30
+
31
+ def get_optical_element(self):
32
+ return IdealLens(name=self.oe_name,
33
+ focal_x=self.focal_x,
34
+ focal_y=self.focal_y)
35
+
36
+ def check_data(self):
37
+ super().check_data()
38
+
39
+ congruence.checkStrictlyPositiveNumber(self.focal_x, "Horizontal Focal Length")
40
+ congruence.checkStrictlyPositiveNumber(self.focal_y, "Vertical Focal Length")
41
+
42
+
43
+ add_widget_parameters_to_module(__name__)