syned 1.0.38__tar.gz → 1.0.40__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 (181) hide show
  1. {syned-1.0.38 → syned-1.0.40}/MANIFEST.in +1 -1
  2. {syned-1.0.38 → syned-1.0.40}/PKG-INFO +4 -1
  3. syned-1.0.40/examples/example_get_source.py +48 -0
  4. {syned-1.0.38 → syned-1.0.40}/setup.py +18 -72
  5. syned-1.0.40/shadow4/examples/optical_elements/examples_crystal.py +134 -0
  6. syned-1.0.40/shadow4/examples/optical_elements/examples_crystal_asymmetric.py +134 -0
  7. syned-1.0.40/shadow4/examples/optical_elements/examples_crystal_yb66.py +124 -0
  8. syned-1.0.40/shadow4/examples/optical_elements/examples_ideal_lens.py +283 -0
  9. syned-1.0.40/shadow4/examples/optical_elements/examples_mirror.py +505 -0
  10. syned-1.0.40/shadow4/examples/optical_elements/examples_screen.py +184 -0
  11. syned-1.0.40/shadow4/examples/sources/example_bending_magnet_als_infrared.py +64 -0
  12. syned-1.0.40/shadow4/examples/sources/example_bending_magnet_esrf1.py +60 -0
  13. syned-1.0.40/shadow4/examples/sources/example_source_undulator.py +96 -0
  14. syned-1.0.40/shadow4/examples/sources/example_wiggler_als_infrared.py +134 -0
  15. syned-1.0.40/shadow4/examples/sources/examples_source_gaussian.py +86 -0
  16. syned-1.0.40/shadow4/examples/sources/examples_source_geometrical.py +91 -0
  17. syned-1.0.40/shadow4/examples/sources/examples_sources_file_io.py +128 -0
  18. syned-1.0.40/shadow4/setup.py +95 -0
  19. syned-1.0.40/shadow4/shadow4/__init__.py +2 -0
  20. syned-1.0.40/shadow4/shadow4/beam/__init__.py +1 -0
  21. syned-1.0.40/shadow4/shadow4/beam/s4_beam.py +2350 -0
  22. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/__init__.py +1 -0
  23. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/absorbers/s4_screen.py +200 -0
  24. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_additional_numerical_mesh_crystal.py +161 -0
  25. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_conic_crystal.py +236 -0
  26. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_crystal.py +867 -0
  27. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_ellipsoid_crystal.py +263 -0
  28. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_hyperboloid_crystal.py +263 -0
  29. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_numerical_mesh_crystal.py +292 -0
  30. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_paraboloid_crystal.py +266 -0
  31. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_plane_crystal.py +231 -0
  32. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_sphere_crystal.py +253 -0
  33. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals/s4_toroid_crystal.py +257 -0
  34. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_additional_numerical_mesh_grating.py +160 -0
  35. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_conic_grating.py +162 -0
  36. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_ellipsoid_grating.py +175 -0
  37. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_grating.py +289 -0
  38. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_hyperboloid_grating.py +175 -0
  39. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_numerical_mesh_grating.py +161 -0
  40. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_paraboloid_grating.py +180 -0
  41. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_plane_grating.py +156 -0
  42. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_sphere_grating.py +176 -0
  43. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings/s4_toroid_grating.py +171 -0
  44. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/ideal_elements/s4_beam_movement.py +108 -0
  45. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/ideal_elements/s4_empty.py +78 -0
  46. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/ideal_elements/s4_ideal_lens.py +176 -0
  47. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/__init__.py +0 -0
  48. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_additional_numerical_mesh_mirror.py +183 -0
  49. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_conic_mirror.py +89 -0
  50. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_ellipsoid_mirror.py +121 -0
  51. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_hyperboloid_mirror.py +126 -0
  52. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_mirror.py +442 -0
  53. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_numerical_mesh_mirror.py +98 -0
  54. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_paraboloid_mirror.py +116 -0
  55. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_plane_mirror.py +90 -0
  56. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_sphere_mirror.py +101 -0
  57. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/mirrors/s4_toroid_mirror.py +108 -0
  58. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/refractors/__init__.py +0 -0
  59. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/refractors/s4_conic_interface.py +254 -0
  60. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/refractors/s4_crl.py +219 -0
  61. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/refractors/s4_interface.py +227 -0
  62. syned-1.0.40/shadow4/shadow4/beamline/optical_elements/refractors/s4_lens.py +315 -0
  63. syned-1.0.40/shadow4/shadow4/beamline/s4_beamline.py +76 -0
  64. syned-1.0.40/shadow4/shadow4/beamline/s4_beamline_element.py +36 -0
  65. syned-1.0.40/shadow4/shadow4/beamline/s4_beamline_element_movements.py +24 -0
  66. syned-1.0.40/shadow4/shadow4/beamline/s4_optical_element_decorators.py +725 -0
  67. syned-1.0.40/shadow4/shadow4/optical_surfaces/__init__.py +1 -0
  68. syned-1.0.40/shadow4/shadow4/optical_surfaces/s4_conic.py +1379 -0
  69. syned-1.0.40/shadow4/shadow4/optical_surfaces/s4_mesh.py +523 -0
  70. syned-1.0.40/shadow4/shadow4/optical_surfaces/s4_mesh_old.py +629 -0
  71. syned-1.0.40/shadow4/shadow4/optical_surfaces/s4_optical_surface.py +141 -0
  72. syned-1.0.40/shadow4/shadow4/optical_surfaces/s4_toroid.py +459 -0
  73. syned-1.0.40/shadow4/shadow4/physical_models/__init__.py +0 -0
  74. syned-1.0.40/shadow4/shadow4/physical_models/bragg/__init__.py +0 -0
  75. syned-1.0.40/shadow4/shadow4/physical_models/bragg/bragg.py +281 -0
  76. syned-1.0.40/shadow4/shadow4/physical_models/mlayer/__init__.py +1 -0
  77. syned-1.0.40/shadow4/shadow4/physical_models/mlayer/mlayer.py +1078 -0
  78. syned-1.0.40/shadow4/shadow4/physical_models/prerefl/__init__.py +1 -0
  79. syned-1.0.40/shadow4/shadow4/physical_models/prerefl/prerefl.py +748 -0
  80. syned-1.0.40/shadow4/shadow4/sources/__init__.py +0 -0
  81. syned-1.0.40/shadow4/shadow4/sources/bending_magnet/__init__.py +1 -0
  82. syned-1.0.40/shadow4/shadow4/sources/bending_magnet/s4_bending_magnet.py +252 -0
  83. syned-1.0.40/shadow4/shadow4/sources/bending_magnet/s4_bending_magnet_light_source.py +720 -0
  84. syned-1.0.40/shadow4/shadow4/sources/s4_electron_beam.py +88 -0
  85. syned-1.0.40/shadow4/shadow4/sources/s4_light_source.py +159 -0
  86. syned-1.0.40/shadow4/shadow4/sources/s4_light_source_base.py +120 -0
  87. syned-1.0.40/shadow4/shadow4/sources/source_geometrical/__init__.py +1 -0
  88. syned-1.0.40/shadow4/shadow4/sources/source_geometrical/probability_distributions.py +707 -0
  89. syned-1.0.40/shadow4/shadow4/sources/source_geometrical/source_gaussian.py +405 -0
  90. syned-1.0.40/shadow4/shadow4/sources/source_geometrical/source_geometrical.py +1006 -0
  91. syned-1.0.40/shadow4/shadow4/sources/source_geometrical/source_grid_cartesian.py +460 -0
  92. syned-1.0.40/shadow4/shadow4/sources/source_geometrical/source_grid_polar.py +424 -0
  93. syned-1.0.40/shadow4/shadow4/sources/undulator/hankel_example_srio.py +186 -0
  94. syned-1.0.40/shadow4/shadow4/sources/undulator/s4_undulator.py +338 -0
  95. syned-1.0.40/shadow4/shadow4/sources/undulator/s4_undulator_light_source.py +1499 -0
  96. syned-1.0.40/shadow4/shadow4/sources/undulator/source_undulator_factory.py +297 -0
  97. syned-1.0.40/shadow4/shadow4/sources/undulator/source_undulator_factory_pysru.py +525 -0
  98. syned-1.0.40/shadow4/shadow4/sources/undulator/source_undulator_factory_srw.py +484 -0
  99. syned-1.0.40/shadow4/shadow4/sources/undulator/source_undulator_input_output.py +421 -0
  100. syned-1.0.40/shadow4/shadow4/sources/wiggler/__init__.py +1 -0
  101. syned-1.0.40/shadow4/shadow4/sources/wiggler/s4_wiggler.py +454 -0
  102. syned-1.0.40/shadow4/shadow4/sources/wiggler/s4_wiggler_light_source.py +1231 -0
  103. syned-1.0.40/shadow4/shadow4/tools/__init__.py +0 -0
  104. syned-1.0.40/shadow4/shadow4/tools/arrayofvectors.py +231 -0
  105. syned-1.0.40/shadow4/shadow4/tools/graphics.py +482 -0
  106. syned-1.0.40/shadow4/shadow4/tools/sync_f_sigma_and_pi.py +217 -0
  107. syned-1.0.40/syned/__init__.py +1 -0
  108. syned-1.0.40/syned/beamline/__init__.py +2 -0
  109. syned-1.0.40/syned/beamline/optical_elements/__init__.py +2 -0
  110. syned-1.0.40/syned/beamline/optical_elements/absorbers/__init__.py +1 -0
  111. syned-1.0.40/syned/beamline/optical_elements/crystals/__init__.py +1 -0
  112. syned-1.0.40/syned/beamline/optical_elements/gratings/__init__.py +1 -0
  113. syned-1.0.40/syned/beamline/optical_elements/gratings/tmp1.py +104 -0
  114. syned-1.0.40/syned/beamline/optical_elements/ideal_elements/__init__.py +1 -0
  115. syned-1.0.40/syned/beamline/optical_elements/mirrors/__init__.py +1 -0
  116. syned-1.0.40/syned/beamline/optical_elements/refractors/__init__.py +1 -0
  117. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/refractors/crl.py +1 -3
  118. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/refractors/lens.py +1 -2
  119. syned-1.0.40/syned/beamline/optical_elements/tmp.py +23 -0
  120. {syned-1.0.38 → syned-1.0.40}/syned/beamline/shape.py +2 -2
  121. syned-1.0.40/syned/storage_ring/__init__.py +2 -0
  122. syned-1.0.40/syned/storage_ring/magnetic_structures/__init__.py +2 -0
  123. syned-1.0.40/syned/util/__init__.py +1 -0
  124. {syned-1.0.38 → syned-1.0.40}/syned/version.py +4 -4
  125. syned-1.0.40/syned/widget/__init__.py +1 -0
  126. {syned-1.0.38 → syned-1.0.40}/syned.egg-info/PKG-INFO +4 -1
  127. syned-1.0.40/syned.egg-info/SOURCES.txt +174 -0
  128. syned-1.0.40/syned.egg-info/top_level.txt +1 -0
  129. syned-1.0.38/syned/beamline/optical_elements/__init__.py +0 -1
  130. syned-1.0.38/syned/storage_ring/__init__.py +0 -1
  131. syned-1.0.38/syned/storage_ring/magnetic_structures/__init__.py +0 -1
  132. syned-1.0.38/syned.egg-info/SOURCES.txt +0 -59
  133. syned-1.0.38/syned.egg-info/top_level.txt +0 -2
  134. {syned-1.0.38 → syned-1.0.40}/LICENSE +0 -0
  135. {syned-1.0.38 → syned-1.0.40}/README.rst +0 -0
  136. {syned-1.0.38 → syned-1.0.40}/examples/__init__.py +0 -0
  137. {syned-1.0.38 → syned-1.0.40}/examples/example_beamline.py +0 -0
  138. {syned-1.0.38 → syned-1.0.40}/examples/example_double_slit.py +0 -0
  139. {syned-1.0.38 → syned-1.0.40}/examples/example_json_input_output.py +0 -0
  140. {syned-1.0.38 → syned-1.0.40}/setup.cfg +0 -0
  141. {syned-1.0.38/syned → syned-1.0.40/shadow4}/__init__.py +0 -0
  142. {syned-1.0.38/syned/beamline/optical_elements/absorbers → syned-1.0.40/shadow4/examples}/__init__.py +0 -0
  143. {syned-1.0.38/syned/beamline/optical_elements/crystals → syned-1.0.40/shadow4/examples/optical_elements}/__init__.py +0 -0
  144. {syned-1.0.38/syned/beamline/optical_elements/gratings → syned-1.0.40/shadow4/examples/sources}/__init__.py +0 -0
  145. {syned-1.0.38/syned/beamline/optical_elements/ideal_elements → syned-1.0.40/shadow4/shadow4/beamline}/__init__.py +0 -0
  146. {syned-1.0.38/syned/beamline/optical_elements/mirrors → syned-1.0.40/shadow4/shadow4/beamline/optical_elements/absorbers}/__init__.py +0 -0
  147. {syned-1.0.38/syned/beamline/optical_elements/refractors → syned-1.0.40/shadow4/shadow4/beamline/optical_elements/crystals}/__init__.py +0 -0
  148. {syned-1.0.38/syned/util → syned-1.0.40/shadow4/shadow4/beamline/optical_elements/gratings}/__init__.py +0 -0
  149. {syned-1.0.38/syned/widget → syned-1.0.40/shadow4/shadow4/beamline/optical_elements/ideal_elements}/__init__.py +0 -0
  150. {syned-1.0.38/syned/beamline → syned-1.0.40/shadow4/shadow4/sources/undulator}/__init__.py +0 -0
  151. {syned-1.0.38 → syned-1.0.40}/syned/beamline/beamline.py +0 -0
  152. {syned-1.0.38 → syned-1.0.40}/syned/beamline/beamline_element.py +0 -0
  153. {syned-1.0.38 → syned-1.0.40}/syned/beamline/element_coordinates.py +0 -0
  154. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_element.py +0 -0
  155. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_element_with_surface_shape.py +0 -0
  156. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/absorbers/absorber.py +0 -0
  157. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/absorbers/beam_stopper.py +0 -0
  158. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/absorbers/filter.py +0 -0
  159. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/absorbers/holed_filter.py +0 -0
  160. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/absorbers/slit.py +0 -0
  161. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/crystals/crystal.py +0 -0
  162. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/gratings/grating.py +0 -0
  163. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/ideal_elements/ideal_element.py +0 -0
  164. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/ideal_elements/ideal_lens.py +0 -0
  165. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/ideal_elements/screen.py +0 -0
  166. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/mirrors/mirror.py +0 -0
  167. {syned-1.0.38 → syned-1.0.40}/syned/beamline/optical_elements/refractors/interface.py +0 -0
  168. {syned-1.0.38 → syned-1.0.40}/syned/storage_ring/electron_beam.py +0 -0
  169. {syned-1.0.38 → syned-1.0.40}/syned/storage_ring/empty_light_source.py +0 -0
  170. {syned-1.0.38 → syned-1.0.40}/syned/storage_ring/light_source.py +0 -0
  171. {syned-1.0.38 → syned-1.0.40}/syned/storage_ring/magnetic_structure.py +0 -0
  172. {syned-1.0.38 → syned-1.0.40}/syned/storage_ring/magnetic_structures/bending_magnet.py +0 -0
  173. {syned-1.0.38 → syned-1.0.40}/syned/storage_ring/magnetic_structures/insertion_device.py +0 -0
  174. {syned-1.0.38 → syned-1.0.40}/syned/storage_ring/magnetic_structures/undulator.py +0 -0
  175. {syned-1.0.38 → syned-1.0.40}/syned/storage_ring/magnetic_structures/wiggler.py +0 -0
  176. {syned-1.0.38 → syned-1.0.40}/syned/syned_object.py +0 -0
  177. {syned-1.0.38 → syned-1.0.40}/syned/util/json_tools.py +0 -0
  178. {syned-1.0.38 → syned-1.0.40}/syned/widget/widget_decorator.py +0 -0
  179. {syned-1.0.38 → syned-1.0.40}/syned.egg-info/dependency_links.txt +0 -0
  180. {syned-1.0.38 → syned-1.0.40}/syned.egg-info/not-zip-safe +0 -0
  181. {syned-1.0.38 → syned-1.0.40}/syned.egg-info/requires.txt +0 -0
