xrt 2.0.0b0__py3-none-any.whl
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.
- xrt/__init__.py +247 -0
- xrt/backends/__init__.py +1 -0
- xrt/backends/dummy.py +24 -0
- xrt/backends/raycing/__init__.py +424 -0
- xrt/backends/raycing/_beam_props.py +167 -0
- xrt/backends/raycing/_epics.py +313 -0
- xrt/backends/raycing/_flow.py +384 -0
- xrt/backends/raycing/_flow_utils.py +557 -0
- xrt/backends/raycing/_named_arrays.py +76 -0
- xrt/backends/raycing/_rotate.py +108 -0
- xrt/backends/raycing/_sets_units.py +96 -0
- xrt/backends/raycing/apertures.py +1269 -0
- xrt/backends/raycing/beamline.py +1368 -0
- xrt/backends/raycing/coherence.py +404 -0
- xrt/backends/raycing/data/AtomicData.dat +93 -0
- xrt/backends/raycing/data/BrCo.npz +0 -0
- xrt/backends/raycing/data/Chantler.npz +0 -0
- xrt/backends/raycing/data/Henke.npz +0 -0
- xrt/backends/raycing/data/f0_xop.dat +1136 -0
- xrt/backends/raycing/figure_error.py +752 -0
- xrt/backends/raycing/modes.py +457 -0
- xrt/backends/raycing/myopencl.py +667 -0
- xrt/backends/raycing/physconsts.py +36 -0
- xrt/backends/raycing/pyTTE_x/__init__.py +9 -0
- xrt/backends/raycing/pyTTE_x/crystal_vectors.py +58 -0
- xrt/backends/raycing/pyTTE_x/deformation.py +300 -0
- xrt/backends/raycing/pyTTE_x/elastic_tensors.py +384 -0
- xrt/backends/raycing/pyTTE_x/legacy.py +326 -0
- xrt/backends/raycing/pyTTE_x/pyTTE.py +906 -0
- xrt/backends/raycing/pyTTE_x/pyTTE_rkpy.py +1038 -0
- xrt/backends/raycing/pyTTE_x/pyTTE_rkpy_qt.py +855 -0
- xrt/backends/raycing/pyTTE_x/quantity.py +344 -0
- xrt/backends/raycing/pyTTE_x/rotation_matrix.py +105 -0
- xrt/backends/raycing/pyTTE_x/ttcrystal.py +890 -0
- xrt/backends/raycing/pyTTE_x/ttscan.py +241 -0
- xrt/backends/raycing/run.py +7 -0
- xrt/backends/raycing/screens.py +564 -0
- xrt/backends/raycing/singletons.py +42 -0
- xrt/backends/raycing/stages.py +210 -0
- xrt/backends/raycing/waves.py +895 -0
- xrt/backends/shadow.py +503 -0
- xrt/gui/__init__.py +1 -0
- xrt/gui/commons/__init__.py +1 -0
- xrt/gui/commons/_images/1-LEG_profile-adhoc.png +0 -0
- xrt/gui/commons/_images/1-LEG_profile-default.png +0 -0
- xrt/gui/commons/_images/ePos=0.png +0 -0
- xrt/gui/commons/_images/ePos=1.png +0 -0
- xrt/gui/commons/_images/ePos=2.png +0 -0
- xrt/gui/commons/_images/ex03_glow.png +0 -0
- xrt/gui/commons/_images/ex03_p01.png +0 -0
- xrt/gui/commons/_images/ex03_p02.png +0 -0
- xrt/gui/commons/_images/ex03_p03a.png +0 -0
- xrt/gui/commons/_images/ex03_p03b.png +0 -0
- xrt/gui/commons/_images/ex03_p03c.png +0 -0
- xrt/gui/commons/_images/ex03_p03d.png +0 -0
- xrt/gui/commons/_images/filterFootprint2_I400mum.png +0 -0
- xrt/gui/commons/_images/filterFootprint2_I400mum_norm1.png +0 -0
- xrt/gui/commons/_images/filterFootprint2_I400mum_norm2.png +0 -0
- xrt/gui/commons/_images/invertColorMap=0_negative=0.png +0 -0
- xrt/gui/commons/_images/invertColorMap=0_negative=1.png +0 -0
- xrt/gui/commons/_images/invertColorMap=1_negative=0.png +0 -0
- xrt/gui/commons/_images/invertColorMap=1_negative=1.png +0 -0
- xrt/gui/commons/_images/negative=1+fullNegative.png +0 -0
- xrt/gui/commons/_images/offset0.png +0 -0
- xrt/gui/commons/_images/offset5000.png +0 -0
- xrt/gui/commons/_images/outline00.png +0 -0
- xrt/gui/commons/_images/outline05.png +0 -0
- xrt/gui/commons/_images/outline10.png +0 -0
- xrt/gui/commons/_images/qookSplash2.gif +0 -0
- xrt/gui/commons/_images/qookTutor01.png +0 -0
- xrt/gui/commons/_images/qookTutor02.png +0 -0
- xrt/gui/commons/_images/qookTutor03.png +0 -0
- xrt/gui/commons/_images/qookTutor04.png +0 -0
- xrt/gui/commons/_images/qookTutor05.png +0 -0
- xrt/gui/commons/_images/qookTutor06.png +0 -0
- xrt/gui/commons/_images/qookTutor07.png +0 -0
- xrt/gui/commons/_images/qookTutor08.png +0 -0
- xrt/gui/commons/_images/qookTutor09.png +0 -0
- xrt/gui/commons/_images/qookTutor10.png +0 -0
- xrt/gui/commons/_images/qookTutor11.png +0 -0
- xrt/gui/commons/_themes/qook/layout.html +18 -0
- xrt/gui/commons/_themes/qook/page.html +23 -0
- xrt/gui/commons/_themes/qook/static/default.css_t +342 -0
- xrt/gui/commons/_themes/qook/static/jquery.js +2 -0
- xrt/gui/commons/_themes/qook/static/math_config_win32.js +0 -0
- xrt/gui/commons/_themes/qook/static/utils.js +34 -0
- xrt/gui/commons/_themes/qook/theme.conf +31 -0
- xrt/gui/commons/conf.py +130 -0
- xrt/gui/commons/ext.py +125 -0
- xrt/gui/commons/gl.py +60 -0
- xrt/gui/commons/qt.py +512 -0
- xrt/gui/xrtBentXtal.py +1373 -0
- xrt/gui/xrtGlow/__init__.py +44 -0
- xrt/gui/xrtGlow/_constants.py +46 -0
- xrt/gui/xrtGlow/_icons/icon-GLow.ico +0 -0
- xrt/gui/xrtGlow/_utils.py +125 -0
- xrt/gui/xrtGlow/notes.py +115 -0
- xrt/gui/xrtQook/__init__.py +46 -0
- xrt/gui/xrtQook/_constants.py +24 -0
- xrt/gui/xrtQook/_icons/3dg_256.png +0 -0
- xrt/gui/xrtQook/_icons/GPU4.png +0 -0
- xrt/gui/xrtQook/_icons/add-aperture.png +0 -0
- xrt/gui/xrtQook/_icons/add-figure-error.png +0 -0
- xrt/gui/xrtQook/_icons/add-material.png +0 -0
- xrt/gui/xrtQook/_icons/add-oe.png +0 -0
- xrt/gui/xrtQook/_icons/add-plot.png +0 -0
- xrt/gui/xrtQook/_icons/add-screen.png +0 -0
- xrt/gui/xrtQook/_icons/add-source.png +0 -0
- xrt/gui/xrtQook/_icons/dialog-information.png +0 -0
- xrt/gui/xrtQook/_icons/dialog-question.png +0 -0
- xrt/gui/xrtQook/_icons/double-click.png +0 -0
- xrt/gui/xrtQook/_icons/eyeglasses7_128.png +0 -0
- xrt/gui/xrtQook/_icons/filenew.png +0 -0
- xrt/gui/xrtQook/_icons/fileopen.png +0 -0
- xrt/gui/xrtQook/_icons/filesave.png +0 -0
- xrt/gui/xrtQook/_icons/filesaveas.png +0 -0
- xrt/gui/xrtQook/_icons/home.png +0 -0
- xrt/gui/xrtQook/_icons/icon-busy.png +0 -0
- xrt/gui/xrtQook/_icons/icon-help.png +0 -0
- xrt/gui/xrtQook/_icons/icon-info.png +0 -0
- xrt/gui/xrtQook/_icons/index.txt +13 -0
- xrt/gui/xrtQook/_icons/light_bulb.png +0 -0
- xrt/gui/xrtQook/_icons/logo-xrtQt.png +0 -0
- xrt/gui/xrtQook/_icons/pythonscript.png +0 -0
- xrt/gui/xrtQook/_icons/pythonscriptsave.png +0 -0
- xrt/gui/xrtQook/_icons/pythonscriptsaveas.png +0 -0
- xrt/gui/xrtQook/_icons/readme.png +0 -0
- xrt/gui/xrtQook/_icons/run.png +0 -0
- xrt/gui/xrtQook/_icons/xbcc.ico +0 -0
- xrt/gui/xrtQook/_icons/xbcc.png +0 -0
- xrt/gui/xrtQook/_icons/xrQt1.ico +0 -0
- xrt/gui/xrtQook/_objects_custom.py +144 -0
- xrt/gui/xrtQook/tutorial.py +121 -0
- xrt/gui/xrtQookStart.py +64 -0
- xrt/gui/xrtQookStart.pyw +52 -0
- xrt/kde.py +298 -0
- xrt/multipro.py +383 -0
- xrt/plotter.py +2291 -0
- xrt/runner.py +654 -0
- xrt/version.py +8 -0
- xrt-2.0.0b0.data/scripts/xrtQookStart.py +64 -0
- xrt-2.0.0b0.data/scripts/xrtQookStart.pyw +52 -0
- xrt-2.0.0b0.dist-info/METADATA +210 -0
- xrt-2.0.0b0.dist-info/RECORD +147 -0
- xrt-2.0.0b0.dist-info/WHEEL +5 -0
- xrt-2.0.0b0.dist-info/licenses/LICENSE.txt +22 -0
- xrt-2.0.0b0.dist-info/top_level.txt +1 -0
xrt/__init__.py
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
u"""
|
|
3
|
+
Package xrt is a python software library for ray tracing and wave propagation
|
|
4
|
+
in x-ray regime. It is primarily meant for modeling synchrotron sources,
|
|
5
|
+
beamlines and beamline elements. Includes a GUI for creating a beamline and
|
|
6
|
+
interactively viewing it in 3D.
|
|
7
|
+
|
|
8
|
+
+----------------+---------------+-----------+
|
|
9
|
+
| |Itot| | |vcmSi-P| | |VortexB| |
|
|
10
|
+
+----------------+---------------+-----------+
|
|
11
|
+
|
|
12
|
+
.. |Itot| animationhover:: _images/Itot
|
|
13
|
+
:alt:  Intensity of undulator radiation on a transverse flat screen.
|
|
14
|
+
The long axis is energy. One can observe two harmonics crossing the
|
|
15
|
+
central line: the one at 2400 eV is odd and the one at 4800 eV is even.
|
|
16
|
+
|
|
17
|
+
.. |vcmSi-P| animationhover:: _images/vcmSi-FootprintP
|
|
18
|
+
:alt:  Absorbed power and power density on a mirror at varying pitch
|
|
19
|
+
angle.
|
|
20
|
+
:loc: upper-right-corner
|
|
21
|
+
|
|
22
|
+
.. |VortexB| animationhover:: _images/Laguerre-Gauss-ani
|
|
23
|
+
:alt:  Vortex beam with <i>l</i>=1 and <i>p</i>=1. Colored by phase.
|
|
24
|
+
:loc: upper-right-corner
|
|
25
|
+
|
|
26
|
+
.. _guis:
|
|
27
|
+
|
|
28
|
+
GUIs
|
|
29
|
+
----
|
|
30
|
+
|
|
31
|
+
.. tabs::
|
|
32
|
+
|
|
33
|
+
.. tab:: xrtQook
|
|
34
|
+
.. automodule:: xrt.gui.xrtQook
|
|
35
|
+
|
|
36
|
+
.. tab:: xrtGlow
|
|
37
|
+
.. automodule:: xrt.gui.xrtGlow
|
|
38
|
+
|
|
39
|
+
.. tab:: xrtBentXtal
|
|
40
|
+
.. automodule:: xrt.gui.xrtBentXtal
|
|
41
|
+
|
|
42
|
+
Features of xrt
|
|
43
|
+
---------------
|
|
44
|
+
|
|
45
|
+
* *Rays and waves*. Classical ray tracing and :ref:`wave propagation <waves>`
|
|
46
|
+
via Kirchhoff integrals, also freely intermixed. No further approximations,
|
|
47
|
+
such as thin lens or paraxial. The optical surfaces may have :ref:`figure
|
|
48
|
+
errors, analytical or measured<warping>`. In wave propagation, partially
|
|
49
|
+
coherent radiation is treated by incoherent addition of coherently diffracted
|
|
50
|
+
fields generated per electron. Propagation of :ref:`individual coherent
|
|
51
|
+
source modes<modes>` is possible as waves, hybrid waves (i.e. partially as
|
|
52
|
+
rays and then as waves) and only rays.
|
|
53
|
+
|
|
54
|
+
* *Publication quality graphics*. 1D and 2D position histograms are
|
|
55
|
+
*simultaneously* coded by hue and brightness. Typically, colors represent
|
|
56
|
+
energy and brightness represents beam intensity. The user may select other
|
|
57
|
+
quantities to be encoded by colors: angular and positional distributions,
|
|
58
|
+
various polarization properties, beam categories, number of reflections,
|
|
59
|
+
incidence angle etc. Brightness can also encode partial flux for a selected
|
|
60
|
+
polarization and incident or absorbed power. Publication quality plots are
|
|
61
|
+
provided by `matplotlib <http://matplotlib.org>`_ with image formats PNG,
|
|
62
|
+
PostScript, PDF and SVG.
|
|
63
|
+
|
|
64
|
+
* *Unlimited number of rays*. The colored histograms are *cumulative*. The
|
|
65
|
+
accumulation can be stopped and resumed.
|
|
66
|
+
|
|
67
|
+
* *Parallel execution*. xrt can be run :ref:`in parallel <tests>` in several
|
|
68
|
+
threads or processes (can be opted), which accelerates the execution on
|
|
69
|
+
multi-core computers. Alternatively, xrt can use the power of GPUs via OpenCL
|
|
70
|
+
for running special tasks such as the calculation of an undulator source or
|
|
71
|
+
performing wave propagation.
|
|
72
|
+
|
|
73
|
+
* *Scripting in Python*. xrt can be run within Python scripts to generate a
|
|
74
|
+
series of images under changing geometrical or physical parameters. The image
|
|
75
|
+
brightness and 1D histograms can be normalized to the global maximum
|
|
76
|
+
throughout the series.
|
|
77
|
+
|
|
78
|
+
* :ref:`Synchrotron sources <synchrotron-sources>`. Bending magnet, wiggler,
|
|
79
|
+
undulator and elliptic undulator are calculated internally within xrt.
|
|
80
|
+
Please look the section :ref:`comparison-synchrotron-sources` for the
|
|
81
|
+
comparison with other popular codes. If the photon source is one of the
|
|
82
|
+
synchrotron sources, the total flux in the beam is reported not just in
|
|
83
|
+
number of rays but in physical units of ph/s. The total power or absorbed
|
|
84
|
+
power can be opted instead of flux and is reported in W. The power density
|
|
85
|
+
can be visualized by isolines. The magnetic gap of undulators can be
|
|
86
|
+
:ref:`tapered <tapering_comparison>`. Undulators can be calculated in
|
|
87
|
+
:ref:`near field <near_field_comparison>`. :ref:`Custom magnetic field
|
|
88
|
+
<undulator_custom>` is also possible. Undulators can be :ref:`calculated on
|
|
89
|
+
GPU <calculations_on_GPU>`, with a high gain in computation speed, which is
|
|
90
|
+
important for tapering and near field calculations.
|
|
91
|
+
|
|
92
|
+
* *Shapes*. There are several predefined shapes of optical elements implemented
|
|
93
|
+
as python classes. The python inheritance mechanism simplifies creation of
|
|
94
|
+
other shapes: the user specifies methods for surface height and surface
|
|
95
|
+
normal. The surface and the normal are defined either in local Cartesian
|
|
96
|
+
coordinates or in user-defined parametric coordinates. Parametric
|
|
97
|
+
representation enables closed shapes such as capillaries or wave guides. It
|
|
98
|
+
also enables exact solutions for complex shapes (e.g. a logarithmic spiral or
|
|
99
|
+
an ellipsoid) without any expansion. The methods of finding the intersections
|
|
100
|
+
of rays with the surface are very robust and can cope with pathological cases
|
|
101
|
+
such as sharp surface kinks. Notice that the search for intersection points
|
|
102
|
+
does not involve any approximation and has only numerical inaccuracy which is
|
|
103
|
+
set by default as 1 fm. Any surface can be combined with a (differently and
|
|
104
|
+
variably oriented) crystal structure and/or (variable) grating vector.
|
|
105
|
+
Surfaces can be faceted.
|
|
106
|
+
|
|
107
|
+
* *Energy dispersive elements*. Implemented are :meth:`crystals in dynamical
|
|
108
|
+
diffraction <xrt.backends.raycing.materials.Crystal.get_amplitude>`,
|
|
109
|
+
gratings (also with efficiency calculations), Fresnel zone plates,
|
|
110
|
+
Bragg-Fresnel optics and :meth:`multilayers in dynamical diffraction
|
|
111
|
+
<xrt.backends.raycing.materials.Multilayer.get_amplitude>`. Crystals can work
|
|
112
|
+
in Bragg or Laue cases, in reflection or in transmission. The
|
|
113
|
+
two-field polarization phenomena are fully preserved, also within the Darwin
|
|
114
|
+
diffraction plateau, thus enabling the ray tracing of crystal-based phase
|
|
115
|
+
retarders.
|
|
116
|
+
|
|
117
|
+
* *Materials*. The material properties are incorporated using :class:`three
|
|
118
|
+
different tabulations <xrt.backends.raycing.materials.Material>` of the
|
|
119
|
+
scattering factors, with differently wide and differently dense energy
|
|
120
|
+
meshes. Refractive index and absorption coefficient are calculated from the
|
|
121
|
+
scattering factors. Two-surface bodies, such as plates or refractive lenses,
|
|
122
|
+
are treated with both refraction and absorption.
|
|
123
|
+
|
|
124
|
+
* *Multiple reflections*. xrt can trace multiple reflections in a single
|
|
125
|
+
optical element. This is useful, for example in 'whispering gallery' optics
|
|
126
|
+
or in Montel or Wolter mirrors.
|
|
127
|
+
|
|
128
|
+
* *Non-sequential optics*. xrt can trace non-sequential optics where different
|
|
129
|
+
parts of the incoming beam meet different surfaces. Examples of such optics
|
|
130
|
+
are :ref:`poly-capillaries<polycapillary>` and Wolter mirrors.
|
|
131
|
+
|
|
132
|
+
* *Singular optics*. xrt correctly propagates :ref:`vortex beams
|
|
133
|
+
<test-Laguerre-Gaussian>`, which can be used for studying the creation of
|
|
134
|
+
vortex beams by transmissive or reflective optics.
|
|
135
|
+
|
|
136
|
+
* *Global coordinate system*. The optical elements are positioned in a global
|
|
137
|
+
coordinate system. This is convenient for modeling a real synchrotron
|
|
138
|
+
beamline. The coordinates in this system can be directly taken from a CAD
|
|
139
|
+
library. The optical surfaces are defined in their local systems for the
|
|
140
|
+
user's convenience.
|
|
141
|
+
|
|
142
|
+
* *Beam categories*. xrt discriminates rays by several categories: `good`,
|
|
143
|
+
`out`, `over` and `dead`. This distinction simplifies the adjustment of
|
|
144
|
+
entrance and exit slits. An alarm is triggered if the fraction of dead rays
|
|
145
|
+
exceeds a specified level.
|
|
146
|
+
|
|
147
|
+
* *Portability*. xrt runs on Windows and Unix-like platforms, wherever you can
|
|
148
|
+
run python.
|
|
149
|
+
|
|
150
|
+
* *Examples*. xrt comes with many examples. See the galleries, the links are at
|
|
151
|
+
the top bar.
|
|
152
|
+
|
|
153
|
+
* *Tests*. xrt comes with the tests of its several main aspects. See the folder
|
|
154
|
+
`tests` and also this documentation for the tests of
|
|
155
|
+
:ref:`undulators <mesh-methods>`, :ref:`optical elements <test_oes>`,
|
|
156
|
+
:ref:`materials <test_materials>` and :ref:`wave propagation <test_waves>`.
|
|
157
|
+
|
|
158
|
+
Installation
|
|
159
|
+
------------
|
|
160
|
+
|
|
161
|
+
Install it by pip or conda or get xrt from
|
|
162
|
+
`GitHub <https://github.com/kklmn/xrt>`_ and use it with or without
|
|
163
|
+
installation. See :ref:`detailed installation instructions <instructions>`.
|
|
164
|
+
|
|
165
|
+
The distribution archive also includes tests and examples. The complete
|
|
166
|
+
documentation is available online on
|
|
167
|
+
`Read the Docs <http://xrt.readthedocs.io>`_ and offline as
|
|
168
|
+
`zip file on GitHub <https://github.com/kklmn/xrt-docs>`_.
|
|
169
|
+
|
|
170
|
+
Get help
|
|
171
|
+
--------
|
|
172
|
+
|
|
173
|
+
For getting help and/or reporting a bug please use `GitHub xrt Issues
|
|
174
|
+
<https://github.com/kklmn/xrt/issues>`_.
|
|
175
|
+
|
|
176
|
+
Citing xrt
|
|
177
|
+
----------
|
|
178
|
+
|
|
179
|
+
Please cite xrt as:
|
|
180
|
+
`K. Klementiev and R. Chernikov, "Powerful scriptable ray tracing package xrt",
|
|
181
|
+
Proc. SPIE 9209, Advances in Computational Methods for X-Ray Optics III,
|
|
182
|
+
92090A (2014); doi:10.1117/12.2061400 <http://dx.doi.org/10.1117/12.2061400>`_.
|
|
183
|
+
`Online documentation on xrt.readthedocs.io;
|
|
184
|
+
doi:10.5281/zenodo.1252468 <https://doi.org/10.5281/zenodo.1252468>`_.
|
|
185
|
+
|
|
186
|
+
For the new capabilities:
|
|
187
|
+
1) Calculations of elastically deformed crystals on GPUs,
|
|
188
|
+
2) Mode analysis and mode propagation,
|
|
189
|
+
3) Modelling OAM (Orbital Angular Momentum) beams,
|
|
190
|
+
please cite:
|
|
191
|
+
`K. Klementiev & R. Chernikov, "New Features of xrt: Bent Crystals, Coherent
|
|
192
|
+
Modes, Waves with OAM" Synchrotron Radiation News (2023) 36:5, 23-27;
|
|
193
|
+
doi:10.1080/08940886.2023.2274735
|
|
194
|
+
<https://doi.org/10.1080/08940886.2023.2274735>`_.
|
|
195
|
+
|
|
196
|
+
Acknowledgments
|
|
197
|
+
---------------
|
|
198
|
+
|
|
199
|
+
* Josep Nicolás and Jordi Juanhuix (synchrotron Alba) are acknowledged for
|
|
200
|
+
discussion and for their Matlab codes used as examples at early stages of the
|
|
201
|
+
project.
|
|
202
|
+
|
|
203
|
+
* Andrew Geondzhian and Victoria Kabanova (summer students at DESY) are
|
|
204
|
+
acknowledged for their help in coding the classes of synchrotron sources.
|
|
205
|
+
|
|
206
|
+
* Rami Sankari and Alexei Preobrajenski (MAX IV Laboratory) are thanked for
|
|
207
|
+
discussion, testing and comparing with external codes.
|
|
208
|
+
|
|
209
|
+
* Hasan Yavaş, Jozef Bednarčik, Dmitri Novikov and Alexey Zozulya (DESY Photon
|
|
210
|
+
Science) are acknowledged for supplied cases.
|
|
211
|
+
|
|
212
|
+
* Hamed Tarawneh (MAX IV Laboratory) has initiated the custom field undulator
|
|
213
|
+
project and supplied tables of magnetic field.
|
|
214
|
+
|
|
215
|
+
* Bernard Kozioziemski (LLNL) has pointed to the importance of considering
|
|
216
|
+
the *total* absorption cross-section (not just photoelectric absorption) in
|
|
217
|
+
the cases of light materials at high energy. He also did deep tests of the
|
|
218
|
+
mosaic crystal model.
|
|
219
|
+
|
|
220
|
+
* Emilio Heredia (CLS) is thanked for valuable suggestions on GUI.
|
|
221
|
+
|
|
222
|
+
* Tim May (CLS) is acknowledged for inspiring the custom magnetic field
|
|
223
|
+
calculation development, providing field tables and comparing the results
|
|
224
|
+
with other codes.
|
|
225
|
+
|
|
226
|
+
* Louisa Pickworth (MAX IV Laboratory) has provided curves from other codes for
|
|
227
|
+
testing reflectivity/transmittivity of multilayers.
|
|
228
|
+
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
# ========Convention: note the difference from PEP8 for variables!=============
|
|
232
|
+
# Naming:
|
|
233
|
+
# * classes MixedUpperCase
|
|
234
|
+
# * varables lowerUpper _or_ lower
|
|
235
|
+
# * functions and methods underscore_separated _or_ lower
|
|
236
|
+
# =============================================================================
|
|
237
|
+
|
|
238
|
+
from .version import __versioninfo__, __version__, __date__
|
|
239
|
+
__module__ = "xrt"
|
|
240
|
+
__author__ = \
|
|
241
|
+
"Konstantin Klementiev (MAX IV Laboratory), " +\
|
|
242
|
+
"Roman Chernikov (NSLS-II)"
|
|
243
|
+
__email__ = "konstantin DOT klementiev AT gmail DOT com, " +\
|
|
244
|
+
"rchernikov AT gmail DOT com"
|
|
245
|
+
__license__ = "MIT license"
|
|
246
|
+
|
|
247
|
+
# __all__ = ['plotter', 'runner', 'multipro']
|
xrt/backends/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pass
|
xrt/backends/dummy.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Module :mod:`dummy` represents the simplest backend with the minimum output
|
|
4
|
+
required for building histograms. You can use this backend to generate your
|
|
5
|
+
simple examples, as exemplified in ``xrt_logo.py``::
|
|
6
|
+
|
|
7
|
+
def local_output():
|
|
8
|
+
# define your (x, y, intensity, cData, locNrays) here
|
|
9
|
+
return x, y, intensity, energy, locNrays
|
|
10
|
+
dummy.run_process = local_output #is invoked by xrt to get the rays
|
|
11
|
+
"""
|
|
12
|
+
import numpy as np
|
|
13
|
+
|
|
14
|
+
nrays = 25000
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def run_process(nrays=nrays):
|
|
18
|
+
nrays = int(nrays)
|
|
19
|
+
x = np.random.normal(size=nrays)
|
|
20
|
+
y = np.random.normal(size=nrays)
|
|
21
|
+
intensity = np.ones_like(x)
|
|
22
|
+
energy = x + y * 2.0 + 5000
|
|
23
|
+
# energy = np.random.uniform(4998, 5002, size=locNrays)
|
|
24
|
+
return x, y, intensity, energy, nrays
|