syned 1.0.39__tar.gz → 1.0.41__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.
- {syned-1.0.39 → syned-1.0.41}/PKG-INFO +4 -1
- syned-1.0.41/examples/example_get_source.py +48 -0
- {syned-1.0.39 → syned-1.0.41}/setup.py +1 -1
- syned-1.0.41/shadow4/__init__.py +0 -0
- syned-1.0.41/shadow4/examples/__init__.py +0 -0
- syned-1.0.41/shadow4/examples/optical_elements/__init__.py +0 -0
- syned-1.0.41/shadow4/examples/optical_elements/examples_crystal.py +134 -0
- syned-1.0.41/shadow4/examples/optical_elements/examples_crystal_asymmetric.py +134 -0
- syned-1.0.41/shadow4/examples/optical_elements/examples_crystal_yb66.py +124 -0
- syned-1.0.41/shadow4/examples/optical_elements/examples_ideal_lens.py +283 -0
- syned-1.0.41/shadow4/examples/optical_elements/examples_mirror.py +505 -0
- syned-1.0.41/shadow4/examples/optical_elements/examples_screen.py +184 -0
- syned-1.0.41/shadow4/examples/sources/__init__.py +0 -0
- syned-1.0.41/shadow4/examples/sources/example_bending_magnet_als_infrared.py +64 -0
- syned-1.0.41/shadow4/examples/sources/example_bending_magnet_esrf1.py +60 -0
- syned-1.0.41/shadow4/examples/sources/example_source_undulator.py +96 -0
- syned-1.0.41/shadow4/examples/sources/example_wiggler_als_infrared.py +134 -0
- syned-1.0.41/shadow4/examples/sources/examples_source_gaussian.py +86 -0
- syned-1.0.41/shadow4/examples/sources/examples_source_geometrical.py +91 -0
- syned-1.0.41/shadow4/examples/sources/examples_sources_file_io.py +128 -0
- syned-1.0.41/shadow4/setup.py +95 -0
- syned-1.0.41/shadow4/shadow4/__init__.py +2 -0
- syned-1.0.41/shadow4/shadow4/beam/__init__.py +1 -0
- syned-1.0.41/shadow4/shadow4/beam/s4_beam.py +2350 -0
- syned-1.0.41/shadow4/shadow4/beamline/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/__init__.py +1 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/absorbers/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/absorbers/s4_screen.py +200 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_additional_numerical_mesh_crystal.py +161 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_conic_crystal.py +236 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_crystal.py +867 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_ellipsoid_crystal.py +263 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_hyperboloid_crystal.py +263 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_numerical_mesh_crystal.py +292 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_paraboloid_crystal.py +266 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_plane_crystal.py +231 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_sphere_crystal.py +253 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/crystals/s4_toroid_crystal.py +257 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_additional_numerical_mesh_grating.py +160 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_conic_grating.py +162 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_ellipsoid_grating.py +175 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_grating.py +289 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_hyperboloid_grating.py +175 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_numerical_mesh_grating.py +161 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_paraboloid_grating.py +180 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_plane_grating.py +156 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_sphere_grating.py +176 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/gratings/s4_toroid_grating.py +171 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/ideal_elements/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/ideal_elements/s4_beam_movement.py +108 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/ideal_elements/s4_empty.py +78 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/ideal_elements/s4_ideal_lens.py +176 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_additional_numerical_mesh_mirror.py +183 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_conic_mirror.py +89 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_ellipsoid_mirror.py +121 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_hyperboloid_mirror.py +126 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_mirror.py +442 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_numerical_mesh_mirror.py +98 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_paraboloid_mirror.py +116 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_plane_mirror.py +90 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_sphere_mirror.py +101 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/mirrors/s4_toroid_mirror.py +108 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/refractors/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/refractors/s4_conic_interface.py +254 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/refractors/s4_crl.py +219 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/refractors/s4_interface.py +227 -0
- syned-1.0.41/shadow4/shadow4/beamline/optical_elements/refractors/s4_lens.py +315 -0
- syned-1.0.41/shadow4/shadow4/beamline/s4_beamline.py +76 -0
- syned-1.0.41/shadow4/shadow4/beamline/s4_beamline_element.py +36 -0
- syned-1.0.41/shadow4/shadow4/beamline/s4_beamline_element_movements.py +24 -0
- syned-1.0.41/shadow4/shadow4/beamline/s4_optical_element_decorators.py +725 -0
- syned-1.0.41/shadow4/shadow4/optical_surfaces/__init__.py +1 -0
- syned-1.0.41/shadow4/shadow4/optical_surfaces/s4_conic.py +1379 -0
- syned-1.0.41/shadow4/shadow4/optical_surfaces/s4_mesh.py +523 -0
- syned-1.0.41/shadow4/shadow4/optical_surfaces/s4_mesh_old.py +629 -0
- syned-1.0.41/shadow4/shadow4/optical_surfaces/s4_optical_surface.py +141 -0
- syned-1.0.41/shadow4/shadow4/optical_surfaces/s4_toroid.py +459 -0
- syned-1.0.41/shadow4/shadow4/physical_models/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/physical_models/bragg/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/physical_models/bragg/bragg.py +281 -0
- syned-1.0.41/shadow4/shadow4/physical_models/mlayer/__init__.py +1 -0
- syned-1.0.41/shadow4/shadow4/physical_models/mlayer/mlayer.py +1078 -0
- syned-1.0.41/shadow4/shadow4/physical_models/prerefl/__init__.py +1 -0
- syned-1.0.41/shadow4/shadow4/physical_models/prerefl/prerefl.py +748 -0
- syned-1.0.41/shadow4/shadow4/sources/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/sources/bending_magnet/__init__.py +1 -0
- syned-1.0.41/shadow4/shadow4/sources/bending_magnet/s4_bending_magnet.py +252 -0
- syned-1.0.41/shadow4/shadow4/sources/bending_magnet/s4_bending_magnet_light_source.py +720 -0
- syned-1.0.41/shadow4/shadow4/sources/s4_electron_beam.py +88 -0
- syned-1.0.41/shadow4/shadow4/sources/s4_light_source.py +159 -0
- syned-1.0.41/shadow4/shadow4/sources/s4_light_source_base.py +120 -0
- syned-1.0.41/shadow4/shadow4/sources/source_geometrical/__init__.py +1 -0
- syned-1.0.41/shadow4/shadow4/sources/source_geometrical/probability_distributions.py +707 -0
- syned-1.0.41/shadow4/shadow4/sources/source_geometrical/source_gaussian.py +405 -0
- syned-1.0.41/shadow4/shadow4/sources/source_geometrical/source_geometrical.py +1006 -0
- syned-1.0.41/shadow4/shadow4/sources/source_geometrical/source_grid_cartesian.py +460 -0
- syned-1.0.41/shadow4/shadow4/sources/source_geometrical/source_grid_polar.py +424 -0
- syned-1.0.41/shadow4/shadow4/sources/undulator/hankel_example_srio.py +186 -0
- syned-1.0.41/shadow4/shadow4/sources/undulator/s4_undulator.py +338 -0
- syned-1.0.41/shadow4/shadow4/sources/undulator/s4_undulator_light_source.py +1499 -0
- syned-1.0.41/shadow4/shadow4/sources/undulator/source_undulator_factory.py +297 -0
- syned-1.0.41/shadow4/shadow4/sources/undulator/source_undulator_factory_pysru.py +525 -0
- syned-1.0.41/shadow4/shadow4/sources/undulator/source_undulator_factory_srw.py +484 -0
- syned-1.0.41/shadow4/shadow4/sources/undulator/source_undulator_input_output.py +421 -0
- syned-1.0.41/shadow4/shadow4/sources/wiggler/__init__.py +1 -0
- syned-1.0.41/shadow4/shadow4/sources/wiggler/s4_wiggler.py +454 -0
- syned-1.0.41/shadow4/shadow4/sources/wiggler/s4_wiggler_light_source.py +1231 -0
- syned-1.0.41/shadow4/shadow4/tools/__init__.py +0 -0
- syned-1.0.41/shadow4/shadow4/tools/arrayofvectors.py +231 -0
- syned-1.0.41/shadow4/shadow4/tools/graphics.py +482 -0
- syned-1.0.41/shadow4/shadow4/tools/sync_f_sigma_and_pi.py +217 -0
- syned-1.0.41/syned/beamline/optical_elements/gratings/tmp1.py +104 -0
- syned-1.0.41/syned/beamline/optical_elements/ideal_elements/ideal_fzp.py +183 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/refractors/crl.py +1 -3
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/refractors/lens.py +1 -2
- syned-1.0.41/syned/beamline/optical_elements/tmp.py +23 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/shape.py +2 -2
- {syned-1.0.39 → syned-1.0.41}/syned/version.py +4 -4
- {syned-1.0.39 → syned-1.0.41}/syned.egg-info/PKG-INFO +4 -1
- syned-1.0.41/syned.egg-info/SOURCES.txt +175 -0
- syned-1.0.41/syned.egg-info/not-zip-safe +1 -0
- syned-1.0.39/syned.egg-info/SOURCES.txt +0 -59
- {syned-1.0.39 → syned-1.0.41}/LICENSE +0 -0
- {syned-1.0.39 → syned-1.0.41}/MANIFEST.in +0 -0
- {syned-1.0.39 → syned-1.0.41}/README.rst +0 -0
- {syned-1.0.39 → syned-1.0.41}/examples/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/examples/example_beamline.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/examples/example_double_slit.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/examples/example_json_input_output.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/setup.cfg +0 -0
- /syned-1.0.39/syned.egg-info/dependency_links.txt → /syned-1.0.41/shadow4/shadow4/sources/undulator/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/beamline.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/beamline_element.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/element_coordinates.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_element.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_element_with_surface_shape.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/absorbers/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/absorbers/absorber.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/absorbers/beam_stopper.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/absorbers/filter.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/absorbers/holed_filter.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/absorbers/slit.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/crystals/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/crystals/crystal.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/gratings/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/gratings/grating.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/ideal_elements/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/ideal_elements/ideal_element.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/ideal_elements/ideal_lens.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/ideal_elements/screen.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/mirrors/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/mirrors/mirror.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/refractors/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/beamline/optical_elements/refractors/interface.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/electron_beam.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/empty_light_source.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/light_source.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/magnetic_structure.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/magnetic_structures/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/magnetic_structures/bending_magnet.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/magnetic_structures/insertion_device.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/magnetic_structures/undulator.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/storage_ring/magnetic_structures/wiggler.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/syned_object.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/util/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/util/json_tools.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/widget/__init__.py +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned/widget/widget_decorator.py +0 -0
- /syned-1.0.39/syned.egg-info/not-zip-safe → /syned-1.0.41/syned.egg-info/dependency_links.txt +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned.egg-info/requires.txt +0 -0
- {syned-1.0.39 → syned-1.0.41}/syned.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: syned
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.41
|
|
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
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
+
|