@@ -1,5 +1,5 @@
1
1
  recursive-include syned *.pyx
2
2
  recursive-include syned *.py
3
3
 
4
- include README.txt
4
+ include README.rst
5
5
  include LICENSE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: syned
3
- Version: 1.0.38
3
+ Version: 1.0.40
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
@@ -23,6 +23,9 @@ Classifier: Intended Audience :: Education
23
23
  Classifier: Intended Audience :: Science/Research
24
24
  Classifier: Intended Audience :: Developers
25
25
  License-File: LICENSE
26
+ Requires-Dist: setuptools
27
+ Requires-Dist: numpy
28
+ Requires-Dist: scipy
26
29
 
27
30
  =====
28
31
  syned
@@ -0,0 +1,48 @@
1
+
2
+
3
+ from syned.storage_ring.magnetic_structures.undulator import Undulator
4
+ from syned.storage_ring.magnetic_structures.wiggler import Wiggler
5
+ from syned.storage_ring.magnetic_structures.bending_magnet import BendingMagnet
6
+ from syned.storage_ring.light_source import LightSource
7
+ from syned.storage_ring.electron_beam import ElectronBeam
8
+
9
+ from syned.beamline.beamline import Beamline
10
+
11
+ if __name__ == "__main__":
12
+
13
+
14
+
15
+ src1 = ElectronBeam.initialize_as_pencil_beam(energy_in_GeV=6.0,current=0.2)
16
+ src2 = Undulator()
17
+ src = LightSource("test",src1,src2)
18
+ magnetic_structure = src.get_magnetic_structure()
19
+
20
+ print(magnetic_structure)
21
+ if isinstance(magnetic_structure, Undulator):
22
+ print(" I am undulator")
23
+ elif isinstance(magnetic_structure, Wiggler):
24
+ print("I am wiggler")
25
+ elif isinstance(magnetic_structure, BendingMagnet):
26
+ print("I am a Bending Magnet")
27
+ else:
28
+ print("I do not know what I am...")
29
+
30
+
31
+ #
32
+ #
33
+ #
34
+
35
+ a = Beamline()
36
+ magnetic_structure = a.get_light_source().get_magnetic_structure()
37
+
38
+ print(magnetic_structure)
39
+ if isinstance(magnetic_structure, Undulator):
40
+ print(" I am undulator")
41
+ elif isinstance(magnetic_structure, Wiggler):
42
+ print("I am wiggler")
43
+ elif isinstance(magnetic_structure, BendingMagnet):
44
+ print("I am a Bending Magnet")
45
+ else:
46
+ print("I do not know what I am...")
47
+
48
+
@@ -1,8 +1,6 @@
1
1
  #! /usr/bin/env python3
