Import upstream version 1.7.1+git20210715.1.9ac4344
Debian Janitor
2 years ago
0 | * update copyright notices from git commit history | |
1 | * fix code error found by linting (flake8) | |
2 | * CIF atom type normalization of oxidation state (issue #122) | |
3 | * improve documentation of PowerModel multiprocessing code (issue #121) | |
4 | * fix numpy-1.20 deprecation warnings | |
5 | * bugfix in kinematical diffraction model. | |
6 | * add visualization of individual layer densities (issue #107) | |
7 | * new coplanar_alphaf helper function | |
8 | ||
0 | 9 | v1.7.1, 2021-01-02 |
1 | 10 | |
2 | 11 | * harmonize dependency versions between README and setup.py |
11 | 11 | ============= |
12 | 12 | |
13 | 13 | |
14 | [![Build Status](https://dev.azure.com/dominikkriegner/xrayutilities/_apis/build/status/dkriegner.xrayutilities?repoName=dkriegner%2Fxrayutilities&branchName=master)](https://dev.azure.com/dominikkriegner/xrayutilities/_build/latest?definitionId=1&repoName=dkriegner%2Fxrayutilities&branchName=master) | |
14 | [![Build Status](https://dev.azure.com/dominikkriegner/xrayutilities/_apis/build/status/dkriegner.xrayutilities?repoName=dkriegner%2Fxrayutilities&branchName=main)](https://dev.azure.com/dominikkriegner/xrayutilities/_build/) | |
15 | 15 | |
16 | 16 | xrayutilities is a collection of scripts used to analyze and simulate x-ray |
17 | 17 | diffraction data. It consists of a Python package and several routines coded |
215 | 215 | Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) |
216 | 216 | Requires-Python: ~=3.6 |
217 | 217 | Description-Content-Type: text/markdown |
218 | Provides-Extra: fit | |
218 | 219 | Provides-Extra: plot |
219 | Provides-Extra: fit |
1 | 1 | ============= |
2 | 2 | |
3 | 3 | |
4 | [![Build Status](https://dev.azure.com/dominikkriegner/xrayutilities/_apis/build/status/dkriegner.xrayutilities?repoName=dkriegner%2Fxrayutilities&branchName=master)](https://dev.azure.com/dominikkriegner/xrayutilities/_build/latest?definitionId=1&repoName=dkriegner%2Fxrayutilities&branchName=master) | |
4 | [![Build Status](https://dev.azure.com/dominikkriegner/xrayutilities/_apis/build/status/dkriegner.xrayutilities?repoName=dkriegner%2Fxrayutilities&branchName=main)](https://dev.azure.com/dominikkriegner/xrayutilities/_build/) | |
5 | 5 | |
6 | 6 | xrayutilities is a collection of scripts used to analyze and simulate x-ray |
7 | 7 | diffraction data. It consists of a Python package and several routines coded |
371 | 371 | for i in range(len(lines)): |
372 | 372 | lines[i] = re.sub(r'^\s*Note:', r'.. note::', lines[i]) |
373 | 373 | |
374 | ||
374 | 375 | def skip(app, what, name, obj, would_skip, options): |
375 | 376 | """always document __init__ and __call__ functions""" |
376 | 377 | if name in ["__init__", "__call__"]: |
377 | 378 | return False |
378 | 379 | return would_skip |
379 | 380 | |
381 | ||
380 | 382 | def setup(app): |
381 | 383 | app.connect('autodoc-process-docstring', process_docstring) |
382 | 384 | app.connect("autodoc-skip-member", skip) |
5 | 5 | Examples |
6 | 6 | ======== |
7 | 7 | |
8 | In the following a few code-snippets are shown which should help you getting started with *xrayutilities*. Not all of the codes shown in the following will be run-able as stand-alone script. For fully running scripts look in the `examples <https://github.com/dkriegner/xrayutilities/tree/master/examples>`_ or in the `download <https://sourceforge.net/projects/xrayutilities>`_. | |
8 | In the following a few code-snippets are shown which should help you getting started with *xrayutilities*. Not all of the codes shown in the following will be run-able as stand-alone script. For fully running scripts look in the `examples <https://github.com/dkriegner/xrayutilities/tree/main/examples>`_ or in the `download <https://sourceforge.net/projects/xrayutilities>`_. | |
9 | 9 | |
10 | 10 | |
11 | 11 | Reading data from data files |
95 | 95 | e.Save2HDF5(h5file, group="/frelon_%04d" % i) |
96 | 96 | |
97 | 97 | .. seealso:: |
98 | the fully working example provided in the `examples <https://github.com/dkriegner/xrayutilities/tree/master/examples>`_ directory perfectly suited for reading data from beamline ID01 | |
98 | the fully working example provided in the `examples <https://github.com/dkriegner/xrayutilities/tree/main/examples>`_ directory perfectly suited for reading data from beamline ID01 | |
99 | 99 | |
100 | 100 | Reading XRDML files |
101 | 101 | ^^^^^^^^^^^^^^^^^^^ |
115 | 115 | |
116 | 116 | |
117 | 117 | .. seealso:: |
118 | the fully working example provided in the `examples <https://github.com/dkriegner/xrayutilities/tree/master/examples>`_ directory | |
118 | the fully working example provided in the `examples <https://github.com/dkriegner/xrayutilities/tree/main/examples>`_ directory | |
119 | 119 | |
120 | 120 | Other formats |
121 | 121 | ^^^^^^^^^^^^^ |
130 | 130 | * support is also provided for reading of ``cif`` files from structure |
131 | 131 | databases to extract unit cell parameters as well es read data from those files (pdCIF, ESG files) |
132 | 132 | |
133 | See the `examples <https://github.com/dkriegner/xrayutilities/tree/master/examples>`_ directory for more information and working example scripts. | |
133 | See the `examples <https://github.com/dkriegner/xrayutilities/tree/main/examples>`_ directory for more information and working example scripts. | |
134 | 134 | |
135 | 135 | Angle calculation using :class:`~xrayutilities.experiment.Experiment` and :mod:`~xrayutilities.materials` classes |
136 | 136 | ----------------------------------------------------------------------------------------------------------------- |
5 | 5 | Simulation examples |
6 | 6 | =================== |
7 | 7 | |
8 | In the following a few code-snippets are shown which should help you getting started with reflectivity and diffraction simulations using *xrayutilities*. All simulations in *xrayutilities* are for layers systems and currently there are no plans to extend this to other geometries. Note that not all of the codes shown in the following will be run-able as stand-alone scripts. For fully running scripts look in the `examples <https://github.com/dkriegner/xrayutilities/tree/master/examples>`_ directory in the `download <https://sourceforge.net/projects/xrayutilities>`_. | |
8 | In the following a few code-snippets are shown which should help you getting started with reflectivity and diffraction simulations using *xrayutilities*. All simulations in *xrayutilities* are for layers systems and currently there are no plans to extend this to other geometries. Note that not all of the codes shown in the following will be run-able as stand-alone scripts. For fully running scripts look in the `examples <https://github.com/dkriegner/xrayutilities/tree/main/examples>`_ directory in the `download <https://sourceforge.net/projects/xrayutilities>`_. | |
9 | 9 | |
10 | 10 | Building Layer stacks for simulations |
11 | 11 | ------------------------------------- |
295 | 295 | Fitting of diffraction data |
296 | 296 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
297 | 297 | |
298 | All diffraction models can be embedded into the :class:`~xrayutilities.simpack.fit.FitModel` class, which is suitable to refine the model parameters. Below (and in the `examples <https://github.com/dkriegner/xrayutilities/tree/master/examples>`_ directory) a runnable script is shown which shows the fitting for a pseudomorphic InMnAs epilayer on InAs(001). The fitting is performed using the `lmfit <https://lmfit.github.io/lmfit-py/>`_ Python package which needs to be installed when you want to use this fitting function. As one can see below the :func:`~xrayutilities.simpack.FitModel.set_param_hint` function can be used to set up the respective fit parameters including their boundaries and possible correlation with other parameters of the model. It should be equally possible to fit more complex layer structures, however, I expect that one needs to adjust manually the starting parameters to yield something very reasonable. Since this capabilities are rather new please report back any success/problems you have with this via the mailing list. | |
298 | All diffraction models can be embedded into the :class:`~xrayutilities.simpack.fit.FitModel` class, which is suitable to refine the model parameters. Below (and in the `examples <https://github.com/dkriegner/xrayutilities/tree/main/examples>`_ directory) a runnable script is shown which shows the fitting for a pseudomorphic InMnAs epilayer on InAs(001). The fitting is performed using the `lmfit <https://lmfit.github.io/lmfit-py/>`_ Python package which needs to be installed when you want to use this fitting function. As one can see below the :func:`~xrayutilities.simpack.FitModel.set_param_hint` function can be used to set up the respective fit parameters including their boundaries and possible correlation with other parameters of the model. It should be equally possible to fit more complex layer structures, however, I expect that one needs to adjust manually the starting parameters to yield something very reasonable. Since this capabilities are rather new please report back any success/problems you have with this via the mailing list. | |
299 | 299 | |
300 | 300 | .. code-block:: python |
301 | 301 | :linenos: |
376 | 376 | # pm.close() # after end-of-use |
377 | 377 | |
378 | 378 | |
379 | Note that in MS windows you need to encapsulate this code into a dummy function to allow for the multiprocessing module to work correctly. The code then must look like:: | |
379 | Note that in MS windows and macOS you need to encapsulate this code into a dummy function to allow for the multiprocessing module to work correctly. See the `Python documentation <https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods>`_ for details. The code then must look like:: | |
380 | 380 | |
381 | 381 | import numpy |
382 | 382 | import xrayutilities as xu |
393 | 393 | pm.close() |
394 | 394 | |
395 | 395 | if __name__ == '__main__': |
396 | freeze_support() | |
396 | freeze_support() # only required on MS Windows | |
397 | 397 | main() |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2017-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import multiprocessing |
18 | 18 | import os |
24 | 24 | |
25 | 25 | |
26 | 26 | def main(): |
27 | """dummy main function to enable multiprocessing on windows""" | |
27 | """ | |
28 | dummy main function to enable multiprocessing on Windows and macOS. | |
29 | This is required to avoid starting of the multiprocessing code upon import | |
30 | of the script and is connected with the used multiprocessing start method. | |
31 | ||
32 | See also: | |
33 | https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods | |
34 | """ | |
28 | 35 | mpl.rcParams['font.size'] = 16.0 |
29 | 36 | mpl.rcParams['lines.linewidth'] = 2.0 |
30 | 37 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2020-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | # Copyright (C) 2020 Mike Moron <mike.moron@tu-dortmund.de> |
17 | 17 | |
18 | 18 | import numpy as np |
37 | 37 | |
38 | 38 | # conventional X-ray reflectivity modelling |
39 | 39 | m = xu.simpack.SpecularReflectivityModel(ls) |
40 | pos, eldens = m.densityprofile(500) | |
40 | pos, eldens, layer_eldens = m.densityprofile(500, individual_layers=True) | |
41 | ||
41 | 42 | |
42 | 43 | # slice the layerstack into an Amorphous sublayer at every 0.1 angstrom. |
43 | 44 | # at the top a vacuum layer is added |
59 | 60 | fig = plt.figure() |
60 | 61 | ax = fig.add_subplot(111) |
61 | 62 | ax.plot(pos, eldens, '.-', label='conventional') |
63 | for i in range(len(layer_eldens)): | |
64 | ax.plot(pos, layer_eldens[i], ':') | |
62 | 65 | ax.plot(spos, seldens, '.-', label='sliced') # arbitrary shift for vis. |
63 | 66 | ax.legend() |
64 | 67 | ax.set_xlabel(r'z-position') |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2013 Raphael Grifone <raphael.grifone@esrf.fr> |
16 | # Copyright (C) 2013 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2013-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | |
18 | 18 | """ |
19 | 19 | The function below is a modification of the hotpixelkill function included in |
50 | 50 | e = xu.io.EDFFile(f) |
51 | 51 | ccdraw = e.data |
52 | 52 | if len(ccdavg) == 0: |
53 | ccdavg = ccdraw.astype(numpy.float) | |
53 | ccdavg = ccdraw.astype(float) | |
54 | 54 | else: |
55 | 55 | ccdavg += ccdraw |
56 | 56 | n += 1 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2012 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | Example script to show how to use xrayutilities to read and plot |
54 | 54 | # correction |
55 | 55 | normalizer_detcorr = xu.IntensityNormalizer( |
56 | 56 | "MCA", mon="Monitor", time="Seconds", |
57 | absfun=lambda d: d["detcorr"] / d["psd2"].astype(numpy.float)) | |
57 | absfun=lambda d: d["detcorr"] / d["psd2"].astype(float)) | |
58 | 58 | |
59 | 59 | # substrate material used for Bragg peak calculation to correct for |
60 | 60 | # experimental offsets |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2009-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2009-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | |
18 | 18 | """ |
19 | 19 | xrayutilities is a Python package for assisting with x-ray diffraction |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2018-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2011-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import numpy |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2011-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2011-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | functions to help with experimental alignment during experiments, especially |
151 | 151 | rad = radians(x) |
152 | 152 | p2 = math.radians(p[2]) |
153 | 153 | r = numpy.concatenate([degrees(sin(rad)) / cos(rad - p2), |
154 | numpy.ones(x.shape, dtype=numpy.float), | |
154 | numpy.ones(x.shape, dtype=float), | |
155 | 155 | - math.degrees(p[0]) * sin(rad) / |
156 | 156 | cos(rad - p2) ** 2 * sin(rad - p2)]) |
157 | 157 | r.shape = (3,) + x.shape |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2010 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2010-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | xrayutilities derives its own exceptions which are raised |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009-2010 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2009-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2009-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | # Copyright (C) 2012 Tanja Etzelstorfer <tanja.etzelstorfer@jku.at> |
18 | 18 | |
19 | 19 | """ |
484 | 484 | flag to tell if angles are passed as degree (default: True) |
485 | 485 | sampledis : tuple or list or array-like |
486 | 486 | sample displacement vector in relative units of the detector |
487 | distance (default: (0, 0, 0)) | |
487 | distance. Applies to parallal beam geometry. (default: (0, 0, 0)) | |
488 | 488 | """ |
489 | 489 | flags = 0 |
490 | 490 | if self._has_translations: |
564 | 564 | flag to tell if angles are passed as degree (default: True) |
565 | 565 | sampledis : tuple or list or array-like |
566 | 566 | sample displacement vector in relative units of the detector |
567 | distance (default: (0, 0, 0)) | |
567 | distance. Applies to parallal beam geometry. (default: (0, 0, 0)) | |
568 | 568 | |
569 | 569 | Returns |
570 | 570 | ------- |
768 | 768 | flag to tell if angles are passed as degree (default: True) |
769 | 769 | sampledis : tuple or list or array-like |
770 | 770 | sample displacement vector in relative units of the detector |
771 | distance (default: (0, 0, 0)) | |
771 | distance. Applies to parallal beam geometry. (default: (0, 0, 0)) | |
772 | 772 | |
773 | 773 | Returns |
774 | 774 | ------- |
1018 | 1018 | flag to tell if angles are passed as degree (default: True) |
1019 | 1019 | sampledis : tuple or list or array-like |
1020 | 1020 | sample displacement vector in relative units of the detector |
1021 | distance (default: (0, 0, 0)) | |
1021 | distance. Applies to parallal beam geometry. (default: (0, 0, 0)) | |
1022 | 1022 | |
1023 | 1023 | |
1024 | 1024 | Returns |
1575 | 1575 | x-ray energy in eV (default: converted self._wl) |
1576 | 1576 | deg : bool, optional |
1577 | 1577 | flag to tell if angles are passed as degree (default: True) |
1578 | sampledis : tuple, list or array-like, optional | |
1578 | sampledis : tuple or list or array-like | |
1579 | 1579 | sample displacement vector in relative units of the detector |
1580 | distance (default: (0, 0, 0)) | |
1580 | distance. Applies to parallal beam geometry. (default: (0, 0, 0)) | |
1581 | 1581 | |
1582 | 1582 | Returns |
1583 | 1583 | ------- |
15 | 15 | # Copyright (C) 2009-2010, 2013 |
16 | 16 | # Eugen Wintersberger <eugen.wintersberger@desy.de> |
17 | 17 | # Copyright (C) 2009 Mario Keplinger <mario.keplinger@jku.at> |
18 | # Copyright (C) 2009-2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
18 | # Copyright (C) 2009-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
19 | 19 | |
20 | 20 | import abc |
21 | 21 | |
164 | 164 | """ |
165 | 165 | prepare array for passing to c-code |
166 | 166 | """ |
167 | if isinstance(a, (list, tuple, numpy.float, numpy.int)): | |
167 | if isinstance(a, (list, tuple, float, int)): | |
168 | 168 | a = numpy.asarray(a) |
169 | 169 | return a.reshape(a.size) |
170 | 170 |
15 | 15 | # Copyright (C) 2009-2010, 2013 |
16 | 16 | # Eugen Wintersberger <eugen.wintersberger@desy.de> |
17 | 17 | # Copyright (C) 2009 Mario Keplinger <mario.keplinger@jku.at> |
18 | # Copyright (C) 2009-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
18 | # Copyright (C) 2009-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
19 | 19 | |
20 | 20 | import numpy |
21 | 21 | |
250 | 250 | for i in range(self.nx): |
251 | 251 | for j in range(self.ny): |
252 | 252 | self._gdata[i, j] = [] |
253 | self._gnorm = numpy.zeros((self.nx, self.ny), dtype=numpy.int) | |
253 | self._gnorm = numpy.zeros((self.nx, self.ny), dtype=int) | |
254 | 254 | |
255 | 255 | def Clear(self): |
256 | 256 | self._allocate_memory() |
284 | 284 | |
285 | 285 | # perform gridding this should be moved to native code if possible |
286 | 286 | def gindex(x, min, delt): |
287 | return numpy.round((x - min) / delt).astype(numpy.int) | |
287 | return numpy.round((x - min) / delt).astype(int) | |
288 | 288 | |
289 | 289 | xdelta = delta(self.xmin, self.xmax, self.nx) |
290 | 290 | ydelta = delta(self.ymin, self.ymax, self.ny) |
15 | 15 | # Copyright (C) 2009-2010, 2013 |
16 | 16 | # Eugen Wintersberger <eugen.wintersberger@desy.de> |
17 | 17 | # Copyright (C) 2009 Mario Keplinger <mario.keplinger@jku.at> |
18 | # Copyright (C) 2009-2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
18 | # Copyright (C) 2009-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
19 | 19 | |
20 | 20 | import numpy |
21 | 21 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2013, 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | # module for handling files stored in the CBF data format |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2013-2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | |
18 | 18 | """ |
78 | 78 | def ReadMCA(self): |
79 | 79 | self.mca = numpy.empty((len(self.mca_files), |
80 | 80 | numpy.loadtxt(self.mca_files[0]).shape[0]), |
81 | dtype=numpy.float) | |
81 | dtype=float) | |
82 | 82 | for i in range(len(self.mca_files)): |
83 | 83 | mcadata = numpy.loadtxt(self.mca_files[i]) |
84 | 84 |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009-2010 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2010-2012,2014-2015 | |
16 | # Copyright (C) 2010-2012,2014-2019 | |
17 | 17 | # Dominik Kriegner <dominik.kriegner@gmail.com> |
18 | 18 | # Copyright (C) 2012 Tanja Etzelstorfer <tanja.etzelstorfer@jku.at> |
19 | 19 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import glob |
18 | 18 | import os.path |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | module for reading ILL data files (station D23): numor files |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2012-2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import time |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import copy |
18 | 18 | import re |
108 | 108 | loopheader = [] |
109 | 109 | numOfEntries = -1 |
110 | 110 | multiline = None |
111 | label = None | |
111 | 112 | |
112 | 113 | while True: |
113 | 114 | line = fh.readline().decode('ascii') |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015-2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | |
18 | 18 | """ |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2009-2013 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2009-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | |
18 | 18 | """ |
19 | 19 | a set of routines to convert Seifert ASCII files to HDF5 |
267 | 267 | self.data.append(tmplist) |
268 | 268 | |
269 | 269 | # in the end we convert the data list to a numeric array |
270 | self.data = numpy.array(self.data, dtype=numpy.float) | |
270 | self.data = numpy.array(self.data, dtype=float) | |
271 | 271 | for key in self.axispos: |
272 | 272 | self.axispos[key] = numpy.array(self.axispos[key]) |
273 | 273 |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009-2010 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2009-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2009-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | # Copyright (C) 2019 Daniel Schick <schick.daniel@gmail.com> | |
17 | 18 | |
18 | 19 | """ |
19 | 20 | a class for observing a SPEC data file |
510 | 511 | |
511 | 512 | # write the initial motor positions as attributes |
512 | 513 | for k in self.init_motor_pos: |
513 | g.attrs[k] = numpy.float(self.init_motor_pos[k]) | |
514 | g.attrs[k] = float(self.init_motor_pos[k]) | |
514 | 515 | |
515 | 516 | # if scan contains MCA data write also MCA parameters |
516 | 517 | g.attrs['has_mca'] = self.has_mca |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009-2010 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2009-2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2009-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | |
18 | 18 | """ |
19 | 19 | module to handle spectra data |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2010-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2010-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | |
18 | 18 | from . import elements |
19 | 19 | from .atom import Atom |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2009-2012 Eugen Wintersberger <eugen.wintersberger@desy.de> | |
15 | 16 | # Copyright (C) 2012-2020 Dominik Kriegner <dominik.kriegner@gmail.com> |
16 | 17 | """ |
17 | 18 | script to create the HDF5 database from the raw data of XOP. |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2009-2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | module containing the Atom class which handles the database access for atomic |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2010-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2010-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import copy |
18 | 18 | import io |
217 | 217 | def get_element(cifstring): |
218 | 218 | el = re.sub(r"['\"]", r"", cifstring) |
219 | 219 | if '+' in el or '-' in el: |
220 | # add oxidation number if not present | |
221 | for sign in ('+', '-'): | |
222 | if sign in el: | |
223 | if not el[el.index(sign)-1].isdigit(): | |
224 | signidx = el.index(sign) | |
225 | el = el[:signidx] + '1' + el[signidx:] | |
226 | # replace special characters | |
220 | 227 | for r, o in zip(('dot', 'p', 'm'), ('.', '+', '-')): |
221 | # move special character to last position | |
222 | 228 | el = el.replace(o, r) |
223 | 229 | else: |
224 | 230 | el = re.sub(r"([0-9])", r"", el) |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2010-2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2010-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | |
18 | 18 | from .atom import Atom |
19 | 19 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2018 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2018-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | implement convenience functions to define Heusler materials. |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2018 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2018-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import math |
18 | 18 | from math import pi |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2013-2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import numpy |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2017-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2017-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | """ |
17 | 17 | module handling crystal lattice structures. A SGLattice consists of a space |
18 | 18 | group number and the position of atoms specified as Wyckoff positions along |
1268 | 1268 | # check all atomic species seperately |
1269 | 1269 | for el in elements: |
1270 | 1270 | catoms = list(filter(lambda at: at[0] == el, atoms)) |
1271 | found = numpy.zeros(len(catoms), dtype=numpy.bool) | |
1271 | found = numpy.zeros(len(catoms), dtype=bool) | |
1272 | 1272 | # see if atomic positions fit to Wyckoff positions |
1273 | 1273 | for k, wyckpos in wp[sgrp].items(): |
1274 | 1274 | num = int(k[:-1]) |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2018-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2017-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | __all__ = ["RangeDict", "eqhkl_default", "eqhkl_custom", "wp"] |
18 | 18 |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | 15 | # Copyright (C) 2009 Eugen Wintersberger <eugen.wintersberger@desy.de> |
16 | # Copyright (C) 2010-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # Copyright (C) 2010-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | |
18 | 18 | from .algebra import solve_quartic |
19 | 19 | from .fit import (fit_peak2d, gauss_fit, linregress, multPeakFit, multPeakPlot, |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016-2018 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | module providing analytic algebraic functions not implemented in scipy or any |
77 | 77 | t36 = 16 * t17 * t27 |
78 | 78 | t37 = 144 * t07 * t12 * t17 |
79 | 79 | t30 = t26 + t28 + t29 - t35 - t36 - t37 |
80 | t31 = t30.astype(numpy.complex)**(1./2) | |
80 | t31 = t30.astype(complex)**(1./2) | |
81 | 81 | t32 = (t24 * t31) / 18 |
82 | 82 | t34 = (4 * t07 * t17) / 3 |
83 | 83 | t33 = t22 + t23 + t32 - t34 |
84 | t38 = 1 / t33.astype(numpy.complex)**(1./6) | |
84 | t38 = 1 / t33.astype(complex)**(1./6) | |
85 | 85 | t39 = t33**(1./3) |
86 | 86 | t40 = 12 * a0 * t01 |
87 | 87 | t41 = t33**(2./3) |
91 | 91 | t47 = (9 * t14 * t15) / 64 |
92 | 92 | t48 = 3 * a3 * a1 * t04 |
93 | 93 | t44 = t08 + t40 + t42 + t43 - t46 - t47 - t48 |
94 | t45 = t44.astype(numpy.complex)**(1./2) | |
94 | t45 = t44.astype(complex)**(1./2) | |
95 | 95 | t49 = 6.**(1./2) |
96 | 96 | t50 = 27 * t12 |
97 | 97 | t51 = 2 * t07 * t08 |
98 | 98 | t52 = 3 * t24 * t31 |
99 | 99 | t62 = 72 * t07 * t17 |
100 | 100 | t53 = t50 + t51 + t52 - t62 |
101 | t54 = t53.astype(numpy.complex)**(1./2) | |
101 | t54 = t53.astype(complex)**(1./2) | |
102 | 102 | t55 = 3 * t03 * t49 * t54 |
103 | 103 | t59 = t08 * t45 |
104 | 104 | t60 = 12 * t17 * t45 |
105 | 105 | t61 = 9 * t41 * t45 |
106 | 106 | t63 = 12 * t07 * t39 * t45 |
107 | 107 | t56 = t55 - t59 - t60 - t61 - t63 |
108 | t57 = t56.astype(numpy.complex)**(1./2) | |
109 | t58 = 1. / t44.astype(numpy.complex)**(1./4) | |
108 | t57 = t56.astype(complex)**(1./2) | |
109 | t58 = 1. / t44.astype(complex)**(1./4) | |
110 | 110 | t64 = (t38 * t45) / 6 |
111 | 111 | t65 = - t55 - t59 - t60 - t61 - t63 |
112 | t66 = t65.astype(numpy.complex)**(1./2) | |
112 | t66 = t65.astype(complex)**(1./2) | |
113 | 113 | |
114 | 114 | return (-(a3 * t01) / 4 - (t38 * t45) / 6 - (t38 * t57 * t58) / 6, |
115 | 115 | (t38 * t57 * t58) / 6 - (t38 * t45) / 6 - (a3 * t01) / 4, |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2012-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | """ |
17 | 17 | module with a function wrapper to scipy.optimize.leastsq |
18 | 18 | for fitting of a 2D function to a peak or a 1D Gauss fit with |
649 | 649 | if fit.stopreason[0] not in ['Sum of squares convergence']: |
650 | 650 | print("XU.math.multPeakFit: fit NOT converged (%s)" |
651 | 651 | % fit.stopreason[0]) |
652 | return Nono, None, None, None | |
652 | return None, None, None, None | |
653 | 653 | except IndexError: |
654 | 654 | print("XU.math.multPeakFit: fit most probably NOT converged (%s)" |
655 | 655 | % str(fit.stopreason)) |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2012-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | module with several common function needed in xray data analysis |
85 | 85 | dataout = data.copy() |
86 | 86 | |
87 | 87 | mean = (data[:-2] + data[2:]) / 2. |
88 | mask = numpy.zeros_like(data[1:-1], dtype=numpy.bool) | |
88 | mask = numpy.zeros_like(data[1:-1], dtype=bool) | |
89 | 89 | if threshold: |
90 | 90 | mask = numpy.logical_or( |
91 | 91 | mask, numpy.logical_or(data[1:-1] * threshold < mean, |
182 | 182 | r = numpy.vstack((- (p[0] - x) / p[1]**2 * Gauss1d(x, *lp), |
183 | 183 | (p[0] - x) ** 2 / (p[1] ** 3) * Gauss1d(x, *lp), |
184 | 184 | Gauss1d(x, *lp) / p[2], |
185 | numpy.ones(x.shape, dtype=numpy.float))) | |
185 | numpy.ones(x.shape, dtype=float))) | |
186 | 186 | |
187 | 187 | return r |
188 | 188 | |
320 | 320 | 8 * p[2] * p[1] * (x-p[0])**2 / |
321 | 321 | (4*p[0]**2 - 8*p[0]*x + p[1]**2 + 4*x**2) ** 2, |
322 | 322 | 1 / (1 + (2 * (x - p[0]) / p[1]) ** 2), |
323 | numpy.ones(x.shape, dtype=numpy.float))) | |
323 | numpy.ones(x.shape, dtype=float))) | |
324 | 324 | return r |
325 | 325 | |
326 | 326 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016-2018 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import fractions |
18 | 18 | import math |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016-2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2017-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | """ |
17 | 17 | Defines new matplotlib Sqrt scale which further allows for negative values by |
18 | 18 | using the sign of the original value as sign of the plotted value. |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2010-2011 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2010-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | module to provide functions that perform block averaging |
235 | 235 | Examples |
236 | 236 | -------- |
237 | 237 | >>> detcorr = IntensityNormalizer("MCA", time="Seconds", |
238 | >>> absfun=lambda d: d["PSDCORR"]/d["PSD"].astype(numpy.float)) | |
238 | >>> absfun=lambda d: d["PSDCORR"]/d["PSD"].astype(float)) | |
239 | 239 | """ |
240 | 240 | valid_kwargs = {'mon': 'monitor field name', |
241 | 241 | 'time': 'count time field/value', |
385 | 385 | sets the flatfield of the detector |
386 | 386 | """ |
387 | 387 | if isinstance(flatf, (list, tuple, numpy.ndarray)): |
388 | self._flatfield = numpy.array(flatf, dtype=numpy.float) | |
388 | self._flatfield = numpy.array(flatf, dtype=float) | |
389 | 389 | self._flatfieldav = numpy.mean(self._flatfield[ |
390 | 390 | self._flatfield.nonzero()]) |
391 | 391 | self._flatfield[self.flatfield < 1.e-5] = 1.0 |
411 | 411 | sets the darkfield of the detector |
412 | 412 | """ |
413 | 413 | if isinstance(darkf, (list, tuple, numpy.ndarray)): |
414 | self._darkfield = numpy.array(darkf, dtype=numpy.float) | |
414 | self._darkfield = numpy.array(darkf, dtype=float) | |
415 | 415 | self._darkfieldav = numpy.mean(self._darkfield) |
416 | 416 | elif isinstance(darkf, type(None)): |
417 | 417 | self._darkfield = None |
450 | 450 | else: |
451 | 451 | rawdata = data[self._det] |
452 | 452 | |
453 | corrint = numpy.zeros(rawdata.shape, dtype=numpy.float) | |
453 | corrint = numpy.zeros(rawdata.shape, dtype=float) | |
454 | 454 | |
455 | 455 | # set needed variables |
456 | 456 | # monitor intensity |
527 | 527 | corrint = (corrint / self._flatfield[numpy.newaxis, :] * |
528 | 528 | self._flatfieldav) |
529 | 529 | |
530 | elif len(rawdata.shape) == 2 and isinstance(c, numpy.float): | |
530 | elif len(rawdata.shape) == 2 and isinstance(c, float): | |
531 | 531 | # single 2D detector frame |
532 | 532 | corrint = rawdata * c |
533 | 533 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | Module provides functions to convert a q-vector from reciprocal space to |
58 | 58 | bounds to be handed over to the scipy.minimize routine. The function |
59 | 59 | will expand fixed values to two equal bounds |
60 | 60 | constraints, list |
61 | list of equivility constraints for fixed values | |
61 | list of equality constraints for fixed values | |
62 | 62 | """ |
63 | 63 | lb = [] |
64 | 64 | ub = [] |
69 | 69 | lb.append(b[0]) |
70 | 70 | ub.append(b[1]) |
71 | 71 | elif len(b) == 1: |
72 | # due to a bug in scipy >= 1.5.0 we need to allow a small | |
73 | # variation | |
74 | lb.append(b[0] - config.EPSILON) | |
75 | ub.append(b[0] + config.EPSILON) | |
76 | # to really fix the parameter we create an equivalent | |
77 | # constraint; see scipy/scipy#12433 | |
72 | # upper = lower bound needs an equality constraint. | |
73 | lb.append(-numpy.inf) | |
74 | ub.append(numpy.inf) | |
75 | # see scipy/scipy#12433 | |
78 | 76 | constraints.append(dict(type='eq', |
79 | 77 | fun=lambda x, j=j, v=b[0]: x[j] - v, |
80 | 78 | # lambda j=j to bind variable by value |
82 | 80 | else: |
83 | 81 | raise InputError('bound values must have two or one elements') |
84 | 82 | elif isinstance(b, numbers.Number): |
85 | # due to a bug in scipy >= 1.5.0 we need to allow a small variation | |
86 | lb.append(b - config.EPSILON) | |
87 | ub.append(b + config.EPSILON) | |
88 | # to really fix the parameter we create an equivalent | |
89 | # constraint; see scipy/scipy#12433 | |
83 | # upper = lower bound needs an equality constraint. | |
84 | lb.append(-numpy.inf) | |
85 | ub.append(numpy.inf) | |
86 | # see scipy/scipy#12433 | |
90 | 87 | constraints.append(dict(type='eq', |
91 | 88 | fun=lambda x, j=j, v=b: x[j] - v, |
92 | 89 | # lambda j=j to bind variable by value |
93 | 90 | )) |
94 | 91 | elif b is None: |
95 | lb.append(-np.inf) | |
96 | ub.append(np.inf) | |
92 | lb.append(-numpy.inf) | |
93 | ub.append(numpy.inf) | |
97 | 94 | else: |
98 | 95 | raise InputError('bound value is of invalid type (%s)' % type(b)) |
99 | 96 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | """ |
17 | 17 | simulation subpackage of xrayutilities. |
18 | 18 | |
28 | 28 | DarwinModelAlloy, DarwinModelGaInAs001, |
29 | 29 | DarwinModelSiGe001, GradedBuffer) |
30 | 30 | from .fit import FitModel |
31 | from .helpers import coplanar_alphai, get_qz | |
31 | from .helpers import coplanar_alphaf, coplanar_alphai, get_qz | |
32 | 32 | from .models import (DiffuseReflectivityModel, DynamicalModel, |
33 | 33 | DynamicalReflectivityModel, KinematicalModel, |
34 | 34 | KinematicalMultiBeamModel, LayerModel, Model, |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | import abc |
17 | 17 | import collections.abc |
18 | 18 | import copy |
207 | 207 | Ih = {'S': numpy.zeros(len(self.qz)), 'P': numpy.zeros(len(self.qz))} |
208 | 208 | geomfact = heaviside(self.alphai) * heaviside(self.alphaf) |
209 | 209 | for pol in self.get_polarizations(): |
210 | r, rbar, t = (numpy.zeros(self.npoints, dtype=numpy.complex), | |
211 | numpy.zeros(self.npoints, dtype=numpy.complex), | |
212 | numpy.ones(self.npoints, dtype=numpy.complex)) | |
210 | r, rbar, t = (numpy.zeros(self.npoints, dtype=complex), | |
211 | numpy.zeros(self.npoints, dtype=complex), | |
212 | numpy.ones(self.npoints, dtype=complex)) | |
213 | 213 | for nrep, subml in ml: |
214 | 214 | r, rbar, t = self._recur_sim(nrep, subml, r, rbar, t, pol) |
215 | 215 | self.r, self.rbar, self.t = r, rbar, t |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import numpy |
18 | 18 | |
19 | 19 | from .. import config, utilities |
20 | 20 | |
21 | 21 | |
22 | def coplanar_alphai(qx, qz, en='config'): | |
22 | def coplanar_alphai(qx, qz, en='config', nan_Laue=False): | |
23 | 23 | """ |
24 | calculate coplanar incidence angle from knowledge of the qx and qz | |
25 | coordinates | |
24 | calculate coplanar incidence angle from knowledge of the qx (inplane) and | |
25 | qz (out of plane) coordinates | |
26 | 26 | |
27 | 27 | Parameters |
28 | 28 | ---------- |
32 | 32 | out of plane momentum transfer component |
33 | 33 | en : float or str, optional |
34 | 34 | x-ray energy (eV). By default the value from the config is used. |
35 | nan_Laue : bool, optional | |
36 | set output points inside the Laue zone to 'nan'. default: False | |
35 | 37 | |
36 | 38 | Returns |
37 | 39 | ------- |
38 | 40 | alphai : array-like |
39 | the incidence angle in degree. points in the Laue zone are set to | |
41 | the incidence angle in degree | |
42 | """ | |
43 | if isinstance(en, str) and en == 'config': | |
44 | en = utilities.energy(config.ENERGY) | |
45 | k = 2 * numpy.pi / utilities.en2lam(en) | |
46 | th = numpy.arcsin(numpy.sqrt(qx**2 + qz**2) / (2 * k)) | |
47 | ai = numpy.arctan2(qx, qz) + th | |
48 | if nan_Laue: | |
49 | if isinstance(ai, numpy.ndarray): # remove positions in Laue zone | |
50 | ai[qz < numpy.sqrt(2 * qx * k - qx**2)] = numpy.nan | |
51 | else: | |
52 | if qz < numpy.sqrt(2 * qx * k - qx**2): | |
53 | ai = numpy.nan | |
54 | return numpy.degrees(ai) | |
55 | ||
56 | ||
57 | def coplanar_alphaf(qx, qz, en='config', nan_Laue=False): | |
58 | """ | |
59 | calculate coplanar exit angle from knowledge of the qx (inplane) and qz | |
60 | (out of plane) coordinates | |
61 | ||
62 | Parameters | |
63 | ---------- | |
64 | qx : array-like | |
65 | inplane momentum transfer component | |
66 | qz : array-like | |
67 | out of plane momentum transfer component | |
68 | en : float or str, optional | |
69 | x-ray energy (eV). By default the value from the config is used. | |
70 | nan_Laue : bool, optional | |
71 | set output points inside the Laue zone to 'nan'. default: False | |
72 | ||
73 | Returns | |
74 | ------- | |
75 | alphaf : array-like | |
76 | the exit angle in degree. points in the Laue zone are set to | |
40 | 77 | 'nan'. |
41 | 78 | """ |
42 | 79 | if isinstance(en, str) and en == 'config': |
43 | 80 | en = utilities.energy(config.ENERGY) |
44 | 81 | k = 2 * numpy.pi / utilities.en2lam(en) |
45 | 82 | th = numpy.arcsin(numpy.sqrt(qx**2 + qz**2) / (2 * k)) |
46 | ai = numpy.arctan2(qx, qz) + th | |
47 | if isinstance(ai, numpy.ndarray): # remove positions in Laue zone | |
48 | ai[qz < numpy.sqrt(2 * qx * k - qx**2)] = numpy.nan | |
49 | else: | |
50 | if qz < numpy.sqrt(2 * qx * k - qx**2): | |
51 | ai = numpy.nan | |
52 | return numpy.degrees(ai) | |
83 | af = th - numpy.arctan2(qx, qz) | |
84 | if nan_Laue: | |
85 | if isinstance(af, numpy.ndarray): # remove positions in Laue zone | |
86 | af[qz < numpy.sqrt(2 * qx * k - qx**2)] = numpy.nan | |
87 | else: | |
88 | if qz < numpy.sqrt(2 * qx * k - qx**2): | |
89 | af = numpy.nan | |
90 | return numpy.degrees(af) | |
53 | 91 | |
54 | 92 | |
55 | 93 | def get_qz(qx, alphai, en='config'): |
69 | 107 | Returns |
70 | 108 | ------- |
71 | 109 | array-like |
72 | the qz position for the given incidence angle | |
110 | the qz position for the given incidence angle. The output is nan in | |
111 | case the inplane momentum transfer can not be reached. | |
73 | 112 | """ |
74 | 113 | if isinstance(en, str) and en == 'config': |
75 | 114 | en = utilities.energy(config.ENERGY) |
76 | 115 | k = 2 * numpy.pi / utilities.en2lam(en) |
77 | 116 | ai = numpy.radians(alphai) |
78 | return numpy.sqrt(k**2 - (qx + k * numpy.cos(ai))**2) + k * numpy.sin(ai) | |
117 | qz = numpy.sqrt(k**2 - (qx + k * numpy.cos(ai))**2) + k * numpy.sin(ai) | |
118 | return qz |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import abc |
18 | 18 | import copy |
327 | 327 | domega = numpy.arctan2(qinp, qz) |
328 | 328 | alphai, alphaf = (theta + domega, theta - domega) |
329 | 329 | # calculate structure factors |
330 | f = numpy.empty((len(self.lstack), len(qz)), dtype=numpy.complex) | |
331 | fhkl = numpy.empty(len(self.lstack), dtype=numpy.complex) | |
330 | f = numpy.empty((len(self.lstack), len(qz)), dtype=complex) | |
331 | fhkl = numpy.empty(len(self.lstack), dtype=complex) | |
332 | 332 | for i, l in enumerate(self.lstack): |
333 | 333 | m = l.material |
334 | 334 | fhkl[i] = m.StructureFactor(m.Q(*hkl), en=self.energy) /\ |
336 | 336 | f[i, :] = m.StructureFactorForQ(qv, en0=self.energy) /\ |
337 | 337 | m.lattice.UnitCellVolume() |
338 | 338 | |
339 | E = numpy.zeros(len(qz), dtype=numpy.complex) | |
339 | E = numpy.zeros(len(qz), dtype=complex) | |
340 | 340 | return rel, alphai, alphaf, f, fhkl, E, t |
341 | 341 | |
342 | 342 | def _get_qz(self, qz, alphai, alphaf, chi0, absorption, refraction): |
343 | 343 | k = self.exp.k0 |
344 | q = qz.astype(numpy.complex) | |
344 | q = qz.astype(complex) | |
345 | 345 | if absorption and not refraction: |
346 | 346 | q += 1j * k * numpy.imag(chi0) / \ |
347 | 347 | numpy.sin((alphai + alphaf) / 2) |
398 | 398 | if l.thickness == numpy.inf: |
399 | 399 | E += fhkl[i] * numpy.exp(-1j * z[i] * q) / (1j * q) |
400 | 400 | else: |
401 | E += - fhkl[i] * numpy.exp(-1j * q * z[i]) * \ | |
401 | E += fhkl[i] * numpy.exp(-1j * q * z[i]) * \ | |
402 | 402 | (1 - numpy.exp(1j * q * l.thickness)) / (1j * q) |
403 | 403 | |
404 | 404 | wf = numpy.sqrt(heaviside(ai) * heaviside(af) * rel**2 / |
668 | 668 | # deviation of the incident beam from the kinematical maximum |
669 | 669 | eta = numpy.radians(alphai) - thetaB - asym |
670 | 670 | |
671 | xs = None # avoid linting error in code below | |
671 | 672 | for pol in self.get_polarizations(): |
672 | x = numpy.zeros(len(alphai), dtype=numpy.complex) | |
673 | x = numpy.zeros(len(alphai), dtype=complex) | |
673 | 674 | for i, l in enumerate(self.lstack): |
674 | 675 | beta = (2 * eta * numpy.sin(2 * thetaB) + |
675 | 676 | self.chi0[i] * (1 - gammah / gamma0) - |
770 | 771 | ah[mask] = numpy.arcsin(pp[mask]) |
771 | 772 | |
772 | 773 | nal = len(ai) |
774 | Ps = None # make linter happy | |
773 | 775 | for pol in self.get_polarizations(): |
774 | 776 | if pol == 'S': |
775 | 777 | CC = numpy.ones(nal) |
779 | 781 | if config.VERBOSITY >= config.INFO_ALL: |
780 | 782 | print('XU.DynamicalModel: calc. %s-polarization...' % (pol)) |
781 | 783 | |
782 | M = numpy.zeros((nal, 4, 4), dtype=numpy.complex) | |
784 | M = numpy.zeros((nal, 4, 4), dtype=complex) | |
783 | 785 | for j in range(4): |
784 | 786 | M[:, j, j] = numpy.ones(nal) |
785 | 787 | |
794 | 796 | X = solve_quartic(A4, A3, A2, A1, A0) |
795 | 797 | X = numpy.asarray(X).T |
796 | 798 | |
797 | kz = numpy.zeros((nal, 4), dtype=numpy.complex) | |
799 | kz = numpy.zeros((nal, 4), dtype=complex) | |
798 | 800 | kz[:, :2] = X[numpy.imag(X) <= 0].reshape(nal, 2) |
799 | 801 | kz[:, 2:] = X[numpy.imag(X) > 0].reshape(nal, 2) |
800 | 802 | |
801 | P = numpy.zeros((nal, 4, 4), dtype=numpy.complex) | |
802 | phi = numpy.zeros((nal, 4, 4), dtype=numpy.complex) | |
803 | P = numpy.zeros((nal, 4, 4), dtype=complex) | |
804 | phi = numpy.zeros((nal, 4, 4), dtype=complex) | |
803 | 805 | c = ((Kix**2)[:, numpy.newaxis] + kz**2 - kc[jL]**2) / k**2 /\ |
804 | 806 | self.chimh['S'][jL] / CC[:, numpy.newaxis] |
805 | 807 | if jL > 0: |
827 | 829 | numpy.einsum('...ij,...jk', M, R), phi) |
828 | 830 | Ps = numpy.copy(P) |
829 | 831 | |
830 | B = numpy.zeros((nal, 4, 4), dtype=numpy.complex) | |
832 | B = numpy.zeros((nal, 4, 4), dtype=complex) | |
831 | 833 | B[..., :2] = M[..., :2] |
832 | 834 | B[:, 0, 2] = -numpy.ones(nal) |
833 | 835 | B[:, 1, 3] = -numpy.ones(nal) |
951 | 953 | else: |
952 | 954 | shape = numpy.ones(np) |
953 | 955 | |
954 | ETs = numpy.ones(np, dtype=numpy.complex) | |
955 | ERs = numpy.zeros(np, dtype=numpy.complex) | |
956 | ETs = numpy.ones(np, dtype=complex) | |
957 | ERs = numpy.zeros(np, dtype=complex) | |
956 | 958 | ks = -self.exp.k0 * numpy.sqrt(sai**2 - 2 * cd[0] * rho[0]) |
957 | 959 | |
958 | 960 | for i in range(ns): |
972 | 974 | R = shape * abs(ER / ET)**2 |
973 | 975 | return self.scale_simulation(self.convolute_resolution(lai, R)) |
974 | 976 | |
975 | def densityprofile(self, nz, plot=False): | |
977 | def densityprofile(self, nz, plot=False, individual_layers=False): | |
976 | 978 | """ |
977 | 979 | calculates the electron density of the layerstack from the thickness |
978 | 980 | and roughness of the individual layers |
983 | 985 | number of values on which the profile should be calculated |
984 | 986 | plot : bool, optional |
985 | 987 | flag to tell if a plot of the profile should be created |
988 | individual_layers : bool, optional | |
989 | return the density contributions of all layers as additional return | |
990 | value. | |
986 | 991 | |
987 | 992 | Returns |
988 | 993 | ------- |
990 | 995 | z-coordinates, z = 0 corresponds to the surface |
991 | 996 | eprof : array-like |
992 | 997 | electron profile |
998 | layereprof : 2D array, optional | |
999 | electron profile of every sublayer with shape (nlayer, nz). This | |
1000 | is only returned when individual_layers=True | |
993 | 1001 | """ |
994 | 1002 | if plot: |
995 | 1003 | try: |
1047 | 1055 | sdown = (1 + erf((zdownint - z) / sigint / numpy.sqrt(2))) / 2 |
1048 | 1056 | w[i, :] = sup - sdown |
1049 | 1057 | |
1050 | prof = numpy.sum(dr[:, numpy.newaxis] * w[:, ...], axis=0) | |
1058 | layer_prof = dr[:, numpy.newaxis] * w[:, ...] | |
1059 | prof = numpy.sum(layer_prof, axis=0) | |
1051 | 1060 | |
1052 | 1061 | if plot: |
1053 | 1062 | plt.figure('XU:density_profile', figsize=(5, 3)) |
1063 | for i, layer in enumerate(self.lstack): | |
1064 | plt.plot(z, layer_prof[i, :], ':r', lw=1, label=layer.name) | |
1054 | 1065 | plt.plot(z, prof, '-k', lw=2, label='electron density') |
1055 | 1066 | plt.xlabel(r'z ($\mathrm{\AA}$)') |
1056 | 1067 | plt.ylabel(r'electron density (e$^-$ cm$^{-3}$)') |
1057 | 1068 | plt.tight_layout() |
1058 | 1069 | |
1070 | if individual_layers: | |
1071 | return z, prof, layer_prof | |
1059 | 1072 | return z, prof |
1060 | 1073 | |
1061 | 1074 | |
1343 | 1356 | else: |
1344 | 1357 | shape = numpy.ones(np) |
1345 | 1358 | |
1346 | ETs = numpy.ones(np, dtype=numpy.complex) | |
1347 | ERs = numpy.zeros(np, dtype=numpy.complex) | |
1359 | ETs = numpy.ones(np, dtype=complex) | |
1360 | ERs = numpy.zeros(np, dtype=complex) | |
1348 | 1361 | ks = -self.exp.k0 * numpy.sqrt(sai**2 - 2 * cd[0] * rho[0]) |
1349 | 1362 | |
1350 | 1363 | for i in range(ns): |
1615 | 1628 | k-vector, z-component of k-vector in the material. |
1616 | 1629 | """ |
1617 | 1630 | k0 = -K * numpy.sin(alphai) |
1618 | kz = numpy.zeros((N+1, NqL, Nqz), dtype=numpy.complex) | |
1619 | T = numpy.zeros((N+1, NqL, Nqz), dtype=numpy.complex) | |
1620 | R = numpy.zeros((N+1, NqL, Nqz), dtype=numpy.complex) | |
1631 | kz = numpy.zeros((N+1, NqL, Nqz), dtype=complex) | |
1632 | T = numpy.zeros((N+1, NqL, Nqz), dtype=complex) | |
1633 | R = numpy.zeros((N+1, NqL, Nqz), dtype=complex) | |
1621 | 1634 | for jn in range(N+1): |
1622 | 1635 | kz[jn, ...] = -K * numpy.sqrt(numpy.sin(alphai)**2 - |
1623 | 1636 | 2 * delta[jn]) |
1624 | 1637 | |
1625 | T[N, ...] = numpy.ones((NqL, Nqz), dtype=numpy.complex) | |
1638 | T[N, ...] = numpy.ones((NqL, Nqz), dtype=complex) | |
1626 | 1639 | kzs = kz[N, ...] # kz in substrate |
1627 | 1640 | for jn in range(N-1, -1, -1): |
1628 | 1641 | kzn = kz[jn, ...] |
1681 | 1694 | psi : array-like |
1682 | 1695 | correlation function |
1683 | 1696 | """ |
1684 | psi = numpy.zeros((NqL, Nqz), dtype=numpy.complex) | |
1697 | psi = numpy.zeros((NqL, Nqz), dtype=complex) | |
1685 | 1698 | if H == 0.5 or H == 1: |
1686 | dpsi = numpy.zeros_like(psi, dtype=numpy.complex) | |
1699 | dpsi = numpy.zeros_like(psi, dtype=complex) | |
1687 | 1700 | m = isurf > 0 |
1688 | 1701 | n = 1 |
1689 | 1702 | s = numpy.copy(b) |
1834 | 1847 | T2 = 2 * k02 / (k02 + kz2) |
1835 | 1848 | R01 = (k01 - kz1) / (k01 + kz1) |
1836 | 1849 | R02 = (k02 - kz2) / (k02+kz2) |
1837 | R1 = numpy.zeros((NqL, Nqz), dtype=numpy.complex) | |
1850 | R1 = numpy.zeros((NqL, Nqz), dtype=complex) | |
1838 | 1851 | R2 = numpy.copy(R1) |
1839 | 1852 | nproc = 1 |
1840 | 1853 | else: # method == 2 |
1857 | 1870 | z[jn] = z[jn-1] - thick[jn-1] |
1858 | 1871 | |
1859 | 1872 | # calculation of the deltas |
1860 | delt = numpy.zeros(N+1, dtype=numpy.complex) | |
1873 | delt = numpy.zeros(N+1, dtype=complex) | |
1861 | 1874 | for jn in range(N+1): |
1862 | 1875 | if jn == 0: |
1863 | 1876 | delt[jn] = delta[jn] |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2019-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import math |
18 | 18 |
13 | 13 | # You should have received a copy of the GNU General Public License |
14 | 14 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
15 | 15 | # |
16 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 16 | # Copyright (C) 2015-2017 Marcus H. Mendenhall <marcus.mendenhall@nist.gov> |
17 | # Copyright (C) 2017-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
18 | 18 | |
19 | 19 | # FP_profile was derived from http://dx.doi.org/10.6028/jres.120.014.c |
20 | 20 | |
137 | 137 | ] |
138 | 138 | |
139 | 139 | ft_factors.sort() |
140 | ft_factors = numpy.array(ft_factors, numpy.int) | |
140 | ft_factors = numpy.array(ft_factors, int) | |
141 | 141 | |
142 | 142 | # used for debugging moments from FP_profile.axial_helper(). |
143 | 143 | moment_list = [] |
350 | 350 | b = self.add_buffer # shortcut |
351 | 351 | |
352 | 352 | # a real-format scratch buffer |
353 | self._rb1 = b(numpy.zeros(nn, numpy.float)) | |
353 | self._rb1 = b(numpy.zeros(nn, float)) | |
354 | 354 | # a real-format scratch buffer |
355 | self._rb2 = b(numpy.zeros(nn, numpy.float)) | |
355 | self._rb2 = b(numpy.zeros(nn, float)) | |
356 | 356 | # a real-format scratch buffer |
357 | self._rb3 = b(numpy.zeros(nn, numpy.float)) | |
357 | self._rb3 = b(numpy.zeros(nn, float)) | |
358 | 358 | # a complex-format scratch buffer |
359 | self._cb1 = b(numpy.zeros(nn, numpy.complex)) | |
359 | self._cb1 = b(numpy.zeros(nn, complex)) | |
360 | 360 | # a scratch buffer used by the axial helper |
361 | 361 | self._f0buf = b(numpy.zeros(self.oversampling * |
362 | twotheta_output_points, numpy.float)) | |
362 | twotheta_output_points, float)) | |
363 | 363 | # a scratch buffer used for axial divergence |
364 | 364 | self._epsb2 = b(numpy.zeros(self.oversampling * |
365 | twotheta_output_points, numpy.float)) | |
365 | twotheta_output_points, float)) | |
366 | 366 | # the I2+ buffer |
367 | 367 | self._I2p = b(numpy.zeros(self.oversampling * |
368 | twotheta_output_points, numpy.float)) | |
368 | twotheta_output_points, float)) | |
369 | 369 | # the I2- buffer |
370 | 370 | self._I2m = b(numpy.zeros(self.oversampling * |
371 | twotheta_output_points, numpy.float)) | |
371 | twotheta_output_points, float)) | |
372 | 372 | # another buffer used for axial divergence |
373 | 373 | self._axial = b(numpy.zeros(self.oversampling * |
374 | twotheta_output_points, numpy.float)) | |
374 | twotheta_output_points, float)) | |
375 | 375 | # the largest frequency in Fourier space |
376 | 376 | omega_max = self.n_omega_points * 2 * pi / window_fullwidth |
377 | 377 | # build the x grid and the complex array that is the convolver |
460 | 460 | """ |
461 | 461 | self.param_dicts["conv_" + convolver].update(kwargs) |
462 | 462 | |
463 | def get_conv(self, name, key, format=numpy.float): | |
463 | def get_conv(self, name, key, format=float): | |
464 | 464 | """ |
465 | 465 | get a cached, pre-computed convolver associated with the given |
466 | 466 | parameters, or a newly zeroed convolver if the cache doesn't contain |
1043 | 1043 | if "equatorial_divergence_deg" in kwargs: |
1044 | 1044 | del kwargs["equatorial_divergence_deg"] # not used |
1045 | 1045 | |
1046 | flag, axfn = self.get_conv(me, kwargs, numpy.complex) | |
1046 | flag, axfn = self.get_conv(me, kwargs, complex) | |
1047 | 1047 | if flag: |
1048 | 1048 | return axfn # already up to date if first return is True |
1049 | 1049 | |
1085 | 1085 | # we also need the diffractometer radius from the global space |
1086 | 1086 | kwargs["diffractometer_radius"] = self.param_dicts[ |
1087 | 1087 | "conv_global"]["diffractometer_radius"] |
1088 | flag, tailfn = self.get_conv(me, kwargs, numpy.complex) | |
1088 | flag, tailfn = self.get_conv(me, kwargs, complex) | |
1089 | 1089 | if flag: |
1090 | 1090 | return tailfn # already up to date |
1091 | 1091 | |
1145 | 1145 | """ |
1146 | 1146 | if width is None: |
1147 | 1147 | return # no convolver |
1148 | flag, conv = self.get_conv(name, width, numpy.float) | |
1148 | flag, conv = self.get_conv(name, width, float) | |
1149 | 1149 | if flag: |
1150 | 1150 | return conv # already up to date |
1151 | 1151 | rb1 = self._rb1 |
1240 | 1240 | if hasattr(v, 'tolist'): |
1241 | 1241 | key[k] = v.tolist() |
1242 | 1242 | |
1243 | flag, emiss = self.get_conv(me, key, numpy.complex) | |
1243 | flag, emiss = self.get_conv(me, key, complex) | |
1244 | 1244 | if flag: |
1245 | 1245 | return emiss # already up to date |
1246 | 1246 | |
1302 | 1302 | return None |
1303 | 1303 | twotheta0 = self.param_dicts["conv_global"]["twotheta0"] |
1304 | 1304 | key = (twotheta0, equatorial_divergence_deg) |
1305 | flag, conv = self.get_conv(me, key, numpy.complex) | |
1305 | flag, conv = self.get_conv(me, key, complex) | |
1306 | 1306 | if flag: |
1307 | 1307 | return conv # already up to date |
1308 | 1308 | |
1343 | 1343 | kwargs["diffractometer_radius"] = self.param_dicts[ |
1344 | 1344 | "conv_global"]["diffractometer_radius"] |
1345 | 1345 | |
1346 | flag, conv = self.get_conv(me, kwargs, numpy.complex) | |
1346 | flag, conv = self.get_conv(me, kwargs, complex) | |
1347 | 1347 | if flag: |
1348 | 1348 | return conv # already up to date |
1349 | 1349 | xx = type("data", (), kwargs) # make it dot-notation accessible |
1396 | 1396 | flag, conv = self.get_conv(me, |
1397 | 1397 | (twotheta0, diffractometer_radius, |
1398 | 1398 | specimen_displacement, zero_error_deg), |
1399 | numpy.complex) | |
1399 | complex) | |
1400 | 1400 | if flag: |
1401 | 1401 | return conv # already up to date |
1402 | 1402 | |
1455 | 1455 | return None |
1456 | 1456 | kwargs.update(self.param_dicts["conv_global"]) |
1457 | 1457 | |
1458 | flag, conv = self.get_conv(me, kwargs, numpy.float) | |
1458 | flag, conv = self.get_conv(me, kwargs, float) | |
1459 | 1459 | if flag: |
1460 | 1460 | return conv # already up to date |
1461 | 1461 | |
1506 | 1506 | if not self.gaussian_smoother_bins_sigma: |
1507 | 1507 | return # no smoothing |
1508 | 1508 | flag, buf = self.get_conv(me, self.gaussian_smoother_bins_sigma, |
1509 | format=numpy.float) | |
1509 | format=float) | |
1510 | 1510 | if flag: |
1511 | 1511 | return buf # already computed |
1512 | 1512 | buf[:] = self.omega_vals |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016-2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2017-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import numbers |
18 | 18 | from math import sqrt |
573 | 573 | if exp is not None: |
574 | 574 | ax.plot(twotheta, exp, formatexp, label=labelexp) |
575 | 575 | if mask is None: |
576 | mask = numpy.ones_like(twotheta, dtype=numpy.bool) | |
576 | mask = numpy.ones_like(twotheta, dtype=bool) | |
577 | 577 | if isinstance(sim, PowderModel): |
578 | 578 | simdata = sim.simulate(twotheta[mask]) |
579 | 579 | sim.plot(twotheta[mask], label=labelsim, formatspec=formatsim, ax=ax) |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import collections.abc |
18 | 18 | import copy |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2010-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2010-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | """ |
18 | 18 | xrayutilities utilities contains a conglomeration of useful functions |
11 | 11 | ============= |
12 | 12 | |
13 | 13 | |
14 | [![Build Status](https://dev.azure.com/dominikkriegner/xrayutilities/_apis/build/status/dkriegner.xrayutilities?repoName=dkriegner%2Fxrayutilities&branchName=master)](https://dev.azure.com/dominikkriegner/xrayutilities/_build/latest?definitionId=1&repoName=dkriegner%2Fxrayutilities&branchName=master) | |
14 | [![Build Status](https://dev.azure.com/dominikkriegner/xrayutilities/_apis/build/status/dkriegner.xrayutilities?repoName=dkriegner%2Fxrayutilities&branchName=main)](https://dev.azure.com/dominikkriegner/xrayutilities/_build/) | |
15 | 15 | |
16 | 16 | xrayutilities is a collection of scripts used to analyze and simulate x-ray |
17 | 17 | diffraction data. It consists of a Python package and several routines coded |
215 | 215 | Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) |
216 | 216 | Requires-Python: ~=3.6 |
217 | 217 | Description-Content-Type: text/markdown |
218 | Provides-Extra: fit | |
218 | 219 | Provides-Extra: plot |
219 | Provides-Extra: fit |
1 | 1 | LICENSE.txt |
2 | 2 | MANIFEST.in |
3 | 3 | README.md |
4 | pyproject.toml | |
4 | 5 | setup.py |
5 | 6 | doc/source/conf.py |
6 | 7 | doc/source/example_xu_ccd_parameter.py |
171 | 172 | src/qconversion.c |
172 | 173 | src/qconversion.h |
173 | 174 | src/xrayutilities.h |
174 | tests/__init__.py | |
175 | 175 | tests/test_HXRD.py |
176 | 176 | tests/test_NonCOP.py |
177 | 177 | tests/test_alloy_content_calc.py |
0 | [build-system] | |
1 | requires = ["setuptools", "wheel", "numpy"] | |
2 | build-backend = "setuptools.build_meta" | |
3 | ||
4 | [tool.coverage.paths] | |
5 | source = [ | |
6 | "lib", | |
7 | "*/site-packages" | |
8 | ] | |
9 | ||
10 | [tool.coverage.run] | |
11 | branch = true | |
12 | parallel = true | |
13 | source = [ | |
14 | "xrayutilities" | |
15 | ] | |
16 | ||
17 | [tool.tox] | |
18 | legacy_tox_ini = """ | |
19 | [tox] | |
20 | envlist = py{36,37,38,39},coverage | |
21 | distshare = {toxinidir}/dist | |
22 | ||
23 | [testenv] | |
24 | wheel = true | |
25 | allowlist_externals = | |
26 | mv | |
27 | deps = | |
28 | h5py | |
29 | lmfit | |
30 | matplotlib | |
31 | numpy | |
32 | scipy | |
33 | pytest | |
34 | pytest-cov | |
35 | coverage[toml] | |
36 | commands = | |
37 | pytest --cov --cov-config pyproject.toml --junitxml=.tox/junit.{envname}.xml --cov-report=xml:.tox/coverage.xml | |
38 | mv .coverage .tox/.coverage.{envname} | |
39 | ||
40 | [testenv:coverage] | |
41 | commands = | |
42 | coverage combine .tox/ | |
43 | coverage xml -i -o .tox/coverage.xml | |
44 | coverage report -i | |
45 | mv .coverage .tox/ | |
46 | """ |
184 | 184 | "Development Status :: 5 - Production/Stable", |
185 | 185 | "License :: OSI Approved :: GNU General Public License v2 or later " |
186 | 186 | "(GPLv2+)" |
187 | ], | |
187 | ], | |
188 | 188 | long_description=long_description, |
189 | 189 | long_description_content_type="text/markdown", |
190 | 190 | author_email="eugen.wintersberger@desy.de, dominik.kriegner@gmail.com", |
195 | 195 | package_data={ |
196 | 196 | "xrayutilities": ["VERSION", "*.conf"], |
197 | 197 | "xrayutilities.materials": [os.path.join("data", "*")] |
198 | }, | |
198 | }, | |
199 | 199 | python_requires='~=3.6', |
200 | 200 | setup_requires=['numpy', 'scipy', 'h5py'], |
201 | 201 | install_requires=['numpy>=1.9.2', 'scipy>=0.13.0', 'h5py'], |
202 | 202 | extras_require={ |
203 | 203 | 'plot': ["matplotlib>=3.1.0"], |
204 | 204 | 'fit': ["lmfit>=1.0.1"], |
205 | }, | |
205 | }, | |
206 | 206 | include_dirs=[numpy.get_include()], |
207 | 207 | ext_modules=[extmodul], |
208 | 208 | cmdclass=cmdclass, |
209 | 209 | url="https://xrayutilities.sourceforge.io", |
210 | 210 | license="GPLv2", |
211 | 211 | script_args=args |
212 | ) | |
212 | ) |
13 | 13 | * You should have received a copy of the GNU General Public License |
14 | 14 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
15 | 15 | * |
16 | * Copyright (C) 2010-2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | * Copyright (C) 2010-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /* ###################################### |
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | INLINE void tensorprod(double *RESTRICT v1, double *RESTRICT v2, | |
134 | INLINE void tensorprod(double *v1, double *v2, | |
135 | 135 | double *RESTRICT m) { |
136 | 136 | unsigned int i, j; |
137 | 137 | for (i = 0; i < 3; i = i + 1) { |
13 | 13 | * You should have received a copy of the GNU General Public License |
14 | 14 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
15 | 15 | * |
16 | * Copyright (C) 2013-2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | * Copyright (C) 2013-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
17 | 17 | */ |
18 | 18 | #pragma once |
19 | 19 | |
63 | 63 | INLINE void matvec(double *RESTRICT m, double *RESTRICT v, |
64 | 64 | double *RESTRICT r); |
65 | 65 | |
66 | INLINE void tensorprod(double *RESTRICT v1, double *RESTRICT v2, | |
66 | INLINE void tensorprod(double *v1, double *v2, | |
67 | 67 | double *RESTRICT m); |
68 | 68 | |
69 | 69 | INLINE void summat(double *RESTRICT m1, double *RESTRICT m2); |
0 | # This file is part of xrayutilities. | |
1 | # | |
2 | # xrayutilities is free software; you can redistribute it and/or modify | |
3 | # it under the terms of the GNU General Public License as published by | |
4 | # the Free Software Foundation; either version 2 of the License, or | |
5 | # (at your option) any later version. | |
6 | # | |
7 | # This program is distributed in the hope that it will be useful, | |
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | # GNU General Public License for more details. | |
11 | # | |
12 | # You should have received a copy of the GNU General Public License | |
13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. | |
14 | # | |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # 2016 Eugen Wintersberger <eugen.wintersberger@desy.de> |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2018 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2018-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import math |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2019-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os |
18 | 18 | import subprocess |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014-2018 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015,2018 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import tempfile |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2019-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import math |
18 | 18 | import os.path |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015-2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2017-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import math |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os.path |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2018-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os |
18 | 18 | import tempfile |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import math |
18 | 18 | import os |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2012-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2016-2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2016-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import math |
18 | 18 | import unittest |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014-2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014-2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014-2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2013-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2014 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2014-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2019-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2019-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | # | |
17 | ||
16 | 18 | |
17 | 19 | import unittest |
18 | 20 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2017 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2017-2021 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import os |
18 | 18 | import unittest |
139 | 139 | |
140 | 140 | |
141 | 141 | if __name__ == '__main__': |
142 | freeze_support() | |
142 | freeze_support() # required for MS Windows | |
143 | 143 | unittest.main() |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2018 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2018-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2019 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2019-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |
12 | 12 | # You should have received a copy of the GNU General Public License |
13 | 13 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
14 | 14 | # |
15 | # Copyright (C) 2015 Dominik Kriegner <dominik.kriegner@gmail.com> | |
15 | # Copyright (C) 2015-2020 Dominik Kriegner <dominik.kriegner@gmail.com> | |
16 | 16 | |
17 | 17 | import unittest |
18 | 18 |