2
2
 
3
- from importlib.machinery import SourceFileLoader
4
3
  import os
5
- import subprocess
6
4
 
7
5
  try:
8
6
  from setuptools import find_packages, setup
@@ -11,7 +9,7 @@ except AttributeError:
11
9
 
12
10
  NAME = 'syned'
13
11
 
14
- VERSION = '1.0.38'
12
+ VERSION = '1.0.40'
15
13
  ISRELEASED = True
16
14
 
17
15
  DESCRIPTION = 'SYNED (SYNchrotron Elements Dictionary) kernel library'
@@ -58,81 +56,29 @@ SETUP_REQUIRES = (
58
56
  'setuptools',
59
57
  )
60
58
 
61
-
62
- # Return the git revision as a string
63
- def git_version():
64
- """Return the git revision as a string.
65
-
66
- Copied from numpy setup.py
67
- """
68
- def _minimal_ext_cmd(cmd):
69
- # construct minimal environment
70
- env = {}
71
- for k in ['SYSTEMROOT', 'PATH']:
72
- v = os.environ.get(k)
73
- if v is not None:
74
- env[k] = v
75
- # LANGUAGE is used on win32
76
- env['LANGUAGE'] = 'C'
77
- env['LANG'] = 'C'
78
- env['LC_ALL'] = 'C'
79
- out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
80
- return out
81
-
82
- try:
83
- out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
84
- GIT_REVISION = out.strip().decode('ascii')
85
- except OSError:
86
- GIT_REVISION = "Unknown"
87
-
88
- return GIT_REVISION
89
-
90
-
91
- def write_version_py(filename='syned/version.py'):
92
- # Copied from numpy setup.py
93
- cnt = """
94
- # THIS FILE IS GENERATED FROM syned SETUP.PY
95
- short_version = '%(version)s'
96
- version = '%(version)s'
97
- full_version = '%(full_version)s'
98
- git_revision = '%(git_revision)s'
99
- release = %(isrelease)s
100
-
101
- if not release:
102
- version = full_version
103
- short_version += ".dev"
104
- """
105
- FULLVERSION = VERSION
106
- if os.path.exists('.git'):
107
- GIT_REVISION = git_version()
108
- elif os.path.exists('syned/version.py'):
109
- # must be a source distribution, use existing version file
110
- version = SourceFileLoader('syned.version', 'syned/version.py').load_module()
111
- GIT_REVISION = version.git_revision
112
- else:
113
- GIT_REVISION = "Unknown"
114
-
115
- if not ISRELEASED:
116
- FULLVERSION += '.dev0+' + GIT_REVISION[:7]
117
-
118
- a = open(filename, 'w')
119
- try:
120
- a.write(cnt % {'version': VERSION,
121
- 'full_version': FULLVERSION,
122
- 'git_revision': GIT_REVISION,
123
- 'isrelease': str(ISRELEASED)})
124
- finally:
125
- a.close()
126
-
127
-
128
- PACKAGES = find_packages(exclude=('*.tests', '*.tests.*', 'tests.*', 'tests'))
59
+ PACKAGES = [
60
+ "syned",
61
+ "syned.beamline",
62
+ "syned.beamline.optical_elements",
63
+ "syned.beamline.optical_elements.absorbers",
64
+ "syned.beamline.optical_elements.crystals",
65
+ "syned.beamline.optical_elements.gratings",
66
+ "syned.beamline.optical_elements.ideal_elements",
67
+ "syned.beamline.optical_elements.mirrors",
68
+ "syned.beamline.optical_elements.refractors",
69
+ "syned.beamline.optical_elements.ideal_elements",
70
+ "syned.beamline.optical_elements.ideal_elements",
71
+ "syned.storage_ring",
72
+ "syned.storage_ring.magnetic_structures",
73
+ "syned.util",
74
+ "syned.widget",
75
+ ]
129
76
 
130
77
  PACKAGE_DATA = {
131
78
  }
132
79
 
133
80
 
134
81
  def setup_package():
135
- write_version_py()
136
82
  setup(
137
83
  name=NAME,
138
84
  version=VERSION,
@@ -0,0 +1,134 @@
1
+
2
+ import numpy
3
+
4
+ from shadow4.sources.source_geometrical.source_geometrical import SourceGeometrical
5
+ from shadow4.beamline.optical_elements.crystals.s4_plane_crystal import S4PlaneCrystal, S4PlaneCrystalElement
6
+
7
+
8
+ from shadow4.tools.graphics import plotxy
9
+
10
+ from syned.beamline.element_coordinates import ElementCoordinates
11
+
12
+ from syned.beamline.optical_elements.crystals.crystal import Crystal, DiffractionGeometry
13
+
14
+
15
+ def get_sigmas_radiation(photon_energy,undulator_length):
16
+ import scipy.constants as codata
17
+ lambdan = 1e-10 * codata.h*codata.c/codata.e*1e10 / photon_energy # in m
18
+ print("wavelength in m",lambdan)
19
+ return 1e6*2.740/4/numpy.pi*numpy.sqrt(lambdan*undulator_length),1e6*0.69*numpy.sqrt(lambdan/undulator_length)
20
+
21
+
22
+ def crystal_diffraction_with_collimated_beam(do_plot=True):
23
+
24
+ #
25
+ # collimated source
26
+ #
27
+
28
+ if True:
29
+ src = SourceGeometrical()
30
+ src.set_energy_distribution_singleline(value=8000, unit='eV')
31
+ src.set_spatial_type_rectangle(width=1e-3, height=1e-3)
32
+ src.set_angular_distribution_uniform(0,0,-100e-6,100e-6)
33
+ src.set_polarization(polarization_degree= 0.5, phase_diff=numpy.pi/4, coherent_beam=True)
34
+ beam = src.get_beam()
35
+
36
+ print(beam.info())
37
+ SX, SZ = (1e6*beam.get_standard_deviation(1),1e6*beam.get_standard_deviation(3))
38
+
39
+
40
+ #
41
+ # crystal definition
42
+ #
43
+
44
+
45
+ if False:
46
+ crystal1 = S4PlaneCrystalElement(
47
+ optical_element=S4PlaneCrystal(
48
+ name="Plane crystal",
49
+ boundary_shape=None,
50
+ material="Si",
51
+ diffraction_geometry=DiffractionGeometry.BRAGG, # ?? not supposed to be in syned...
52
+ miller_index_h=1,
53
+ miller_index_k=1,
54
+ miller_index_l=1,
55
+ asymmetry_angle=0.0,
56
+ thickness=0.010, # this is thick crystal approximation
57
+ f_central=True,
58
+ f_phot_cent=0,
59
+ phot_cent=8000.0,
60
+ file_refl="",
61
+ f_bragg_a=False,
62
+ # a_bragg=0.0,
63
+ f_johansson=False,
64
+ r_johansson=1.0,
65
+ f_mosaic=False,
66
+ spread_mos=0.4 * numpy.pi / 180,
67
+ f_ext=0, ),
68
+ coordinates=ElementCoordinates(p=0.0, q=5000.0e-3,
69
+ angle_radial=0.0, angle_azimuthal=0.0, angle_radial_out=0.0),
70
+ input_beam=beam)
71
+ else:
72
+ crystal1 = S4PlaneCrystalElement()
73
+ optical_element = S4PlaneCrystal(
74
+ name="Plane crystal",
75
+ boundary_shape=None,
76
+ material="Si",
77
+ diffraction_geometry=DiffractionGeometry.BRAGG, # ?? not supposed to be in syned...
78
+ miller_index_h=1,
79
+ miller_index_k=1,
80
+ miller_index_l=1,
81
+ asymmetry_angle=0.0,
82
+ thickness=0.010, # this is thick crystal approximation
83
+ f_central=True,
84
+ f_phot_cent=0,
85
+ phot_cent=8000.0,
86
+ file_refl="",
87
+ f_bragg_a=False,
88
+ # a_bragg=0.0,
89
+ f_johansson=False,
90
+ r_johansson=1.0,
91
+ f_mosaic=False,
92
+ spread_mos=0.4 * numpy.pi / 180,
93
+ f_ext=0, )
94
+
95
+ crystal1.set_optical_element(optical_element)
96
+ crystal1.set_coordinates(
97
+ ElementCoordinates(p=0.0, q=5000.0e-3,
98
+ angle_radial=0.0, angle_azimuthal=0.0, angle_radial_out=0.0))
99
+ crystal1.set_input_beam(beam)
100
+
101
+
102
+ # print(crystal1.info())
103
+ # print(crystal1.get_optical_element().get_surface_shape().get_conic_coefficients())
104
+ #
105
+ # trace
106
+ #
107
+
108
+ beam2, mirr2 = crystal1.trace_beam()
109
+
110
+ if do_plot:
111
+ plotxy(beam2, 6, 23, nbins=100, title="INTENSITY VS Z'")
112
+
113
+ #
114
+ # #
115
+ # if do_plot:
116
+ # plotxy(beam2, 1, 3, nbins=100, title="FOCAL PLANE")
117
+ # plotxy(mirr2, 1, 3, nbins=100, title="LENS HEIGHT")
118
+ # # plotxy(mirr2, 4, 5, nbins=100, title="FOOT DIV")
119
+ #
120
+ # FX, FZ = (1e6*beam2.get_standard_deviation(1),1e6*beam2.get_standard_deviation(3))
121
+ # print("Source dimensions: %f %f um"%(SX,SZ))
122
+ # print("Focal dimensions: %f %f um"%(FX,FZ))
123
+ # print("Demagnification: %g %g"%(SX/FX,SX/FZ))
124
+
125
+
126
+
127
+
128
+ if __name__ == "__main__":
129
+ from srxraylib.plot.gol import set_qt
130
+ set_qt()
131
+
132
+ crystal_diffraction_with_collimated_beam(do_plot=True)
133
+
134
+
@@ -0,0 +1,134 @@
1
+
2
+ import numpy
3
+
4
+ from shadow4.sources.source_geometrical.source_geometrical import SourceGeometrical
5
+ from shadow4.beamline.optical_elements.crystals.s4_plane_crystal import S4PlaneCrystal, S4PlaneCrystalElement
6
+
7
+
8
+ from shadow4.tools.graphics import plotxy
9
+
10
+ from syned.beamline.element_coordinates import ElementCoordinates
11
+
12
+ from syned.beamline.optical_elements.crystals.crystal import Crystal, DiffractionGeometry
13
+
14
+
15
+ def get_sigmas_radiation(photon_energy,undulator_length):
16
+ import scipy.constants as codata
17
+ lambdan = 1e-10 * codata.h*codata.c/codata.e*1e10 / photon_energy # in m
18
+ print("wavelength in m",lambdan)
19
+ return 1e6*2.740/4/numpy.pi*numpy.sqrt(lambdan*undulator_length),1e6*0.69*numpy.sqrt(lambdan/undulator_length)
20
+
21
+
22
+ def crystal_diffraction_with_collimated_beam(do_plot=True):
23
+
24
+ #
25
+ # collimated source
26
+ #
27
+
28
+ if True:
29
+ src = SourceGeometrical(nrays=300)
30
+ src.set_energy_distribution_singleline(value=8000, unit='eV')
31
+ src.set_spatial_type_rectangle(width=1e-3, height=1e-3)
32
+ src.set_angular_distribution_uniform(0,0,-100e-6,100e-6)
33
+ src.set_polarization(polarization_degree= 0.5, phase_diff=numpy.pi/4, coherent_beam=True)
34
+ beam = src.get_beam()
35
+
36
+ print(beam.info())
37
+ SX, SZ = (1e6*beam.get_standard_deviation(1),1e6*beam.get_standard_deviation(3))
38
+
39
+
40
+ #
41
+ # crystal definition
42
+ #
43
+
44
+
45
+ if False:
46
+ crystal1 = S4PlaneCrystalElement(
47
+ optical_element=S4PlaneCrystal(
48
+ name="Plane crystal",
49
+ boundary_shape=None,
50
+ material="Si",
51
+ diffraction_geometry=DiffractionGeometry.BRAGG, # ?? not supposed to be in syned...
52
+ miller_index_h=1,
53
+ miller_index_k=1,
54
+ miller_index_l=1,
55
+ asymmetry_angle=0.0,
56
+ thickness=0.010, # this is thick crystal approximation
57
+ f_central=True,
58
+ f_phot_cent=0,
59
+ phot_cent=8000.0,
60
+ file_refl="",
61
+ f_bragg_a=False,
62
+ # a_bragg=0.0,
63
+ f_johansson=False,
64
+ r_johansson=1.0,
65
+ f_mosaic=False,
66
+ spread_mos=0.4 * numpy.pi / 180,
67
+ f_ext=0, ),
68
+ coordinates=ElementCoordinates(p=0.0, q=5000.0e-3,
69
+ angle_radial=0.0, angle_azimuthal=0.0, angle_radial_out=0.0),
70
+ input_beam=beam)
71
+ else:
72
+ crystal1 = S4PlaneCrystalElement()
73
+ optical_element = S4PlaneCrystal(
74
+ name="Plane crystal",
75
+ boundary_shape=None,
76
+ material="Si",
77
+ diffraction_geometry=DiffractionGeometry.BRAGG, # ?? not supposed to be in syned...
78
+ miller_index_h=1,
79
+ miller_index_k=1,
80
+ miller_index_l=1,
81
+ asymmetry_angle=numpy.radians(10.0),
82
+ thickness=0.010, # this is thick crystal approximation
83
+ f_central=True,
84
+ f_phot_cent=0,
85
+ phot_cent=8000.0,
86
+ file_refl="",
87
+ f_bragg_a=False,
88
+ # a_bragg=0.0,
89
+ f_johansson=False,
90
+ r_johansson=1.0,
91
+ f_mosaic=False,
92
+ spread_mos=0.4 * numpy.pi / 180,
93
+ f_ext=0, )
94
+
95
+ crystal1.set_optical_element(optical_element)
96
+ crystal1.set_coordinates(
97
+ ElementCoordinates(p=0.0, q=5000.0e-3,
98
+ angle_radial=0.0, angle_azimuthal=0.0, angle_radial_out=0.0))
99
+ crystal1.set_input_beam(beam)
100
+
101
+
102
+ # print(crystal1.info())
103
+ # print(crystal1.get_optical_element().get_surface_shape().get_conic_coefficients())
104
+ #
105
+ # trace
106
+ #
107
+
108
+ beam2, mirr2 = crystal1.trace_beam()
109
+
110
+ if do_plot:
111
+ plotxy(beam2, 6, 23, nbins=100, title="INTENSITY VS Z'")
112
+
113
+ #
114
+ # #
115
+ # if do_plot:
116
+ # plotxy(beam2, 1, 3, nbins=100, title="FOCAL PLANE")
117
+ # plotxy(mirr2, 1, 3, nbins=100, title="LENS HEIGHT")
118
+ # # plotxy(mirr2, 4, 5, nbins=100, title="FOOT DIV")
119
+ #
120
+ # FX, FZ = (1e6*beam2.get_standard_deviation(1),1e6*beam2.get_standard_deviation(3))
121
+ # print("Source dimensions: %f %f um"%(SX,SZ))
122
+ # print("Focal dimensions: %f %f um"%(FX,FZ))
123
+ # print("Demagnification: %g %g"%(SX/FX,SX/FZ))
124
+
125
+
126
+
127
+
128
+ if __name__ == "__main__":
129
+ from srxraylib.plot.gol import set_qt
130
+ set_qt()
131
+
132
+ crystal_diffraction_with_collimated_beam(do_plot=True)
133
+
134
+
@@ -0,0 +1,124 @@
1
+
2
+ import numpy
3
+
4
+ from shadow4.sources.source_geometrical.source_geometrical import SourceGeometrical
5
+ from shadow4.beamline.optical_elements.crystals.s4_plane_crystal import S4PlaneCrystal, S4PlaneCrystalElement
6
+
7
+
8
+ from shadow4.tools.graphics import plotxy
9
+
10
+ from syned.beamline.element_coordinates import ElementCoordinates
11
+
12
+ from syned.beamline.optical_elements.crystals.crystal import Crystal, DiffractionGeometry
13
+
14
+
15
+ def get_sigmas_radiation(photon_energy,undulator_length):
16
+ import scipy.constants as codata
17
+ lambdan = 1e-10 * codata.h*codata.c/codata.e*1e10 / photon_energy # in m
18
+ print("wavelength in m",lambdan)
19
+ return 1e6*2.740/4/numpy.pi*numpy.sqrt(lambdan*undulator_length),1e6*0.69*numpy.sqrt(lambdan/undulator_length)
20
+
21
+
22
+ def crystal_diffraction_with_collimated_beam(do_plot=True):
23
+
24
+ #
25
+ # collimated source
26
+ #
27
+
28
+ if True:
29
+ src = SourceGeometrical()
30
+ src.set_energy_distribution_singleline(value=8000, unit='eV')
31
+ src.set_spatial_type_rectangle(width=1e-3, height=1e-3)
32
+ src.set_angular_distribution_uniform(0,0,-100e-6,100e-6)
33
+ src.set_polarization(polarization_degree=0.5, phase_diff=numpy.pi/4, coherent_beam=True)
34
+
35
+ beam = src.get_beam()
36
+
37
+ print(beam.info())
38
+ SX, SZ = (1e6*beam.get_standard_deviation(1),1e6*beam.get_standard_deviation(3))
39
+
40
+
41
+ #
42
+ # crystal definition
43
+ #
44
+
45
+ if True: # create preprocessor file
46
+ descriptor = 'YB66'
47
+ SCANFROM = 0 # in microradiants
48
+ SCANTO = 100 # in microradiants
49
+ TEMPER = 1.0
50
+ ENERGY = 8040.0
51
+ SCANPOINTS = 200
52
+
53
+ print("Using crystal descriptor: ", descriptor)
54
+ from xoppylib.crystals.tools import bragg_calc2
55
+ from dabax.dabax_xraylib import DabaxXraylib
56
+ bragg_dictionary = bragg_calc2(descriptor=descriptor,
57
+ hh=4, kk=0, ll=0,
58
+ temper=1.0,
59
+ emin=ENERGY - 100.0, emax=ENERGY + 100.0,
60
+ estep=(SCANTO - SCANFROM) / SCANPOINTS, fileout="xcrystal.bra",
61
+ material_constants_library=DabaxXraylib())
62
+
63
+ crystal1 = S4PlaneCrystalElement(
64
+ optical_element=S4PlaneCrystal(
65
+ name="Plane crystal",
66
+ boundary_shape=None,
67
+ material="YB66",
68
+ diffraction_geometry=DiffractionGeometry.BRAGG, # ?? not supposed to be in syned...
69
+ miller_index_h=4,
70
+ miller_index_k=4,
71
+ miller_index_l=0,
72
+ asymmetry_angle=0.0,
73
+ thickness=0.010, ###########################
74
+ f_central=True,
75
+ f_phot_cent=0,
76
+ phot_cent=8000.0,
77
+ file_refl="xcrystal.bra",
78
+ f_bragg_a=False,
79
+ # a_bragg=0.0,
80
+ f_johansson=False,
81
+ r_johansson=1.0,
82
+ f_mosaic=False,
83
+ spread_mos=0.4 * numpy.pi / 180,
84
+ f_ext=0,
85
+ material_constants_library_flag=3, # 0=xraylib, 1=dabax
86
+ # 2=shadow preprocessor file v1
87
+ # 3=shadow preprocessor file v2
88
+ ),
89
+ coordinates=ElementCoordinates(p=0.0, q=5000.0e-3,
90
+ angle_radial=0.0, angle_azimuthal=0.0, angle_radial_out=0.0),
91
+ input_beam=beam)
92
+
93
+ # print(crystal1.info())
94
+ # print(crystal1.get_optical_element().get_surface_shape().get_conic_coefficients())
95
+ #
96
+ # trace
97
+ #
98
+
99
+ beam2, mirr2 = crystal1.trace_beam()
100
+
101
+ if do_plot:
102
+ plotxy(beam2, 6, 23, nbins=100, title="INTENSITY VS Z'")
103
+ #
104
+ # #
105
+ # if do_plot:
106
+ # plotxy(beam2, 1, 3, nbins=100, title="FOCAL PLANE")
107
+ # plotxy(mirr2, 1, 3, nbins=100, title="LENS HEIGHT")
108
+ # # plotxy(mirr2, 4, 5, nbins=100, title="FOOT DIV")
109
+ #
110
+ # FX, FZ = (1e6*beam2.get_standard_deviation(1),1e6*beam2.get_standard_deviation(3))
111
+ # print("Source dimensions: %f %f um"%(SX,SZ))
112
+ # print("Focal dimensions: %f %f um"%(FX,FZ))
113
+ # print("Demagnification: %g %g"%(SX/FX,SX/FZ))
114
+
115
+
116
+
117
+
118
+ if __name__ == "__main__":
119
+ from srxraylib.plot.gol import set_qt
120
+ set_qt()
121
+
122
+ crystal_diffraction_with_collimated_beam(do_plot=True)
123
+
124
+