diff --git a/README.rst b/README.rst index 797534a9e..b4c7ee02c 100644 --- a/README.rst +++ b/README.rst @@ -38,7 +38,7 @@ Under UNIX, you may have to run the command via *sudo* to gain root access an perform a system wide installation. The latest release of pyFAI can be downloaded from -`Github `_ . +`Github `_ . Presently the source code has been distributed as a zip package. Download it one and unpack it:: diff --git a/build-deb7.sh b/build-deb7.sh index a1d1eaf01..d1df71a39 100755 --- a/build-deb7.sh +++ b/build-deb7.sh @@ -1,7 +1,7 @@ #!/bin/sh # # Project: Azimuthal integration -# https://github.com/pyFAI/pyFAI +# https://github.com/silx-kit/pyFAI # # Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France # diff --git a/build-deb8.sh b/build-deb8.sh index 72c678480..3f5ab4fe5 100755 --- a/build-deb8.sh +++ b/build-deb8.sh @@ -1,7 +1,7 @@ #!/bin/sh # # Project: Azimuthal integration -# https://github.com/pyFAI/pyFAI +# https://github.com/silx-kit/pyFAI # # Copyright (C) 2015-2016 European Synchrotron Radiation Facility, Grenoble, France # diff --git a/doc/MX-calibrate.1 b/doc/MX-calibrate.1 index ceff90e43..1b846d5b2 100644 --- a/doc/MX-calibrate.1 +++ b/doc/MX-calibrate.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.4. -.TH MX-CALIBRATE "1" "June 2016" "PyFAI" "User Commands" +.TH MX-CALIBRATE "1" "December 2016" "PyFAI" "User Commands" .SH NAME MX-calibrate \- Validate detector position for MX beamlines .SH DESCRIPTION diff --git a/doc/MX-calibrate.pdf b/doc/MX-calibrate.pdf index 497a18268..09bd4e103 100644 Binary files a/doc/MX-calibrate.pdf and b/doc/MX-calibrate.pdf differ diff --git a/doc/build/_images/PONI.png b/doc/build/_images/PONI.png index a034e60de..39204b8ae 100644 Binary files a/doc/build/_images/PONI.png and b/doc/build/_images/PONI.png differ diff --git a/doc/build/_images/output_12_1.png b/doc/build/_images/output_12_1.png index 5c1490f36..28c78f8a9 100644 Binary files a/doc/build/_images/output_12_1.png and b/doc/build/_images/output_12_1.png differ diff --git a/doc/build/_images/output_13_1.png b/doc/build/_images/output_13_1.png index 6087c6671..e06e9035e 100644 Binary files a/doc/build/_images/output_13_1.png and b/doc/build/_images/output_13_1.png differ diff --git a/doc/build/_images/output_14_1.png b/doc/build/_images/output_14_1.png index 197506b02..214fa057e 100644 Binary files a/doc/build/_images/output_14_1.png and b/doc/build/_images/output_14_1.png differ diff --git a/doc/build/_images/output_18_1.png b/doc/build/_images/output_18_1.png index 9b24b51e4..fc8fc06f4 100644 Binary files a/doc/build/_images/output_18_1.png and b/doc/build/_images/output_18_1.png differ diff --git a/doc/build/_images/output_21_1.png b/doc/build/_images/output_21_1.png index 8a70a826a..2742f9e55 100644 Binary files a/doc/build/_images/output_21_1.png and b/doc/build/_images/output_21_1.png differ diff --git a/doc/build/_images/output_24_1.png b/doc/build/_images/output_24_1.png index 9aa78033e..ba12c830b 100644 Binary files a/doc/build/_images/output_24_1.png and b/doc/build/_images/output_24_1.png differ diff --git a/doc/build/_images/output_29_1.png b/doc/build/_images/output_29_1.png index 153702acd..815487a90 100644 Binary files a/doc/build/_images/output_29_1.png and b/doc/build/_images/output_29_1.png differ diff --git a/doc/build/_images/output_39_1.png b/doc/build/_images/output_39_1.png index c7f0cb42e..45a52e2bf 100644 Binary files a/doc/build/_images/output_39_1.png and b/doc/build/_images/output_39_1.png differ diff --git a/doc/build/_images/output_45_1.png b/doc/build/_images/output_45_1.png index b9e3c389a..2aeb932b0 100644 Binary files a/doc/build/_images/output_45_1.png and b/doc/build/_images/output_45_1.png differ diff --git a/doc/build/_images/output_48_1.png b/doc/build/_images/output_48_1.png index 98603642c..7c0772720 100644 Binary files a/doc/build/_images/output_48_1.png and b/doc/build/_images/output_48_1.png differ diff --git a/doc/build/_images/output_4_1.png b/doc/build/_images/output_4_1.png index bcd3b8483..435f15891 100644 Binary files a/doc/build/_images/output_4_1.png and b/doc/build/_images/output_4_1.png differ diff --git a/doc/build/_images/output_50_1.png b/doc/build/_images/output_50_1.png index 5ffb4c3d5..5eb779c3e 100644 Binary files a/doc/build/_images/output_50_1.png and b/doc/build/_images/output_50_1.png differ diff --git a/doc/build/_images/output_5_1.png b/doc/build/_images/output_5_1.png index c69996853..0d66c2eb6 100644 Binary files a/doc/build/_images/output_5_1.png and b/doc/build/_images/output_5_1.png differ diff --git a/doc/build/_images/output_6_1.png b/doc/build/_images/output_6_1.png index 86c1da153..9c2cb2f06 100644 Binary files a/doc/build/_images/output_6_1.png and b/doc/build/_images/output_6_1.png differ diff --git a/doc/build/_images/output_6_11.png b/doc/build/_images/output_6_11.png index 58174a6d5..67fef890b 100644 Binary files a/doc/build/_images/output_6_11.png and b/doc/build/_images/output_6_11.png differ diff --git a/doc/build/_images/output_8_1.png b/doc/build/_images/output_8_1.png index 71368b9a1..bd6b2f3f4 100644 Binary files a/doc/build/_images/output_8_1.png and b/doc/build/_images/output_8_1.png differ diff --git a/doc/build/_sources/api/modules.txt b/doc/build/_sources/api/modules.txt index e5f059c50..f8357f997 100644 --- a/doc/build/_sources/api/modules.txt +++ b/doc/build/_sources/api/modules.txt @@ -1,12 +1,15 @@ pyFAI API ========= -This chapter describes the programming interface of pyFAI, so what you can expect after having launched ipython and typed: -.. +This chapter describes the programming interface of pyFAI, so what you can +expect after having launched *Jupyter notebook* (or ipython) and typed: + +.. code-block:: python import pyFAI -The most important class is AzimuthalIntegrator which is an object containing both the geometry (it inherits from Geometry, another class) +The most important class is AzimuthalIntegrator which is an object containing +both the geometry (it inherits from Geometry, another class) and exposes important methods (functions) like integrate1d and integrate2d. .. toctree:: diff --git a/doc/build/_sources/api/pyFAI.txt b/doc/build/_sources/api/pyFAI.txt index 66aa6bd93..08b7a84ea 100644 --- a/doc/build/_sources/api/pyFAI.txt +++ b/doc/build/_sources/api/pyFAI.txt @@ -7,6 +7,14 @@ :undoc-members: :show-inheritance: +:mod:`average` Module +--------------------- + +.. automodule:: pyFAI.average + :members: + :undoc-members: + :show-inheritance: + :mod:`azimuthalIntegrator` Module --------------------------------- @@ -15,6 +23,15 @@ :undoc-members: :show-inheritance: +:mod:`multi_geometry` Module +---------------------------- + +.. automodule:: pyFAI.multi_geometry + :members: + :undoc-members: + :show-inheritance: + + :mod:`integrate_widget` Module ------------------------------ @@ -86,7 +103,7 @@ :members: :undoc-members: :show-inheritance: - + :mod:`ocl_azim_csr_dis` Module ------------------------------ @@ -95,15 +112,6 @@ :undoc-members: :show-inheritance: - -:mod:`worker` Module --------------------- - -.. automodule:: pyFAI.worker - :members: - :undoc-members: - :show-inheritance: - :mod:`io` Module ---------------- @@ -185,11 +193,177 @@ :undoc-members: :show-inheritance: -:mod:`gui.utils` Module ------------------------ +:mod:`gui.gui_utils` Module +--------------------------- .. automodule:: pyFAI.gui.utils :members: :undoc-members: :show-inheritance: - \ No newline at end of file + +:mod:`ext.bilinear` Module +-------------------------- + +This extension makes a discrete 2D-array appear like a continuous function thanks +to bilinear interpolations. + +.. automodule:: pyFAI.ext.bilinear + :members: + :undoc-members: + :show-inheritance: + + +:mod:`ext._bispev` Module +------------------------- + +This extension is a re-implementation of bi-cubic spline evaluation from scipy + +.. automodule:: pyFAI.ext._bispev + :members: + :undoc-members: + :show-inheritance: + + +:mod:`ext._blob` Module +----------------------- + +Blob detection is used to find peaks in images by performing subsequent blurs + +.. automodule:: pyFAI.ext._blob + :members: + :undoc-members: + :show-inheritance: + +:mod:`ext.container` Module +--------------------------- + +Container are a new uniform storage, optimized for the creation of both LUT and CSR. +It has nothing to do with Docker. + +.. automodule:: pyFAI.ext.container + :members: + :undoc-members: + :show-inheritance: + + +:mod:`ext._convolution` Module +------------------------------ + +Convolutions in real space are used to blurs images, used in blob-detection algorithm + +.. automodule:: pyFAI.ext._convolution + :members: + :undoc-members: + :show-inheritance: + +:mod:`ext._distortion` Module +----------------------------- + +Distortion correction are correction are applied by Look-up table (or CSR) + +.. automodule:: pyFAI.ext._distortion + :members: + :undoc-members: + :show-inheritance: + +:mod:`ext._geometry` Module +--------------------------- + +This extension is a fast-implementation for calculating the geometry, i.e. where +every pixel of an array stays in space (x,y,z) or its (r, \chi) coordinates. + +.. automodule:: pyFAI.ext._geometry + :members: + :undoc-members: + :show-inheritance: + +:mod:`ext.histogram` Module +--------------------------- + +Re-implementation of the numpy.histogram, optimized for azimuthal integration. +Deprecated, will be replaced by silx.math.histogramnd + +.. automodule:: pyFAI.ext.histogram + :members: + :undoc-members: + :show-inheritance: + +:mod:`ext.marchingsquares` Module +--------------------------------- + +The marchingsquares algorithm is used for calculating an iso-contour curve (displayed +on the screen while calibrating) but also to seed the points for the "massif" algoritm +during recalib. + +.. automodule:: pyFAI.ext.marchingsquares + :members: + :undoc-members: + :show-inheritance: + +:mod:`ext.morphology` Module +---------------------------- + +The morphology extension provides a couple of binary morphology operations on images. +They are also implemented in scipy.ndimage in the general case, but not as fast. + +.. automodule:: pyFAI.ext.morphology + :members: + :undoc-members: + :show-inheritance: + + +:mod:`ext.reconstruct` Module +----------------------------- + +Very simple inpainting module for reconstructing the missing part of an image (masked) +to be able to use more common algorithms. + +.. automodule:: pyFAI.ext.reconstruct + :members: + :undoc-members: + :show-inheritance: + +:mod:`ext.relabel` Module +------------------------- + +Relabel regions, used to flag from largest regions to the smallest + +.. automodule:: pyFAI.ext.relabel + :members: + :undoc-members: + :show-inheritance: + + +:mod:`ext.preproc` Module +------------------------- + +Contains a preprocessing function in charge of the dark-current subtraction, +flat-field normalization, ... taking care of masked values and normalization. + +.. automodule:: pyFAI.ext.preproc + :members: + :undoc-members: + :show-inheritance: + + +:mod:`ext._tree` Module +----------------------- + +The tree is used in file hierarchy tree for the diff_map graphical user interface. + +.. automodule:: pyFAI.ext._tree + :members: + :undoc-members: + :show-inheritance: + +:mod:`ext.watershed` Module +--------------------------- + +Peak peaking via inverse watershed for connecting region of high intensity + +.. automodule:: pyFAI.ext.watershed + :members: + :undoc-members: + :show-inheritance: + + \ No newline at end of file diff --git a/doc/build/_sources/calibration.txt b/doc/build/_sources/calibration.txt index c160b89d6..e3c47e735 100644 --- a/doc/build/_sources/calibration.txt +++ b/doc/build/_sources/calibration.txt @@ -1,7 +1,7 @@ :Author: Jérôme Kieffer -:Date: 31/05/2016 +:Date: 01/12/2016 :Keywords: generic description of the calibration procedure -:Target: General audiance +:Target: General audience The determination of the geometry of the experimental setup for the diffraction pattern of a reference sample is called calibration in pyFAI. @@ -28,7 +28,8 @@ easier to perform a calibration, using the Debye-Sherrer rings of a reference sample called calibrant. About 30 calibrants are provided by pyFAI like :math:`LaB_6`, ceria :math:`CeO_2`, silicon, corrundum or silver behenate. -Among other simple compound, all of the NIST `Standard Reference Materials `_ +Among other simple compound, all of the NIST +`Standard Reference Materials `_ have been are tabulated and are directly available as calibrant. One can alternatively provide its own calibrant description files which is a simple text-file containing the largest d-spacing (in Angstrom) for a set of @@ -42,18 +43,30 @@ Pre-processing of images: ------------------------- The typical pre-processing consists of the averaging (or better median filtering) of darks images. Dark current images are then subtracted from data and corrected for flat. +The pre-processing is best performed using the *pyFAI-average* tool, which documentation +is available in the :ref:`manpage`. If saturated pixels exists, the are likely to be treated like peaks but their positions will be wrong. It is advised to either mask them out or to desaturate them (pyFAI provides an option, but it is expensive in calculation time). +A Mask drawing tool, called *pyFAI-drawmask*, is installed together with pyFAI and +its documentation available in the :ref:`manpage`. + +To start the calibration the *pyFAI-calib* tool will need: + +* an image with Debye-Sherrer rings +* the energy or the wavelength +* the calibrant name or the d-spacing file of the calibrant +* the detector description. Peak-picking ------------ - +Once started, *pyFAI-calib* will ask you to select rings. The Peak-picking consists in the identification of peaks and groups of peaks -belonging to same ring. It can be performed by 4 methods described hereafter. +belonging to same ring. +It can be performed by 4 methods described hereafter. Massif detection ................ @@ -97,7 +110,8 @@ Refinement of the parameters ---------------------------- After selecting groups of peaks, each of them is assigned to a Debye-Scherrer ring number -and associated to a d-spacing value hence a theoritcal 2\theta value. +(0-based numbering in python) +and associated to a d-spacing value hence a theoretical 2\theta value. A supervised least-squares refinement, performed on the difference of peak position's 2-theta values versus the expected ones from calibrant provides the 6-geometry parameters fitted. @@ -120,7 +134,7 @@ of the scattering image. The average error per control point (delta 2\theta error in radian) is printed out and offers a quantitative measurement of the relative quality of the fit for similar setups/experiment. -Neverthless its absolute value has no meaning, except the lower, the better. +Nevertheless its absolute value has no meaning, except the lower, the better. Subsequently, pyFAI offers some validation options in to check the quality of the fit. some of them global, some of them limited to given rings. diff --git a/doc/build/_sources/changelog.txt b/doc/build/_sources/changelog.txt index e3d697bb8..cd3dad95f 100644 --- a/doc/build/_sources/changelog.txt +++ b/doc/build/_sources/changelog.txt @@ -1,12 +1,47 @@ :Author: Jérôme Kieffer -:Date: 02/06/2015 +:Date: 06/06/2016 :Keywords: changelog ChangeLog of Versions ===================== -0.12.0: 06/2016 ---------------- +0.13.0: 01/12/2016 +------------------ +* Global improvement of tests, packaging, code quality, documentation and project tools +* Scripts + - Add support for multiframe formats on pyFAI-average + - Add support for monitoring correction from header file (on pyFAI-average) + - Add progressbar in the shell (on pyFAI-average and pyFAI-integrate) + - Script drawMask_pymca is renamed into pyFAI-drawmask + - Rework of the drawmask GUI using silx + - pyFAI-drawmask do not have anymore hard dependency on PyMCA + - pyFAI-integrate can now be used without qt dependency (--no-gui) + - Fix the script to support both Python 2 and 3 (pyFAI-calib, pyFAI-benchmark) + - Fix selection of units on diff-map (the user selection was not propagated) +* For users + - More source code in MIT license + - Update name and specification for cameras + - Add cameras: Eiger500k, RaspberryPi5M, RaspberryPi8M + - Fix Xpad S540 flat detector geometry + - Fix definition of CeO2 calibrant + - Add mask and flat on multi-geometry + - Fix solid angle of the multi-geometry + - Fix geometry processing for custom output space + - Fix normalization factor and variance + - Add support for Qt5 + - Add support for Debian 9 packaging +* For developers + - Create common preprocessing for distortion correction + - Create common image preprocessing using Cython (NaN filter, flatfield, dark, polarisation) + - Refactoring of units module. It allows to register custom units. + - Worker can now use Writer + - Worker polarization argument is renamed into polarization_factor + - Remove the dependency from python-fftw3, use numpy instead + - Remove QtWebKit dependency + - Fix un-correction of images using sparse matrix from scipy + +0.12.0: 06/06/2016 +------------------ * Continuous integration on linux, windows using Python 2.7 and 3.4+ * Drop support of Python 2.6, 3.2, 3.3 and debian6 packaging * New radial output units: Reciprocal spacing squared and log(q) **ID02** @@ -19,7 +54,7 @@ ChangeLog of Versions * Compatibility with the copy module (copy.deepcopy) for azimuthal integrator **ID02** * Distortion correction works also for non-contiguous detectors * Update documentation and provide advanced tutorials: - - Introdution to pyFAI using the juyter notebook + - Introduction to pyFAI using the jupyter notebook - detector calibration **ID15, BM02** - Correction of detector distortion, examples of pixel detectors. - calibrant calculation **ID30** diff --git a/doc/build/_sources/coverage.txt b/doc/build/_sources/coverage.txt index ace5c8ec6..4263ef8b7 100644 --- a/doc/build/_sources/coverage.txt +++ b/doc/build/_sources/coverage.txt @@ -1,38 +1,46 @@ Test coverage report for pyFAI ============================== -Measured on *pyFAI* version 0.12.0, 06/06/2016 +Measured on *pyFAI* version 0.13.0, 01/12/2016 .. csv-table:: Test suite coverage :header: "Name", "Stmts", "Exec", "Cover" :widths: 35, 8, 8, 8 - "pyFAI/__init__", "35", "20", "57.1 %" - "pyFAI/_version", "34", "32", "94.1 %" - "pyFAI/azimuthalIntegrator", "1258", "909", "72.3 %" - "pyFAI/blob_detection", "517", "196", "37.9 %" - "pyFAI/calibrant", "338", "244", "72.2 %" - "pyFAI/decorators", "33", "33", "100.0 %" - "pyFAI/detectors", "1314", "1028", "78.2 %" - "pyFAI/directories", "33", "20", "60.6 %" - "pyFAI/distortion", "544", "162", "29.8 %" - "pyFAI/ext/__init__", "0", "0", "0.0 %" - "pyFAI/geometry", "961", "761", "79.2 %" - "pyFAI/geometryRefinement", "481", "174", "36.2 %" - "pyFAI/gui/utils", "69", "33", "47.8 %" - "pyFAI/integrate_widget", "493", "273", "55.4 %" - "pyFAI/io", "465", "250", "53.8 %" - "pyFAI/massif", "201", "132", "65.7 %" - "pyFAI/multi_geometry", "75", "65", "86.7 %" - "pyFAI/ocl_azim", "269", "191", "71.0 %" - "pyFAI/ocl_azim_csr", "240", "184", "76.7 %" - "pyFAI/ocl_azim_lut", "230", "177", "77.0 %" - "pyFAI/ocl_sort", "177", "136", "76.8 %" - "pyFAI/opencl", "204", "144", "70.6 %" - "pyFAI/peak_picker", "756", "195", "25.8 %" - "pyFAI/spline", "432", "165", "38.2 %" - "pyFAI/units", "70", "65", "92.9 %" - "pyFAI/utils", "778", "431", "55.4 %" - "pyFAI/worker", "340", "131", "38.5 %" + "__init__.py", "35", "20", "57.1 %" + "_version.py", "41", "39", "95.1 %" + "average.py", "526", "389", "74.0 %" + "azimuthalIntegrator.py", "1207", "926", "76.7 %" + "blob_detection.py", "504", "194", "38.5 %" + "calibrant.py", "338", "244", "72.2 %" + "containers.py", "79", "72", "91.1 %" + "decorators.py", "33", "23", "69.7 %" + "detectors.py", "1336", "1050", "78.6 %" + "directories.py", "34", "21", "61.8 %" + "distortion.py", "557", "166", "29.8 %" + "ext/__init__.py", "0", "0", "0.0 %" + "geometry.py", "959", "759", "79.1 %" + "geometryRefinement.py", "485", "176", "36.3 %" + "gui/__init__.py", "4", "4", "100.0 %" + "gui/matplotlib.py", "24", "17", "70.8 %" + "gui/qt.py", "100", "36", "36.0 %" + "gui/utils.py", "34", "14", "41.2 %" + "integrate_widget.py", "453", "268", "59.2 %" + "io.py", "579", "294", "50.8 %" + "massif.py", "201", "132", "65.7 %" + "multi_geometry.py", "128", "94", "73.4 %" + "ocl_azim.py", "269", "191", "71.0 %" + "ocl_azim_csr.py", "240", "184", "76.7 %" + "ocl_azim_lut.py", "231", "177", "76.6 %" + "ocl_sort.py", "177", "136", "76.8 %" + "opencl.py", "206", "146", "70.9 %" + "peak_picker.py", "758", "197", "26.0 %" + "spline.py", "432", "165", "38.2 %" + "units.py", "80", "76", "95.0 %" + "utils/__init__.py", "467", "290", "62.1 %" + "utils/bayes.py", "92", "60", "65.2 %" + "utils/shell.py", "44", "41", "93.2 %" + "utils/stringutil.py", "25", "24", "96.0 %" + "worker.py", "358", "140", "39.1 %" - "pyFAI total", "10347", "6151", "59.4 %" + "pyFAI total", "11036", "6765", "61.3 %" diff --git a/doc/build/_sources/design/ai.txt b/doc/build/_sources/design/ai.txt index 6cdf67706..123073d2e 100644 --- a/doc/build/_sources/design/ai.txt +++ b/doc/build/_sources/design/ai.txt @@ -40,6 +40,7 @@ external developers/users. It is usually instantiated via a function of the module to load a poni-file: .. code-block:: python + >>> import pyFAI >>> ai = pyFAI.load("Pilatus1M.poni") >>> print(ai) @@ -149,6 +150,6 @@ The main issue with pixel splitting arose from 2D integration and the habdling o References: ----------- -:: _integrate: http://pythonhosted.org/pyFAI/api/pyFAI.html#pyFAI.azimuthalIntegrator.AzimuthalIntegrator.integrate1d +.. _integrate: http://pythonhosted.org/pyFAI/api/pyFAI.html#pyFAI.azimuthalIntegrator.AzimuthalIntegrator.integrate1d -:: _CSR: http://en.wikipedia.org/wiki/Sparse_matrix \ No newline at end of file +.. _CSR: http://en.wikipedia.org/wiki/Sparse_matrix \ No newline at end of file diff --git a/doc/build/_sources/detector.txt b/doc/build/_sources/detector.txt index 189abdaf5..7b0b7a1d0 100644 --- a/doc/build/_sources/detector.txt +++ b/doc/build/_sources/detector.txt @@ -1,7 +1,8 @@ :Author: Jérôme Kieffer -:Date: 31/05/2016 +:Date: 01/12/2016 :Keywords: detector -:Target: General audiance +:Target: General audience + Simple detector =============== @@ -10,7 +11,8 @@ Like most other diffraction processing packages, pyFAI allows the definition of Typical pixel size are 50e-6 m (50 microns) and will be used as example in the numerical application. -Pixels of the detector are indexed from the *origin* located at the **lower left corner**. +Pixels of the detector are indexed from the *origin* located at the +**lower left corner** when looking from the sample. The pixel's center is located at half integer index: * pixel 0 goes from position 0 m to 50e-6m and is centered at 25e-6 m. @@ -18,7 +20,7 @@ The pixel's center is located at half integer index: **Nota**: Most of the time you will need to pass the optional argument *origin="lower"* to -matplotlib imshow function when displaying the image to avoid confusion +matplotlib's *imshow* function when displaying the image to avoid confusion. Complex detectors ================= @@ -37,23 +39,23 @@ for small spatial displacements, often called geometric distortion. This is why detectors need more complex definitions than just that of a pixel size. To avoid complicated and error-prone sets of parameters, two tools have been introduced: -either *detector* classes define programatically detector or Nexus saved detector setup. +either *detector* classes define programmatically detector or Nexus saved detector setup. Detectors classes ----------------- They are used to define families of detectors. In order to take the specificities of each detector into account, pyFAI -contains about 55 detector class definitions (and twice a much with aliases) +contains about 58 detector class definitions (and 168 with aliases) which contain a mask (invalid pixels, gaps, ...) and a method to calculate the pixel positions in Cartesian coordinates. Available detectors can be printed using: .. code-block:: python - import pyFAI - print(pyFAI.detectors.ALL_DETECTORS) + >>> import pyFAI + >>> print(pyFAI.detectors.ALL_DETECTORS) -For optically coupled CCD detectors, the geometrical distortion is often +For optically coupled CCD detectors, the geometric distortion is often described by a bi-dimensional cubic spline which can be imported into the detector instance and be used to calculate the actual pixel position in space. @@ -75,7 +77,7 @@ can address some of the most complex detector layouts: * hexagonal pixels (i.e. Pixirad detectors, still under development) * curved/bent imaging plates (i.e. Rigaku, Aarhus detector) * pixel detectors with tiled modular (i.e. Xpad detectors from ImXpad) -* semi-cylindrical pixel detectors (i.e. Pilatus12M from Dectris). +* semi-cylindrical pixel detectors (i.e. Pilatus12M from Dectris or CirPad from Soleil). The detector instance can be saved as HDF5, either programmatically, either on the command line. @@ -91,7 +93,9 @@ Using the *detector2nexus* script to convert a complex detector definition (multiple modules, possibly in 3D) into a single NeXus detector definition together with the mask: - detector2nexus -s halfccd.spline -o halfccd.h5 +.. code-block:: bash + + detector2nexus -s halfccd.spline -o halfccd.h5 Conclusion ========== @@ -100,9 +104,9 @@ Detector definition in pyFAI is very versatile. Fortunately, most detectors are already described, making the usage transparent for most users. There are a couple of :ref:`tutorials` on detector definition which will help -you understanding the mechanisme : +you understanding the underlying mechanism: -* Distortion which explains how to correct images for geometric distortion -* CCD-calibration which explains how to calibrate a detector for geometric +* **Distortion** which explains how to correct images for geometric distortion +* **CCD-calibration** which explains how to calibrate such detectors for geometric distortion. diff --git a/doc/build/_sources/ecosystem.txt b/doc/build/_sources/ecosystem.txt index 10bd14c93..b7b81eec3 100644 --- a/doc/build/_sources/ecosystem.txt +++ b/doc/build/_sources/ecosystem.txt @@ -1,5 +1,5 @@ :Author: Jérôme Kieffer -:Date: 31/05/2015 +:Date: 07/09/2016 :Keywords: Other software related to pyFAI PyFAI Ecosystem @@ -148,6 +148,28 @@ of model SAXS intensities. Developed at CEA Saclay by O. Taché and available on `PyPI `_. +Xi-cam +...... +`Xi-cam `_ is developed by Ronald +Pandolfi, Dinesh Kumar, Singanallur Venkatakrishnan and Alexander Hexemer at ALS. + + +Xi-cam aims to provide a community driven platform for multimodal analysis +in synchrotron science. The platform core provides a robust plugin +infrastructure for extensibility, allowing continuing development to simply +add further functionality. Current modules include tools for +characterization with (GI)SAXS, Tomography, and XAS. This will continue to +serve as a development base as algorithms for multimodal analysis develop. + +Seamless remote data access, visualization and analysis are key elements of +Xi-CAM, and will become critical to synchrotron data infrastructure as +expectations for future data volume and acquisition rates rise with +continuously increasing throughputs. The highly interactive design elements +of Xi-cam will similarly support a generation of users which depend on +immediate data quality feedback during high-throughput or burst acquisition +modes. + + xPDFsuite ......... diff --git a/doc/build/_sources/geometry.txt b/doc/build/_sources/geometry.txt index e916c8791..5e8e9e912 100644 --- a/doc/build/_sources/geometry.txt +++ b/doc/build/_sources/geometry.txt @@ -1,7 +1,7 @@ :Author: Jérôme Kieffer -:Date: 31/05/2016 +:Date: 01/12/2016 :Keywords: generic description of the geometry -:Target: General audiance +:Target: General audience PyFAI uses a 6-parameter geometry definition similar, while not rigorously identical to SPD: @@ -50,7 +50,8 @@ Position of the observer There are two (main) conventions when representing images: -* In imaging application, one can can replace the camera by the eye, the camera looks at the scene. In this convention, the origin is usually at the top of the image. +* In imaging application, one can can replace the camera by the eye, the camera + looks at the scene. In this convention, the origin is usually at the top of the image. * In diffraction application, the observer is situated at the sample position and looks at the detector, hence on the other side of the detector. @@ -61,16 +62,19 @@ Changing the point of view behind the detector changes the sign of the azimuthal Default geometry in pyFAI ------------------------- -In the (most common) case of *transmission diffraction setup* on synchrotrons (like ESRF, Soleil, Petra3, SLS...) this makes looks like: +In the (most common) case of *transmission diffraction setup* on synchrotrons +(like ESRF, Soleil, Petra3, SLS...) this makes looks like: * Observer looking at the detector from the sample position: * Origin at the lower left of the detector * Axis 1 (i.e. *y*) being vertical, pointing upwards * Axis 2 (i.e. *x*) being horizontal, pointing to the center of the storage ring -* Axis 3 (i.e. *z*) being horizontal, along the transmitted beam +* Axis 3 (i.e. *z*) being horizontal, along the incident beam -Axis 3 is built in such a way to be orthogonal and (1,2,3) is a direct orientation. -This makes the sample position negative (at z<0). +Axis 3 is built in such a way to be orthogonal to the plane (1,2). +Due to constraints on the origin and orientation of the azimuthal angle, chi, +(1, 2, 3) is indirect orientation. +This makes usually the PONI position with negative third coordiante (at z<0). Detector position @@ -93,16 +97,23 @@ the detector surface called PONI (for Point Of Normal Incidence). For non planar detectors, the PONI is defined in the plan z=0 in detector's coordinate system. -Poni1 and Poni2 are distances in meter (along the *y* and *x* axis of the detector), +*Poni1* and *Poni2* are distances in meter (along the *y* and *x* axis of the detector), like the sample-detector distance, letting the calibration parameters be independent of the pixel size hence stable regarding the binning factor of the detector. -In the same idea rot1, rot2 and rot3 are rotation along axis 1, 2 and 3, always expressed in radians. +In the same idea *rot1*, *rot2* and *rot3* are rotation along axis 1, 2 and 3, +always expressed in radians. Rotations applied in the same order: *rot1* then *rot2* and finally *rot3*. -Due to the axial symmetry of the Debye-Scherrer cones, *rot3* cannot be optimized but can be adjusted manually in some cases like if -the detector is not mounted horizontally and/or one cares about polarization correction. +Due to the axial symmetry of the Debye-Scherrer cones, *rot3* cannot be optimized +but can be adjusted manually in some cases like if +the detector is not mounted horizontally and/or one cares about polarization +correction. When all rotations are zero, the detector is in transmission mode with the incident beam orthogonal to the detector's surface. +There is also a tutorial :ref:`tutorials` on the geometry which explains in detail +the orientations of the different rotations used by pyFAI. + + diff --git a/doc/build/_sources/index.txt b/doc/build/_sources/index.txt index 32ee96ad5..fbb6d443d 100644 --- a/doc/build/_sources/index.txt +++ b/doc/build/_sources/index.txt @@ -1,7 +1,10 @@ .. pyFAI documentation master file, created by sphinx-quickstart on Mon Nov 19 13:19:53 2012. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. + +:Author: Jérôme Kieffer +:Date: 01/12/2016 +:Keywords: generic description of the geometry +:Target: General audience Fast Azimuthal Integration using Python ======================================= diff --git a/doc/build/_sources/man/detector2nexus.txt b/doc/build/_sources/man/detector2nexus.txt index 173cdda93..4d04ea205 100644 --- a/doc/build/_sources/man/detector2nexus.txt +++ b/doc/build/_sources/man/detector2nexus.txt @@ -17,7 +17,7 @@ Usage: detector2nexus [options] [options] -o nxs.h5 -options: +Options: -------- -h, --help show this help message and exit diff --git a/doc/build/_sources/man/diff_map.txt b/doc/build/_sources/man/diff_map.txt index 2ce9fd016..6ca9d2fe2 100644 --- a/doc/build/_sources/man/diff_map.txt +++ b/doc/build/_sources/man/diff_map.txt @@ -89,8 +89,9 @@ optional arguments: Bugs: ..... + #. If the number of files is too large, use double - quotes "*.edf" + quotes "\*.edf" #. There is a known bug on Debian7 where importing a large number of file can take much longer than the integration itself: consider passing files in the command line diff --git a/doc/build/_sources/man/diff_tomo.txt b/doc/build/_sources/man/diff_tomo.txt index 1fb6030fa..1d0b7c691 100644 --- a/doc/build/_sources/man/diff_tomo.txt +++ b/doc/build/_sources/man/diff_tomo.txt @@ -16,10 +16,9 @@ where the 1d dataset has to be selected as last dimension. This file is not (yet This tool can be used for mapping experiments if one considers the slow scan direction as the rotation, but a tool named *diff_map* operates in a similar way, - provides a Graphical interface and is more flexible - -tips: If the number of files is too large, use double quotes around "*.edf" +provides a Graphical interface and is more flexible. +tips: If the number of files is too large, use double quotes around "\*.edf" Usage: ------ diff --git a/doc/build/_sources/man/pyFAI-calib.txt b/doc/build/_sources/man/pyFAI-calib.txt index e925535c3..7f4b1b571 100644 --- a/doc/build/_sources/man/pyFAI-calib.txt +++ b/doc/build/_sources/man/pyFAI-calib.txt @@ -23,6 +23,7 @@ LaB6_SRM660a, LaB6_SRM660b, LaB6_SRM660c, TiO2, ZnO, Al, Au You will need in addition: * The radiation energy (in keV) or its wavelength (in A) * The description of the detector: + - it name or - it's pixel size or - the spline file describing its distortion or diff --git a/doc/build/_sources/operations/linux.txt b/doc/build/_sources/operations/linux.txt index 63111c642..848330de8 100644 --- a/doc/build/_sources/operations/linux.txt +++ b/doc/build/_sources/operations/linux.txt @@ -34,7 +34,7 @@ You will be prompted for your password to gain root access in order to be able t .. code:: sudo apt-get install python-stdeb cython python-fabio - wget https://github.com/pyFAI/pyFAI/archive/master.zip + wget https://github.com/silx-kit/pyFAI/archive/master.zip unzip master.zip cd pyFAI-master ./build-deb7.sh @@ -78,7 +78,7 @@ One can also built from sources: python3-matplotlib-dbg python3-numpy python3-numpy-dbg python3-pyqt4 python3-pyqt4-dbg \ python3-scipy python3-scipy-dbg python3-sphinx python3-sphinxcontrib.programoutput \ python3-tk python3-tk-dbg - wget https://github.com/pyFAI/pyFAI/archive/master.zip + wget https://github.com/silx-kit/pyFAI/archive/master.zip unzip master.zip cd pyFAI-master ./build-deb8.sh @@ -107,7 +107,7 @@ Or you can install pyFAI from the sources: .. code:: - wget https://github.com/pyFAI/pyFAI/archive/master.zip + wget https://github.com/silx-kit/pyFAI/archive/master.zip unzip master.zip cd pyFAI-master python setup.py build test diff --git a/doc/build/_sources/operations/macosx.txt b/doc/build/_sources/operations/macosx.txt index 7f7ed748c..6a930fc69 100644 --- a/doc/build/_sources/operations/macosx.txt +++ b/doc/build/_sources/operations/macosx.txt @@ -36,7 +36,7 @@ Get the sources from Github: .. code:: - wget https://github.com/pyFAI/pyFAI/archive/master.zip + wget https://github.com/silx-kit/pyFAI/archive/master.zip unzip master.zip cd pyFAI-master diff --git a/doc/build/_sources/operations/windows.txt b/doc/build/_sources/operations/windows.txt index bff2c0a74..6ad17e2d6 100644 --- a/doc/build/_sources/operations/windows.txt +++ b/doc/build/_sources/operations/windows.txt @@ -166,7 +166,7 @@ The latest stable release of pyFAI should also be PIP-installable (starting at v Install pyFAI from sources -------------------------- -The sources of pyFAI are available at https://github.com/pyFAI/pyFAI/releases +The sources of pyFAI are available at https://github.com/silx-kit/pyFAI/releases the development is performed on https://github.com/kif/pyFAI In addition to the Python interpreter, you will need *the* C compiler compatible @@ -197,5 +197,5 @@ When starting pyFAI you get a side-by-side error like:: This means you are using a version of pyFAI which was compiled using the MSVC compiler (maybe not on your computer) but the Microsoft Visual C++ Redistributable Package is missing. For Python2.7, 64bits the missing DLL can be downloaded from:: - http://www.microsoft.com/en-us/download/confirmation.aspx?id=2092 + http://www.microsoft.com/en-us/download/confirmation.aspx?id=2092 diff --git a/doc/build/_sources/project.txt b/doc/build/_sources/project.txt index 46f8b6540..1018fa8c6 100644 --- a/doc/build/_sources/project.txt +++ b/doc/build/_sources/project.txt @@ -1,5 +1,5 @@ :Author: Jérôme Kieffer -:Date: 02/06/2016 +:Date: 01/12/2016 :Keywords: Project management description :Target: developers @@ -9,10 +9,10 @@ Project PyFAI is a library to deal with diffraction images for data reduction. This chapter describes the project from the computer engineering point of view. -PyFAI is an open source project licensed under the GPL (+ MIT code) mainly +PyFAI is an open source project licensed under the GPL (switching to MIT) mainly written in Python (v2.7 or newer, 3.4 or newer) and heavily relying on the Python scientific ecosystem: numpy, scipy and matplotlib. -It provides high performances image treatment thanks to cython and +It provides high performances image treatment thanks to Cython and OpenCL... but only a C-compiler is needed to build it. Programming language @@ -33,17 +33,17 @@ The OpenCL code has been tested using: * Beignet OpenCL v1.2 on Linux (GPU device) * Pocl OpenCL v1.2 on Linux (CPU device) -Repository: ------------ +Repository +---------- The project is hosted on GitHub: -https://github.com/pyFAI/pyFAI +https://github.com/silx-kit/pyFAI -Which provides the `issue tracker `_ in +Which provides the `issue tracker `_ in addition to Git hosting. Collaboration is done via Pull-Requests in github's web interface: -Everybody is welcome to `fork the project `_ +Everybody is welcome to `fork the project `_ and adapt it to his own needs: CEA-Saclay, Synchrotrons Soleil, Desy and APS have already done so. Collaboration is encouraged and new developments can be submitted and merged @@ -69,7 +69,7 @@ too much spammed. As the mailing list is archived, and can be consulted at: you can also check the volume of the list. If you think you are facing a bug, the best is to -`create a new issue on the GitHub page `_ +`create a new issue on the GitHub page `_ (you will need a GitHub account for that). Direct contact with authors is discouraged: @@ -93,28 +93,24 @@ Run dependencies * FabIO * h5py * pyopencl (optional) -* fftw (optional) -* pymca (optional) * PyQt4 or PySide (for the graphical user interface) -Build dependencies: -------------------- +Build dependencies +------------------ In addition to the run dependencies, pyFAI needs a C compiler. -There is an issue with MacOSX (v10.8 onwards) where the default compiler -(Xcode5 or 6) switched from gcc 4.2 to clang which -dropped the support for OpenMP (clang v3.5 supports OpenMP under linux but not -directly under MacOSX). -Multiple solution exist, pick any of those: - -* Install a recent version of GCC (>=4.2) -* Use Xcode without OpenMP, using the --no-openmp flag for setup.py. - You will need to remove the *pyFAI/ext/histogram.c* file and regenerate it, - cython needs to be installed. - -C files are generated from cython source and distributed. Cython is only needed -for developing new binary modules. +There is an issue with MacOS (v10.8 onwards) where the default compiler +(Xcode5 or newer) dropped the support for OpenMP. +On this platform pyFAI will enforce the generation of C-files from Cython sources +(making Cython a build-dependency on MacOS) without support of OpenMP +(options: --no-openmp --force-cython). +On OSX, an alternative is to install a recent version of GCC (>=4.2) and to use +it for compiling pyFAI. +The options to be used then are * --force-cython --openmp*. + +Otherwise, C files are which are provided with pyFAI sources are directly useable +and Cython is only needed for developing new binary modules. If you want to generate your own C files, make sure your local Cython version is recent enough (v0.21 and newer), unless your Cython files will not be translated to C, nor used. @@ -128,15 +124,16 @@ As most of the Python projects: .. code:: python setup.py build bdist_wheel - pip install dist/pyFAI-0.12.0*.whl --upgrade + pip install dist/pyFAI-0.13.0*.whl --upgrade There are few specific options to setup.py: * --no-cython: do not use cython (even if present) and use the C source code provided by the development team -* --no-openmp: if you compiler lacks OpenMP support, like Xcode on MacOSX. - Delete also *pyFAI/ext/histogram.c* and install cython to regenerate C-files. +* --force-cython: enforce the regeneration of all C-files from cython sources +* --no-openmp: if you compiler lacks OpenMP support, like Xcode on MacOS. +* --openmp: enforce the use of OpenMP. * --with-testimages: build the source distribution including all test images. Downloads 200MB of test images to create a self consistent tar-ball. @@ -158,7 +155,7 @@ or from python: pyFAI.tests() -It is normal to get few (<20) **Warning** messages as the test procedure also +Some **Warning** messages are normal as the test procedure also tests corner cases. To run the test an internet connection is needed as 200MB of test images will be downloaded. @@ -171,7 +168,7 @@ Setting the environment variable http_proxy can be necessary (depending on your export http_proxy=http://proxy.site.org:3128 Especially at ESRF, the configuration of the network proxy can be obtained -by phoning on the hotline: 24-24. +by asking at the helpdesk: helpdesk@esrf.fr To test the development version (built but not yet installed): @@ -187,7 +184,7 @@ or python run_test.py -i -PyFAI comes with 34 test-suites (223 tests in total) representing a coverage of 60%. +PyFAI comes with 40 test-suites (338 tests in total) representing a coverage of 60%. This ensures both non regression over time and ease the distribution under different platforms: pyFAI runs under Linux, MacOSX and Windows (in each case in 32 and 64 bits). Test may not pass on computer featuring less than 2GB of memory or 32 bit architectures. @@ -223,7 +220,7 @@ Continuous integration is made by a home-made scripts which checks out the lates You have to accept non-signed packages because they are automatically built. In addition some "cloud-based" tools are used to ensure a larger coverage of operating systems/environment. -They rely on a `"local wheelhouse" `_. +They rely on a `"local wheelhouse" `_. Those wheels are optimized for Travis-CI, AppVeyor and ReadTheDocs, using them is not recommended as your Python configuration may differ (and those libraries could even crash your system). @@ -232,9 +229,10 @@ Linux ..... -`Travis provides continuous integration on Linux `_, 64 bits computer with Python 2.7, 3.4 and 3.5. +`Travis provides continuous integration on Linux `_, +64 bits computer with Python 2.7, 3.4 and 3.5. -The builds cannot be retrieved with Travis-CO. +The builds cannot yet be retrieved with Travis-CI, but manylinux-wheels are on the radar. AppVeyor ........ diff --git a/doc/build/_sources/publications.txt b/doc/build/_sources/publications.txt index 5467362ef..31e57c9ab 100644 --- a/doc/build/_sources/publications.txt +++ b/doc/build/_sources/publications.txt @@ -1,5 +1,5 @@ :Author: Jérôme Kieffer -:Date: 31/05/2015 +:Date: 01/12/2016 :Keywords: List of publications @@ -23,6 +23,7 @@ List of publication about pyFAI **Journal of Applied Crystallography** (2015) 48 (2), 510-519 The later publication provides a nice overview of the features introduced in version -0.11 and further developed in v0.12 and should be the one cited in publication using pyFAI. -There are already 55 publication referring to pyFAI, some of them in the most prestigious -scientific journals (Nature, PNAS, ...). \ No newline at end of file +0.11 and further developed in v0.12 and v0.13 and should be the one cited in +publications using pyFAI (or one of the graphical application on top of it). +There are already 72 publication referring to pyFAI, some of them in the most +prestigious scientific journals (Nature, PNAS, ...). \ No newline at end of file diff --git a/doc/build/_sources/pyFAI.txt b/doc/build/_sources/pyFAI.txt index e71993ab5..803974f33 100644 --- a/doc/build/_sources/pyFAI.txt +++ b/doc/build/_sources/pyFAI.txt @@ -1,7 +1,8 @@ :Author: Jérôme Kieffer -:Date: 31/05/2016 +:Date: 01/12/2016 :Keywords: generic description of the software :Target: General audiance + General introduction to PyFAI ============================= @@ -101,21 +102,10 @@ PyFAI executables ................. PyFAI was designed to be used by scientists needing a simple and -effective tool for azimuthal integration. Two command line programs -*pyFAI-waxs* and *pyFAI-saxs* are provided with pyFAI for performing the -integration of one or more images on the command line. -The waxs version outputs result in -:math:`2\theta /I`, whereas the saxs version outputs result in -:math:`q/I(/\sigma)`. Options for these programs are parameter file -(*poni-file*) -describing the geometry and the mask file. They can also do some -pre-processing like dark-noise subtraction and flat-field correction -(solid-angle correction is done by default). - -A new Graphical interface based on Qt called *pyFAI-integrate* is now available, -offers all options possible for azimuthal integration (dark/flat/polarization, -....) in addition to a finer tuning for the computing device selection (CPU/GPU). - +effective tool for azimuthal integration. +There are a certain number of scripts which will help you in preprocessing images +(dark current, flat-field, averaging, ...), +calibrating the geometry, performing the integration. Finally couple of specialized tool called diff_tomo and diff_map are available to reduce a 2D/3D-mapping experiment of 2D images into a 3D volume (:math:`x, y, 2\theta` for mapping or :math:`rot, trans, 2\theta` for tomography) @@ -136,9 +126,9 @@ integrated before being plotted. :align: center :alt: image -The :ref:`tutorials` section makes heavy use of *ipython*, now *jupyter* -to process data using pyFAI. -The first tutorial also explains a bit how Python and Jupyter works to be +The :ref:`tutorials` section makes heavy use of *IPython notebooks*, now called +*Jupyter notebooks* to process data using *pyFAI*. +The first tutorial also explains a bit how *Python* and *Jupyter* works to be able to perform basic processing efficiently with pyFAI. diff --git a/doc/build/_sources/usage/cookbook/calibrate.txt b/doc/build/_sources/usage/cookbook/calibrate.txt index ffc4ba00d..eebca5a38 100644 --- a/doc/build/_sources/usage/cookbook/calibrate.txt +++ b/doc/build/_sources/usage/cookbook/calibrate.txt @@ -198,7 +198,8 @@ Here is the diffraction pattern from a properly calibrated setup: .. code-block:: python - from pyFAI.spline import Spline - s = Spline("F_K4320T_Cam43_30012013_distorsion.spline") - ud = s.flipud() - ud.write("flipud.spline") + from pyFAI.spline import Spline + s = Spline("F_K4320T_Cam43_30012013_distorsion.spline") + ud = s.flipud() + ud.write("flipud.spline") + diff --git a/doc/build/_sources/usage/cookbook/integration_with_scripts.txt b/doc/build/_sources/usage/cookbook/integration_with_scripts.txt index 849b75b94..657f9ee5f 100644 --- a/doc/build/_sources/usage/cookbook/integration_with_scripts.txt +++ b/doc/build/_sources/usage/cookbook/integration_with_scripts.txt @@ -5,4 +5,3 @@ Azimuthal integration using scripts =================================== - diff --git a/doc/build/_sources/usage/tutorial/CCD_Calibration/CCD_calibration.txt b/doc/build/_sources/usage/tutorial/CCD_Calibration/CCD_calibration.txt index 8930abb0f..fe459e958 100644 --- a/doc/build/_sources/usage/tutorial/CCD_Calibration/CCD_calibration.txt +++ b/doc/build/_sources/usage/tutorial/CCD_Calibration/CCD_calibration.txt @@ -6,7 +6,7 @@ This tutorial presents how to calibrate the distortion from a CCD camera coupled with a taper of optic fibers. If your camera is already calibrated using Fit2D and you have access to the corresponding *spline* file, this tutorial is not for you: simply create your detector object -like this **pyFAI.detectors.Detector(splineFile="example.spline")** and +like this ``pyFAI.detectors.Detector(splineFile="example.spline")`` and you are done. This tutorial uses the image of a regular grid on the detector. @@ -16,13 +16,17 @@ O.; Thompson, A. published in Nuclear Instruments and Methods in Physics Research Section A, Volume 346, Issue 1-2, p. 312-321. DOI:10.1016/0168-9002(94)90720-X -The procedure is performed in 4 steps: 1. peak picking 2. grid -assignment 3. distortion fitting 4. interpolation of the fitted data 5. -saving into a detector definition file +The procedure is performed in 4 steps: + +1. peak picking +2. grid assignment +3. distortion fitting +4. interpolation of the fitted data +5. saving into a detector definition file The picture used is the one of a regular metallic grid of holes (spaced by 5mm), just in front of the detector. We will assume holes are -circular what looks correct in first apploximation. Paralax error will +circular what looks correct in first approximation. Parallax error will be ignored in a first time. Peak picking @@ -30,7 +34,7 @@ Peak picking Lets start with peak picking, for this, we will use the *FabIO* library able to read the image and *matplotlib* to display the image. The -disortion is assumed to be minimal in the middle of the detector, so we +distortion is assumed to be minimal in the middle of the detector, so we first focus on one spot in the middle: .. code:: python @@ -38,8 +42,6 @@ first focus on one spot in the middle: #For final rendering switch from nbagg -> inline #%pylab nbagg %pylab inline - # - # search for the image containing the grid .. parsed-literal:: @@ -49,16 +51,13 @@ first focus on one spot in the middle: .. code:: python - ls + # search for the image containing the grid + !ls *.edf .. parsed-literal:: - 03jun102d.edf* ccd2_g3.edf* CCD_calibration.ipynb grilHiCap_04jund.edf* - ccd2_g1_chk.edf ccd2_g6_1.edf corrected.edf testdetector.h5 - ccd2_g2.edf* ccd2_g6_2.edf flm-4-1.edf* - ccd2_g2g.edf ccd2_g6_3.edf frelonID22_grid.edf - ccd2_g3_chk.edf* ccd2_g6_chk.edf grid.edf* + corrected.edf frelonID22_grid.edf .. code:: python @@ -71,15 +70,12 @@ first focus on one spot in the middle: .. parsed-literal:: + WARNING:fabioimage:PIL is not installed ... trying to do without + WARNING:tifimage:PIL is not installed ... trying to do without + WARNING:bruker100image:PIL is not installed ... trying to do without WARNING:xsdimage:lxml library is probably not part of your python installation: disabling xsdimage format -.. parsed-literal:: - - WARNING: Not using BLAS, PCA calculation will be slower - WARNING: Not using BLAS/ATLAS, PCA calculation will be slower - - .. code:: python imshow(img, interpolation="nearest", origin="lower") @@ -89,7 +85,7 @@ first focus on one spot in the middle: .. parsed-literal:: - + @@ -107,7 +103,7 @@ first focus on one spot in the middle: .. parsed-literal:: - + @@ -125,7 +121,7 @@ first focus on one spot in the middle: .. parsed-literal:: - [] + [] @@ -162,7 +158,7 @@ peak-position. .. parsed-literal:: - + @@ -181,8 +177,8 @@ peak-position. .. code:: python #Check that size is unchanged. - print(img.shape) - print(cnv.shape) + print(img.shape) + print(cnv.shape) .. parsed-literal:: @@ -201,7 +197,7 @@ peak-position. .. parsed-literal:: - + @@ -219,7 +215,7 @@ peak-position. .. parsed-literal:: - + @@ -238,7 +234,7 @@ peak-position. .. parsed-literal:: - [] + [] @@ -248,7 +244,7 @@ peak-position. After convolution with a pattern of the same shape as the hole, the peak center is located with a sub-pixel resolution. The peak has a full size -of 30 pix in 1 dimension. +of 30 pixels in 1 dimension. All peak positions will be extracted using the pyFAI inverse watershed algorithm. Once all regions are segmented, the ones too small are sieved @@ -279,20 +275,20 @@ is done on the log-scale of the intensity. iw.merge_singleton() all_regions = set(iw.regions.values()) regions = [i for i in all_regions if i.size>mini] - + print("Number of region segmented: %s"%len(all_regions)) print("Number of large enough regions : %s"%len(regions)) - .. parsed-literal:: WARNING:pyFAI.utils:Exception No module named 'fftw3': FFTw3 not available. Falling back on Scipy - WARNING:pyFAI.timeit:init_labels took 2.123s - WARNING:pyFAI.timeit:init_borders took 0.066s - WARNING:pyFAI.timeit:init_regions took 0.646s - WARNING:pyFAI.timeit:init_pass took 0.229s - WARNING:pyFAI.timeit:merge_singleton took 0.054s + WARNING:pyFAI.opencl:Unable to import pyOpenCl. Please install it from: http://pypi.python.org/pypi/pyopencl + WARNING:pyFAI.timeit:init_labels took 1.104s + WARNING:pyFAI.timeit:init_borders took 0.048s + WARNING:pyFAI.timeit:init_regions took 0.450s + WARNING:pyFAI.timeit:init_pass took 0.143s + WARNING:pyFAI.timeit:merge_singleton took 0.033s .. parsed-literal:: @@ -332,14 +328,16 @@ is done on the log-scale of the intensity. .. image:: output_18_1.png -There are clearly 3 groups of very different intensity, well segragated: +There are clearly 3 groups of very different intensity, well segregated: -- around 10^2.1 (~125), those are the peaks where no tapper brings - light -- around 10^3.4 (~2500), those are segmented region in the background -- above 10^3.9 (~8000), those are actual peaks, we are looking for. +- around :math:`10^{2.1}` (~125), those are the peaks where no tapper + brings light +- around :math:`10^{3.4}` (~2500), those are segmented region in the + background +- above :math:`10^{3.9}` (~8000), those are actual peaks, we are + looking for. -We retain all peaks >10^3.5 +We retain all peaks > :math:`10^{3.5}` .. code:: python @@ -367,7 +365,7 @@ We retain all peaks >10^3.5 .. parsed-literal:: Raw peak coordinate: - [(1187, 654), (35, 155), (1082, 1447), (1082, 1545), (39, 62), (1083, 1250), (1083, 1349), (1943, 1925), (1084, 1151), (1190, 455)] + [(1273, 2027), (1664, 1742), (1666, 1646), (1866, 1155), (1274, 1933), (1867, 466), (1867, 563), (1867, 1056), (203, 1131), (107, 1226)] @@ -402,7 +400,7 @@ Precise peak extraction is performed using a second order tailor expansion .. parsed-literal:: Refined peak coordinate: - [(1186.931446455419, 653.9433948583901), (34.4068917632103, 155.60163909196854), (1081.7659440785646, 1447.2154052853584), (1081.409073472023, 1545.5145089030266), (39.49280175566673, 62.08068184554577), (1083.1883269548416, 1249.924985870719), (1082.5653080940247, 1348.6598246097565), (1943.0012932673562, 1925.4793396294117), (1083.641106903553, 1150.8036927580833), (1189.607285887003, 455.1422745883465)] + [(1272.9463423714042, 2026.5502902269363), (1664.0545781441033, 1742.1054049506783), (1666.296777099371, 1645.9045108556747), (1866.365830898285, 1154.7454472184181), (1274.126026943326, 1932.9975793703925), (1866.5777518451214, 465.5264100730419), (1867.4438569247723, 563.2241970151663), (1867.3492084741592, 1056.0545778758824), (203.06922163814306, 1131.10803706944), (106.92814844101667, 1226.3799100518227)] @@ -413,7 +411,7 @@ At this stage, a visual inspection of the grid confirms all peaks have been properly segmented. If this is not the case, one can adapt: - the size of the kernel -- the threshold comming out of the histogramming +- the threshold coming out of the histogramming Pair-wise distribution function ------------------------------- @@ -423,7 +421,7 @@ this we calculate the distance\_matrix from any point to any other: .. code:: python - # Nota, pyFAI uses **C-coordinates** so they come out as (y,x) and not the usual (x,y). + # Nota, pyFAI uses **C-coordinates** so they come out as (y,x) and not the usual (x,y). # This notation helps us to remind the order yx = numpy.array(ref_peaks) @@ -446,7 +444,7 @@ neighbors .. parsed-literal:: - + @@ -462,11 +460,11 @@ This histogram provides us: - ... and so on. We now focus on the first neighbours which are all located between 70 -and 110 pixel appart. +and 110 pixels apart. .. code:: python - #We define here a data-type for each peak (called center) with 4 neighbours (called north, east, south and west). + #We define here a data-type for each peak (called center) with 4 neighbours (called north, east, south and west). point_type = np.dtype([('center_y', float), ('center_x', float), ('east_y', float), ('east_x', float), ('west_y', float), ('west_x', float), @@ -476,9 +474,8 @@ and 110 pixel appart. neig = np.logical_and(dist>70.0, dist<110.0) valid = (neig.sum(axis=-1)==4).sum() print("There are %i control point with exactly 4 first neigbours"%valid) - point = numpy.zeros(valid, point_type) # This initializes an empty structure to be populated - + point = numpy.zeros(valid, point_type) .. parsed-literal:: @@ -488,7 +485,7 @@ and 110 pixel appart. .. code:: python - #Populate the structure: we use a loop as it loops only over 400 points + #Populate the structure: we use a loop as it loops only over 400 points h=-1 for i, center in enumerate(peaks_ref): if neig[i].sum()!=4: continue @@ -506,7 +503,6 @@ and 110 pixel appart. elif j==(1,0): point[h]["north_y"],point[h]["north_x"] = y, x elif j==(-1,0):point[h]["south_y"],point[h]["south_x"] = y, x - We will need to define an *origin* but taking it on the border of the image is looking for trouble as this is where distortions are likely to be the most important. The center of the detector is an option but we @@ -523,7 +519,7 @@ prefer to take the peak the nearest to the centroid of all other peaks. Cx, Cy = 734, 1181 #beam center #Cx, Cy = tuple(i//2 for i in cnv.shape) #detector center print("The guessed center is at (%s, %s)"%(Cx, Cy)) - + #Get the nearest point from centroid: d2 = ((point["center_x"]-Cx)**2+(point["center_y"]-Cy)**2) best = d2.argmin() @@ -531,7 +527,7 @@ prefer to take the peak the nearest to the centroid of all other peaks. Ox, Oy = Op["center_x"], Op["center_y"] print("The center is at (%s, %s)"%(Ox, Oy)) - #Calculate the average vector along the 4 main axes + #Calculate the average vector along the 4 main axes Xx = (point[:]["east_x"] - point[:]["center_x"]).mean() Xy = (point[:]["east_y"] - point[:]["center_y"]).mean() Yx = (point[:]["north_x"] - point[:]["center_x"]).mean() @@ -541,7 +537,6 @@ prefer to take the peak the nearest to the centroid of all other peaks. print("The Y vector is is at (%s, %s)"%(Yx, Yy)) - .. parsed-literal:: The guessed center is at (734, 1181) @@ -557,7 +552,6 @@ prefer to take the peak the nearest to the centroid of all other peaks. print("The XY angle is %s deg"%rad2deg(arctan2(Yy, Yx)-arctan2(Xy, Xx))) - .. parsed-literal:: X has an angle of -0.462002756355 deg @@ -580,8 +574,8 @@ prefer to take the peak the nearest to the centroid of all other peaks. Xmax = IJ[:,0].max() Ymin = IJ[:,1].min() Ymax = IJ[:,1].max() - print("Xmin/max",Xmin, Xmax) - print("Ymin/max",Ymin,Ymax) + print("Xmin/max", Xmin, Xmax) + print("Ymin/max", Ymin, Ymax) print("Maximum error versus integrer: %s * pitch size (5mm)"%(abs(IJ-IJ.round()).max())) @@ -611,7 +605,7 @@ optimization later on. .. parsed-literal:: - + @@ -624,9 +618,9 @@ Estimation of the pixel size: The pixel size is obtained from the pitch of the grid, in vectorial: -pitch^2 = (Px\*Xx)^2 + (Py Xy)^2 +.. math:: pitch^2 = (Px \cdot Xx)^2 + (Py \cdot Xy)^2 -pitch^2 = (Px\*Yx)^2 + (Py Yy)^2 +.. math:: pitch^2 = (Px \cdot Yx)^2 + (Py \cdot Yy)^2 .. code:: python @@ -671,7 +665,6 @@ the peaks on the border with less than 4 neighbours. "Translate pixel -> hole" T = numpy.atleast_2d(P[:2]) R = P[2:].reshape((2,2)) - #Transformation matrix from pixel to holes: hole = dot(numpy.linalg.inv(R), (pixels - T).T).T return hole @@ -680,7 +673,7 @@ the peaks on the border with less than 4 neighbours. "Translate hole -> pixel" T = numpy.atleast_2d(P[:2]) R = P[2:].reshape((2,2)) - #Transformation from index points (holes) to pixel coordinates: + #Transformation from index points (holes) to pixel coordinates: pix = dot(R,holes.T).T + T return pix @@ -703,37 +696,36 @@ the peaks on the border with less than 4 neighbours. print("Maximum final error versus integrer: %s * pitch size (5mm)"%(abs(holes-holes.round()).max())) - .. parsed-literal:: Total inital error 2.5995763607 [753.70350015163422, 1186.1879850327969, 97.719730182623479, 1.3821857949656571, -0.78797711765336542, 97.082699075794565] Maximum initial error versus integrer: 0.199838456433 * pitch size (5mm) - jac: array([ -1.49011612e-07, -2.08616257e-07, -2.68220901e-07, - 1.19209290e-07, 1.19209290e-07, 3.87430191e-07]) + fun: 2.123772842169884 + hess_inv: array([[ 1.41698853e+01, 5.02981780e-01, -8.67450996e-01, + 5.65400698e-01, -2.23588556e-02, 3.62469793e-02], + [ 5.02981780e-01, 1.44432486e+01, -6.17043562e-03, + 3.18737250e-02, -8.80159842e-01, 5.53478243e-01], + [ -8.67450996e-01, -6.17043562e-03, 2.99705132e-01, + -4.12312169e-03, 2.39113093e-03, -1.79968692e-03], + [ 5.65400698e-01, 3.18737250e-02, -4.12312169e-03, + 3.01702833e-01, -1.78715958e-03, 3.83867286e-03], + [ -2.23588556e-02, -8.80159842e-01, 2.39113093e-03, + -1.78715958e-03, 2.97818929e-01, -3.46536500e-03], + [ 3.62469793e-02, 5.53478243e-01, -1.79968692e-03, + 3.83867286e-03, -3.46536500e-03, 2.93190623e-01]]) + jac: array([ -2.98023224e-08, 5.66244125e-07, 1.19209290e-07, + 3.57627869e-07, 8.34465027e-07, 1.10268593e-06]) + message: 'Optimization terminated successfully.' nfev: 160 nit: 15 - message: 'Optimization terminated successfully.' - status: 0 njev: 20 + status: 0 success: True - x: array([ 7.53021133e+02, 1.18519692e+03, 9.81143527e+01, - 1.47509463e+00, -8.04478515e-01, 9.73166896e+01]) - fun: 2.1237728421683415 - hess_inv: array([[ 1.42100651e+01, 5.92064797e-01, -8.65311650e-01, - 5.71616778e-01, -2.93157223e-02, 3.36330120e-02], - [ 5.92064797e-01, 1.42890834e+01, -3.28993124e-02, - 1.71968068e-02, -8.57363816e-01, 5.83878215e-01], - [ -8.65311650e-01, -3.28993124e-02, 2.99126185e-01, - -4.37220702e-03, 4.01788293e-03, -2.74807907e-03], - [ 5.71616778e-01, 1.71968068e-02, -4.37220702e-03, - 3.02142044e-01, -1.06852612e-03, 2.67366996e-03], - [ -2.93157223e-02, -8.57363816e-01, 4.01788293e-03, - -1.06852612e-03, 2.95805859e-01, -4.27421580e-03], - [ 3.36330120e-02, 5.83878215e-01, -2.74807907e-03, - 2.67366996e-03, -4.27421580e-03, 2.97301584e-01]]) - total Final error 2.12377284217 [ 7.53021133e+02 1.18519692e+03 9.81143527e+01 1.47509463e+00 - -8.04478515e-01 9.73166896e+01] - Maximum final error versus integrer: 0.234645010209 * pitch size (5mm) + x: array([ 7.53021133e+02, 1.18519693e+03, 9.81143528e+01, + 1.47509462e+00, -8.04478941e-01, 9.73166902e+01]) + total Final error 2.12377284217 [ 7.53021133e+02 1.18519693e+03 9.81143528e+01 1.47509462e+00 + -8.04478941e-01 9.73166902e+01] + Maximum final error versus integrer: 0.234645015537 * pitch size (5mm) .. code:: python @@ -750,10 +742,9 @@ the peaks on the border with less than 4 neighbours. - .. parsed-literal:: - + @@ -777,7 +768,7 @@ the peaks on the border with less than 4 neighbours. Few comments: -- The maximum error grow during optimization without explainations +- The maximum error grow during optimization without explanations - The outer part of the detector is the most distorted Interpolation of the fitted data @@ -815,7 +806,7 @@ needed as y,x (and not x,y) we use p instead of peaks\_m .. parsed-literal:: - + @@ -828,7 +819,7 @@ needed as y,x (and not x,y) we use p instead of peaks\_m #From http://stackoverflow.com/questions/3662361/fill-in-missing-values-with-nearest-neighbour-in-python-numpy-masked-arrays def fill(data, invalid=None): """ - Replace the value of invalid 'data' cells (indicated by 'invalid') + Replace the value of invalid 'data' cells (indicated by 'invalid') by the value of the nearest valid data cell Input: @@ -837,17 +828,16 @@ needed as y,x (and not x,y) we use p instead of peaks\_m value should be replaced. If None (default), use: invalid = np.isnan(data) - Output: - Return a filled array. + Output: + Return a filled array. """ - if invalid is None: + if invalid is None: invalid = numpy.isnan(data) ind = ndimage.distance_transform_edt(invalid, return_distances=False, return_indices=True) return data[tuple(ind)] - .. code:: python figure(figsize=(12,5)) @@ -863,10 +853,9 @@ needed as y,x (and not x,y) we use p instead of peaks\_m - .. parsed-literal:: - + @@ -887,10 +876,9 @@ Saving the distortion correction arrays to a detector detector.max_shape = detector.shape = img.shape detector.set_dx(fill(delta_x)) detector.set_dy(fill(delta_y)) - detector.mask = numpy.isnan(delta_x).astype(numpy.int8) + detector.mask = numpy.isnan(delta_x).astype(numpy.int8)[:img.shape[0], :img.shape[1]] detector.save("testdetector.h5") - Validation of the distortion correction --------------------------------------- @@ -909,24 +897,18 @@ Validation of the distortion correction fabio.edfimage.EdfImage(data=cor).save("corrected.edf") -.. parsed-literal:: - - WARNING:pyFAI.timeit:calc_pos took 0.747s - WARNING:pyFAI.timeit:calc_size took 0.944s - WARNING:pyFAI.timeit:calc_LUT took 2.907s - - -.. image:: output_54_1.png +.. image:: output_54_0.png Conclusion ========== -This procedure describes how to measure the detector -distortion and how to create a detector description file directly -useable in pyFAI. Only the region inside the convex hull of the grid -data-points is valid and the region of the detector which is not -calibrated has been masked out to preven accidental use of it. + +This procedure describes how to measure the detector distortion and how +to create a detector description file directly usable in pyFAI. Only the +region inside the convex hull of the grid data-points is valid and the +region of the detector which is not calibrated has been masked out to +prevent accidental use of it. The distortion corrected image can now be used to check how "good" the calibration actually is. This file can be injected in the third cell, @@ -934,4 +916,3 @@ and follow the same procedure (left as exercise). This gives a maximum mis-placement of 0.003, the average error is then of 0.0006 and correction-map exhibit a displacement of pixels in the range +/- 0.2 pixels which is acceptable and validates the whole procedure. - diff --git a/doc/build/_sources/usage/tutorial/Introduction/introduction.txt b/doc/build/_sources/usage/tutorial/Introduction/introduction.txt index 881fec981..1ab862463 100644 --- a/doc/build/_sources/usage/tutorial/Introduction/introduction.txt +++ b/doc/build/_sources/usage/tutorial/Introduction/introduction.txt @@ -34,8 +34,8 @@ Outside ESRF with an ESRF account. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The JupyterHub server is not directly available on the internet, but you -can -``login into the firewall``\ \_ +can `login into the +firewall `__ to forward the web server: ssh -XC -p5022 -L8000:scisoft13:8000 user@firewall.esrf.fr @@ -367,7 +367,7 @@ command from UNIX to print the content of the file. This "moke.dat" file contains in addition to the 2th/I value, a header commented with "#" with the geometry used to perform the calculation. -**Nota: ** The *ai* object has initialized the geometry on the first +**Nota:** The *ai* object has initialized the geometry on the first call and re-uses it on subsequent calls. This is why it is important to re-use the geometry in performance critical applications. diff --git a/doc/build/_sources/usage/tutorial/MakeCalibrant/make_calibrant.txt b/doc/build/_sources/usage/tutorial/MakeCalibrant/make_calibrant.txt index fa2803798..76a317c5a 100644 --- a/doc/build/_sources/usage/tutorial/MakeCalibrant/make_calibrant.txt +++ b/doc/build/_sources/usage/tutorial/MakeCalibrant/make_calibrant.txt @@ -89,9 +89,10 @@ triclinic crystal. Specific constructors ~~~~~~~~~~~~~~~~~~~~~ -| Nevertheless, most used calibrants are of much higher symmetry, like +Nevertheless, most used calibrants are of much higher symmetry, like cubic which takes only **one** parameter. -| Here is an example for defining + +Here is an example for defining `Polonium `__ which is a simple cubic cell (Primitive) with a cell parameter of 335.9pm. This example was chosen as Polonium is apparently the only element with diff --git a/doc/build/_sources/usage/tutorial/MultiGeometry/index.txt b/doc/build/_sources/usage/tutorial/MultiGeometry/index.txt index acedcc7b1..12c8ac92c 100644 --- a/doc/build/_sources/usage/tutorial/MultiGeometry/index.txt +++ b/doc/build/_sources/usage/tutorial/MultiGeometry/index.txt @@ -153,6 +153,7 @@ use the *copy* function of the *copy* module: .. code:: python import copy + We will now offset the *poni1* value of each AzimuthalIntegratoe which correspond to a vertical translation. Each subsequent image is offsetted by half a detector width (stored as *poni1*). diff --git a/doc/build/_sources/usage/tutorial/index.txt b/doc/build/_sources/usage/tutorial/index.txt index 89d6885fd..d2b2fd817 100644 --- a/doc/build/_sources/usage/tutorial/index.txt +++ b/doc/build/_sources/usage/tutorial/index.txt @@ -19,6 +19,7 @@ a good Python fluency and to a certain extent, of the pyFAI library. :maxdepth: 1 Introduction/introduction + Geometry/geometry Distortion/Distortion Calibrant/index multi-geometry diff --git a/doc/build/api/modules.html b/doc/build/api/modules.html index a5b788c50..6b00c4416 100644 --- a/doc/build/api/modules.html +++ b/doc/build/api/modules.html @@ -6,7 +6,7 @@ - pyFAI API — pyFAI 0.12.0 documentation + pyFAI API — pyFAI 0.13.0 documentation @@ -14,7 +14,7 @@ - + @@ -44,7 +44,7 @@

Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • @@ -55,16 +55,20 @@

    Navigation

    pyFAI API

    -

    This chapter describes the programming interface of pyFAI, so what you can expect after having launched ipython and typed: -..

    -
    -
    import pyFAI
    -

    The most important class is AzimuthalIntegrator which is an object containing both the geometry (it inherits from Geometry, another class) +

    This chapter describes the programming interface of pyFAI, so what you can +expect after having launched Jupyter notebook (or ipython) and typed:

    +
    import pyFAI
    +
    +
    +

    The most important class is AzimuthalIntegrator which is an object containing +both the geometry (it inherits from Geometry, another class) and exposes important methods (functions) like integrate1d and integrate2d.

    @@ -140,7 +158,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • @@ -59,8 +59,9 @@

    Navigation

    pyFAI Package

    -pyFAI.__init__.benchmarks()
    -

    Run the benchmarks

    +pyFAI.__init__.benchmarks(*arg, **kwarg) +

    Run the integrated benchmarks.

    +

    See the documentation of pyFAI.benchmark.run_benchmark

    @@ -78,3377 +79,3644 @@

    Navigation

    -
    -

    azimuthalIntegrator Module

    +
    +

    average Module

    +

    Utilities, mainly for image treatment

    +
    +
    +exception pyFAI.average.AlgorithmCreationError
    +

    Bases: exceptions.RuntimeError

    +

    Exception returned if creation of an ImageReductionFilter is not +possible

    +
    +
    -
    -class pyFAI.azimuthalIntegrator.AzimuthalIntegrator(dist=1, poni1=0, poni2=0, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None)
    -

    Bases: pyFAI.geometry.Geometry

    -

    This class is an azimuthal integrator based on P. Boesecke’s -geometry and histogram algorithm by Manolo S. del Rio and V.A Sole

    -

    All geometry calculation are done in the Geometry class

    -

    main methods are:

    -
    >>> tth, I = ai.integrate1d(data, npt, unit="2th_deg")
    ->>> q, I, sigma = ai.integrate1d(data, npt, unit="q_nm^-1", error_model="poisson")
    ->>> regrouped = ai.integrate2d(data, npt_rad, npt_azim, unit="q_nm^-1")[0]
    -
    -
    -
    -
    -DEFAULT_METHOD = 'splitbbox'
    -
    +
    +class pyFAI.average.Average
    +

    Bases: object

    +

    Process images to generate an average using different algorithms.

    +
    +
    +__init__()
    +

    Constructor

    +
    -
    -create_mask(data, mask=None, dummy=None, delta_dummy=None, mode='normal')
    -

    Combines various masks into another one.

    +
    +add_algorithm(algorithm)
    +

    Defines another algorithm which will be computed on the source.

    - - - - - +
    Parameters:
      -
    • data (ndarray) – input array of data
    • -
    • mask (ndarray) – input mask (if none, self.mask is used)
    • -
    • dummy (float) – value of dead pixels
    • -
    • delta_dumy – precision of dummy pixels
    • -
    • mode (str) – can be “normal” or “numpy” (inverted) or “where” applied to the mask
    • -
    -
    Returns:

    the new mask

    -
    Return type:

    ndarray of bool

    -
    Parameters:algorithm (ImageReductionFilter) – An averaging algorithm.
    -

    This method combine two masks (dynamic mask from data & -dummy and mask) to generate a new one with the ‘or’ binary -operation. One can adjust the level, with the dummy and -the delta_dummy parameter, when you consider the data -values needs to be masked out.

    -

    This method can work in two different mode:

    -
    -
      -
    • “normal”: False for valid pixels, True for bad pixels
    • -
    • “numpy”: True for valid pixels, false for others
    • -
    -
    -

    This method tries to accomodate various types of masks (like -valid=0 & masked=-1, ...) and guesses if an input mask needs -to be inverted.

    -
    -dark_correction(data, dark=None)
    -

    Correct for Dark-current effects. -If dark is not defined, correct for a dark set by “set_darkfiles”

    +
    +get_counter_frames()
    +

    Returns the number of frames used for the process.

    - - - +
    Parameters:
      -
    • data – input ndarray with the image
    • -
    • dark – ndarray with dark noise or None
    • -
    -
    Returns:

    2tuple: corrected_data, dark_actually used (or None)

    -
    Return type:int
    -
    -
    -darkcurrent
    -
    - -
    -
    -empty
    -
    -
    -
    -flat_correction(data, flat=None)
    -

    Correct for flat field. -If flat is not defined, correct for a flat set by “set_flatfiles”

    +
    +get_fabio_images()
    +

    Returns source images as fabio images.

    - - - +
    Parameters:
      -
    • data – input ndarray with the image
    • -
    • dark – ndarray with dark noise or None
    • -
    -
    Returns:

    2tuple: corrected_data, flat_actually used (or None)

    -
    Return type:list(fabio.fabioimage.FabioImage)
    -
    -
    -flatfield
    -
    -
    -
    -get_darkcurrent()
    -
    +
    +get_image_reduction(algorithm)
    +

    Returns the result of an algorithm. The process must be already +done.

    + +++ + + + + + +
    Parameters:algorithm (ImageReductionFilter) – An averaging algorithm
    Return type:numpy.ndarray
    +
    -
    -get_empty()
    -
    +
    +process()
    +

    Process source images to all defined averaging algorithms defined +using defined parameters. To access to the results you have to define +a writer (AverageWriter). To follow the process forward you have to +define an observer (AverageObserver).

    +
    -
    -get_flatfield()
    -
    +
    +set_correct_flat_from_dark(correct_flat_from_dark)
    +

    Defines if the dark must be applied on the flat.

    + +++ + + + +
    Parameters:correct_flat_from_dark (bool) – If true, the dark is applied.
    +
    -
    -integrate1d(data, npt, filename=None, correctSolidAngle=True, variance=None, error_model=None, radial_range=None, azimuth_range=None, mask=None, dummy=None, delta_dummy=None, polarization_factor=None, dark=None, flat=None, method='csr', unit=q_nm^-1, safe=True, normalization_factor=1.0, block_size=32, profile=False, all=False)
    -

    Calculate the azimuthal integrated Saxs curve in q(nm^-1) by default

    -

    Multi algorithm implementation (tries to be bullet proof), suitable for SAXS, WAXS, ... and much more

    +
    +set_dark(dark_list)
    +

    Defines images used as dark.

    - - - - - +
    Parameters:
      -
    • data (ndarray) – 2D array from the Detector/CCD camera
    • -
    • npt (int) – number of points in the output pattern
    • -
    • filename (str) – output filename in 2/3 column ascii format
    • -
    • correctSolidAngle (bool) – correct for solid angle of each pixel if True
    • -
    • variance (ndarray) – array containing the variance of the data. If not available, no error propagation is done
    • -
    • error_model (str) – When the variance is unknown, an error model can be given: “poisson” (variance = I), “azimuthal” (variance = (I-<I>)^2)
    • -
    • radial_range ((float, float), optional) – The lower and upper range of the radial unit. If not provided, range is simply (data.min(), data.max()). Values outside the range are ignored.
    • -
    • azimuth_range ((float, float), optional) – The lower and upper range of the azimuthal angle in degree. If not provided, range is simply (data.min(), data.max()). Values outside the range are ignored.
    • -
    • mask (ndarray) – array (same size as image) with 1 for masked pixels, and 0 for valid pixels
    • -
    • dummy (float) – value for dead/masked pixels
    • -
    • delta_dummy (float) – precision for dummy value
    • -
    • polarization_factor (float) – polarization factor between -1 (vertical) and +1 (horizontal). 0 for circular polarization or random, None for no correction
    • -
    • dark (ndarray) – dark noise image
    • -
    • flat (ndarray) – flat field image
    • -
    • method (str) – can be “numpy”, “cython”, “BBox” or “splitpixel”, “lut”, “csr”, “nosplit_csr”, “full_csr”, “lut_ocl” and “csr_ocl” if you want to go on GPU. To Specify the device: “csr_ocl_1,2”
    • -
    • unit (pyFAI.units.Enum) – Output units, can be “q_nm^-1”, “q_A^-1”, “2th_deg”, “2th_rad”, “r_mm” for now
    • -
    • safe (bool) – Do some extra checks to ensure LUT/CSR is still valid. False is faster.
    • -
    • normalization_factor (float) – Value of a normalization monitor
    • -
    • block_size – size of the block for OpenCL integration (unused?)
    • -
    • profile – set to True to enable profiling in OpenCL
    • -
    • all – if true return a dictionary with many more parameters
    • -
    -
    Returns:

    q/2th/r bins center positions and regrouped intensity (and error array if variance or variance model provided), uneless all==True.

    -
    Return type:

    2 or 3-tuple of ndarrays

    -
    Parameters:dark_list (list) – List of dark used
    -
    -integrate2d(data, npt_rad, npt_azim=360, filename=None, correctSolidAngle=True, variance=None, error_model=None, radial_range=None, azimuth_range=None, mask=None, dummy=None, delta_dummy=None, polarization_factor=None, dark=None, flat=None, method='bbox', unit=q_nm^-1, safe=True, normalization_factor=1.0, all=False)
    -

    Calculate the azimuthal regrouped 2d image in q(nm^-1)/chi(deg) by default

    -

    Multi algorithm implementation (tries to be bullet proof)

    +
    +set_flat(flat_list)
    +

    Defines images used as flat.

    - - - - - +
    Parameters:
      -
    • data (ndarray) – 2D array from the Detector/CCD camera
    • -
    • npt_rad (int) – number of points in the radial direction
    • -
    • npt_azim (int) – number of points in the azimuthal direction
    • -
    • filename (str) – output image (as edf format)
    • -
    • correctSolidAngle (bool) – correct for solid angle of each pixel if True
    • -
    • variance (ndarray) – array containing the variance of the data. If not available, no error propagation is done
    • -
    • error_model (str) – When the variance is unknown, an error model can be given: “poisson” (variance = I), “azimuthal” (variance = (I-<I>)^2)
    • -
    • radial_range ((float, float), optional) – The lower and upper range of the radial unit. If not provided, range is simply (data.min(), data.max()). Values outside the range are ignored.
    • -
    • azimuth_range ((float, float), optional) – The lower and upper range of the azimuthal angle in degree. If not provided, range is simply (data.min(), data.max()). Values outside the range are ignored.
    • -
    • mask (ndarray) – array (same size as image) with 1 for masked pixels, and 0 for valid pixels
    • -
    • dummy (float) – value for dead/masked pixels
    • -
    • delta_dummy (float) – precision for dummy value
    • -
    • polarization_factor (float) – polarization factor between -1 (vertical) and +1 (horizontal). 0 for circular polarization or random, None for no correction
    • -
    • dark (ndarray) – dark noise image
    • -
    • flat (ndarray) – flat field image
    • -
    • method (str) – can be “numpy”, “cython”, “BBox” or “splitpixel”, “lut”, “csr; “lut_ocl” and “csr_ocl” if you want to go on GPU. To Specify the device: “csr_ocl_1,2”
    • -
    • unit (pyFAI.units.Enum) – Output units, can be “q_nm^-1”, “q_A^-1”, “2th_deg”, “2th_rad”, “r_mm” for now
    • -
    • safe (bool) – Do some extra checks to ensure LUT is still valid. False is faster.
    • -
    • normalization_factor (float) – Value of a normalization monitor
    • -
    • all – if true, return many more intermediate results as a dict.
    • -
    -
    Returns:

    azimuthaly regrouped intensity, q/2theta/r pos. and chi pos.

    -
    Return type:

    3-tuple of ndarrays (2d, 1d, 1d)

    -
    Parameters:flat_list (list) – List of dark used
    -
    -makeHeaders(hdr='#', dark=None, flat=None, polarization_factor=None, normalization_factor=None)
    -
    +
    +set_images(image_list)
    +

    Defines the set set of source images to used to process an average.

    +
    - - - - - +
    Parameters:
      -
    • hdr (str) – string used as comment in the header
    • -
    • dark – save the darks filenames (default: no)
    • -
    • flat – save the flat filenames (default: no)
    • -
    • polarization_factor (float) – the polarization factor
    • -
    -
    Returns:

    the header

    -
    Return type:

    str

    -
    Parameters:image_list (list) – List of filename, numpy arrays, fabio images +used as source for the computation.
    -
    -reset()
    -

    Reset azimuthal integrator in addition to other arrays.

    +
    +set_monitor_name(monitor_name)
    +

    Defines the monitor name used to correct images before processing +the average. This monitor must be part of the file header, else the +image is skipped.

    + +++ + + + +
    Parameters:monitor_name (str) – Name of the monitor available on the header +file
    -
    -save1D(filename, dim1, I, error=None, dim1_unit=2th_deg, dark=None, flat=None, polarization_factor=None, normalization_factor=None)
    -
    +
    +set_observer(observer)
    +

    Set an observer to the average process.

    +
    - +
    Parameters:
      -
    • filename (str) – the filename used to save the 1D integration
    • -
    • dim1 (numpy.ndarray) – the x coordinates of the integrated curve
    • -
    • I (numpy.mdarray) – The integrated intensity
    • -
    • error (numpy.ndarray or None) – the error bar for each intensity
    • -
    • dim1_unit (pyFAI.units.Unit) – the unit of the dim1 array
    • -
    • dark – save the darks filenames (default: no)
    • -
    • flat – save the flat filenames (default: no)
    • -
    • polarization_factor (float) – the polarization factor
    • -
    • normalization_factor (float) – the monitor value
    • -
    -
    Parameters:observer (AverageObserver) – An observer
    -

    This method save the result of a 1D integration.

    -
    -save2D(filename, I, dim1, dim2, error=None, dim1_unit=2th_deg, dark=None, flat=None, polarization_factor=None, normalization_factor=None)
    -
    +
    +set_pixel_filter(threshold, minimum, maximum)
    +

    Defines the filter applied on each pixels of the images before +processing the average.

    +
    Parameters:
      -
    • filename (str) – the filename used to save the 2D histogram
    • -
    • dim1 (numpy.ndarray) – the 1st coordinates of the histogram
    • -
    • dim1 – the 2nd coordinates of the histogram
    • -
    • I (numpy.mdarray) – The integrated intensity
    • -
    • error (numpy.ndarray or None) – the error bar for each intensity
    • -
    • dim1_unit (pyFAI.units.Unit) – the unit of the dim1 array
    • -
    • dark – save the darks filenames (default: no)
    • -
    • flat – save the flat filenames (default: no)
    • -
    • polarization_factor (float) – the polarization factor
    • -
    • normalization_factor (float) – the monitor value
    • +
    • threshold – what is the upper limit? +all pixel > max*(1-threshold) are discareded.
    • +
    • minimum – minimum valid value or True
    • +
    • maximum – maximum valid value
    -

    This method save the result of a 2D integration.

    -
    -saxs(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    - -
    -
    -separate(data, npt_rad=1024, npt_azim=512, unit='2th_deg', method='splitpixel', percentile=50, mask=None, restore_mask=True)
    -

    Separate bragg signal from powder/amorphous signal using azimuthal integration, -median filering and projected back before subtraction.

    +
    +set_writer(writer)
    +

    Defines the object write which will be used to store the result.

    - - - +
    Parameters:
      -
    • data – input image as numpy array
    • -
    • npt_rad – number of radial points
    • -
    • npt_azim – number of azimuthal points
    • -
    • unit – unit to be used for integration
    • -
    • method – pathway for integration and sort
    • -
    • percentile – which percentile use for cutting out
    • -
    • mask – masked out pixels array
    • -
    • restore_mask – masked pixels have the same value as input data provided
    • -
    -
    Returns:

    bragg, amorphous

    -
    Parameters:writer (AverageWriter) – The writer to use.
    + + +
    +
    +class pyFAI.average.AverageDarkFilter(filter_name, cut_off, quantiles)
    +

    Bases: pyFAI.average.ImageStackFilter

    +

    Filter based on the algorithm of average_dark

    +

    TODO: Must be split according to each filter_name, and removed

    -
    -set_darkcurrent(dark)
    +
    +__init__(filter_name, cut_off, quantiles)
    -
    -set_darkfiles(files=None, method='mean')
    -
    --- - - - -
    Parameters:
      -
    • files (str or list(str) or None) – file(s) used to compute the dark.
    • -
    • method (str) – method used to compute the dark, “mean” or “median”
    • -
    -
    -

    Set the dark current from one or mutliple files, avaraged -according to the method provided

    +
    +get_parameters()
    +

    Return a dictionary containing filter parameters

    -
    -
    -set_empty(value)
    +
    +
    +name
    +
    + +
    +
    +class pyFAI.average.AverageObserver
    +

    Bases: object

    -
    -set_flatfield(flat)
    -
    +
    +algorithm_finished(algorithm)
    +

    Called when an algorithm is finished

    +
    -
    -set_flatfiles(files, method='mean')
    -
    +
    +algorithm_started(algorithm)
    +

    Called when an algorithm is started

    +
    + +
    +
    +frame_processed(algorithm, frame_index, frames_count)
    +

    Called after providing a frame to an algorithm

    +
    + +
    +
    +image_loaded(fabio_image, image_index, images_count)
    +

    Called when an input image is loaded

    +
    + +
    +
    +process_finished()
    +

    Called when the full process is finished

    +
    + +
    +
    +process_started()
    +

    Called when the full processing is started

    +
    + +
    +
    +result_processing(algorithm)
    +

    Called before the result of an algorithm is computed

    +
    + + + +
    +
    +class pyFAI.average.AverageWriter
    +

    Interface for using writer in Average process.

    +
    +
    +close()
    +

    Close the writer. Must not be used anymore.

    +
    + +
    +
    +write_header(merged_files, nb_frames, monitor_name)
    +

    Write the header of the average

    +
    Parameters:
      -
    • files (str or list(str) or None) – file(s) used to compute the dark.
    • -
    • method (str) – method used to compute the dark, “mean” or “median”
    • +
    • merged_files (list) – List of files used to generate this output
    • +
    • nb_frames (int) – Number of frames used
    • +
    • monitor_name (str) – Name of the monitor used. Can be None.
    -

    Set the flat field from one or mutliple files, averaged -according to the method provided

    -
    -setup_CSR(shape, npt, mask=None, pos0_range=None, pos1_range=None, mask_checksum=None, unit=2th_deg, split='bbox')
    -

    Prepare a look-up-table

    +
    +write_reduction(algorithm, data)
    +

    Write one reduction

    Parameters:
      -
    • shape ((int, int)) – shape of the dataset
    • -
    • npt (int or (int, int)) – number of points in the the output pattern
    • -
    • mask (ndarray) – array with masked pixel (1=masked)
    • -
    • pos0_range ((float, float)) – range in radial dimension
    • -
    • pos1_range ((float, float)) – range in azimuthal dimension
    • -
    • mask_checksum (int (or anything else ...)) – checksum of the mask buffer
    • -
    • unit (pyFAI.units.Enum) – use to propagate the LUT object for further checkings
    • -
    • split – Splitting scheme: valid options are “no”, “bbox”, “full”
    • +
    • algorithm (ImageReductionFilter) – Algorithm used
    • +
    • data (object) – Data of this reduction
    -

    This method is called when a look-up table needs to be set-up. -The shape parameter, correspond to the shape of the original -datatset. It is possible to customize the number of point of -the output histogram with the npt parameter which can be -either an integer for an 1D integration or a 2-tuple of -integer in case of a 2D integration. The LUT will have a -different shape: (npt, lut_max_size), the later parameter -being calculated during the instanciation of the splitBBoxLUT -class.

    -

    It is possible to prepare the LUT with a predefine -mask. This operation can speedup the computation of the -later integrations. Instead of applying the patch on the -dataset, it is taken into account during the histogram -computation. If provided the mask_checksum prevent the -re-calculation of the mask. When the mask changes, its -checksum is used to reset (or not) the LUT (which is a very -time consuming operation !)

    -

    It is also possible to restrain the range of the 1D or 2D -pattern with the pos1_range and pos2_range.

    -

    The unit parameter is just propagated to the LUT integrator -for further checkings: The aim is to prevent an integration to -be performed in 2th-space when the LUT was setup in q space.

    + + +
    +
    +class pyFAI.average.ImageAccumulatorFilter
    +

    Bases: pyFAI.average.ImageReductionFilter

    +

    Filter applied in a set of images in which it is possible +to reduce data step by step into a single merged image.

    -
    -setup_LUT(shape, npt, mask=None, pos0_range=None, pos1_range=None, mask_checksum=None, unit=2th_deg)
    -

    Prepare a look-up-table

    +
    +add_image(image)
    +

    Add an image to the filter.

    - +
    Parameters:
      -
    • shape ((int, int)) – shape of the dataset
    • -
    • npt (int or (int, int)) – number of points in the the output pattern
    • -
    • mask (ndarray) – array with masked pixel (1=masked)
    • -
    • pos0_range ((float, float)) – range in radial dimension
    • -
    • pos1_range ((float, float)) – range in azimuthal dimension
    • -
    • mask_checksum (int (or anything else ...)) – checksum of the mask buffer
    • -
    • unit (pyFAI.units.Enum) – use to propagate the LUT object for further checkings
    • -
    -
    Parameters:image (numpy.ndarray) – image to add
    -

    This method is called when a look-up table needs to be set-up. -The shape parameter, correspond to the shape of the original -datatset. It is possible to customize the number of point of -the output histogram with the npt parameter which can be -either an integer for an 1D integration or a 2-tuple of -integer in case of a 2D integration. The LUT will have a -different shape: (npt, lut_max_size), the later parameter -being calculated during the instanciation of the splitBBoxLUT -class.

    -

    It is possible to prepare the LUT with a predefine -mask. This operation can speedup the computation of the -later integrations. Instead of applying the patch on the -dataset, it is taken into account during the histogram -computation. If provided the mask_checksum prevent the -re-calculation of the mask. When the mask changes, its -checksum is used to reset (or not) the LUT (which is a very -time consuming operation !)

    -

    It is also possible to restrain the range of the 1D or 2D -pattern with the pos1_range and pos2_range.

    -

    The unit parameter is just propagated to the LUT integrator -for further checkings: The aim is to prevent an integration to -be performed in 2th-space when the LUT was setup in q space.

    -
    -xrpd(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +get_result()
    +

    Get the result of the filter.

    + +++ + + + + + +
    Returns:result filter
    Return type:numpy.ndarray
    -
    -xrpd2(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    +
    +init(max_images=None)
    +
    -
    -
    -xrpd2_histogram(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +
    +class pyFAI.average.ImageReductionFilter
    +

    Bases: object

    +

    Generic filter applied in a set of images.

    -
    -xrpd2_numpy(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +add_image(image)
    +

    Add an image to the filter.

    + +++ + + + +
    Parameters:image (numpy.ndarray) – image to add
    -
    -xrpd2_splitBBox(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +get_parameters()
    +

    Return a dictionary containing filter parameters

    + +++ + + + +
    Return type:dict
    -
    -xrpd2_splitPixel(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +get_result()
    +

    Get the result of the filter.

    + +++ + + + +
    Returns:result filter
    -
    -xrpd_CSR_OCL(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +init(max_images=None)
    +

    Initialize the filter before using it.

    + +++ + + + +
    Parameters:max_images (int) – Max images supported by the filter
    -
    -
    -xrpd_LUT(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +
    +class pyFAI.average.ImageStackFilter
    +

    Bases: pyFAI.average.ImageReductionFilter

    +

    Filter creating a stack from all images and computing everything at the +end.

    -
    -xrpd_LUT_OCL(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +add_image(image)
    +

    Add an image to the filter.

    + +++ + + + +
    Parameters:image (numpy.ndarray) – image to add
    -
    -xrpd_OpenCL(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    +
    +get_result()
    +
    -
    -xrpd_cython(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    +
    +init(max_images=None)
    +
    -
    -
    -xrpd_numpy(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    -
    -xrpd_splitBBox(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +
    +class pyFAI.average.MaxAveraging
    +

    Bases: pyFAI.average.ImageAccumulatorFilter

    +
    +
    +name = 'max'
    +
    +
    +
    +
    +class pyFAI.average.MeanAveraging
    +

    Bases: pyFAI.average.SumAveraging

    -
    -xrpd_splitPixel(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    +
    +get_result()
    +
    + +
    +
    +name = 'mean'
    +
    -
    -
    -

    integrate_widget Module

    -

    pyFAI-integrate

    -

    A graphical tool (based on PyQt4) for performing azimuthal integration on series of files.

    -
    -class pyFAI.integrate_widget.AIWidget(input_data=None, output_path=None, output_format=None, slow_dim=None, fast_dim=None, json_file='.azimint.json')
    -

    Bases: PyQt4.QtGui.QWidget

    +
    +class pyFAI.average.MinAveraging
    +

    Bases: pyFAI.average.ImageAccumulatorFilter

    -
    -URL = 'http://pyfai.readthedocs.org/en/latest/man/pyFAI-integrate.html'
    +
    +name = 'min'
    -
    -
    -assign_unit()
    -

    assign unit to the corresponding widget

    -
    -
    -detector_changed()
    -
    - -
    -
    -die()
    -
    - -
    -
    -dump(filename=None)
    -

    Dump the status of the current widget to a file in JSON

    - --- - - - - - -
    Parameters:filename (string) – path where to save the config
    Returns:dict with configuration
    +
    +
    +exception pyFAI.average.MonitorNotFound
    +

    Bases: exceptions.Exception

    +

    Raised when monitor information in not found or is not valid.

    +
    +
    +class pyFAI.average.MultiFilesAverageWriter(file_name_pattern, file_format, dry_run=False)
    +

    Bases: pyFAI.average.AverageWriter

    +

    Write reductions into multi files. File headers are duplicated.

    -
    -get_config()
    -

    Read the configuration of the plugin and returns it as a dictionary

    - +
    +__init__(file_name_pattern, file_format, dry_run=False)
    +
    - +
    Returns:dict with all information.
    Parameters:
      +
    • file_name_pattern (str) – File name pattern for the output files. +If it contains “{method_name}”, it is updated for each +reduction writing with the name of the reduction.
    • +
    • file_format (str) – File format used. It is the default +extension file.
    • +
    • dry_run (bool) – If dry_run, the file is created on memory but not +saved on the file system at the end
    • +
    +
    -
    -get_method()
    -

    Return the method name for azimuthal intgration

    +
    +close()
    +

    Close the writer. Must not be used anymore.

    -
    -help()
    -
    - -
    -
    -openCL_changed()
    -
    - -
    -
    -platform_changed()
    -
    - -
    -
    -proceed()
    -
    - -
    -
    -restore(filename='.azimint.json')
    -

    Restore from JSON file the status of the current widget

    +
    +get_fabio_image(algorithm)
    +

    Get the constructed fabio image

    - +
    Parameters:filename (str) – path where the config was saved
    Return type:fabio.fabioimage.FabioImage
    -
    -save_config()
    -
    - -
    -
    -select_darkcurrent()
    -
    - -
    -
    -select_flatfield()
    +
    +write_header(merged_files, nb_frames, monitor_name)
    -
    -select_maskfile()
    +
    +write_reduction(algorithm, data)
    -
    -
    -select_ponifile()
    -
    +
    -
    -
    -select_splinefile()
    +
    +
    +class pyFAI.average.SumAveraging
    +

    Bases: pyFAI.average.ImageAccumulatorFilter

    +
    +
    +name = 'sum'
    -
    -
    -setStackDataObject(stack, stack_name=None)
    -
    +
    -
    -
    -set_config(dico)
    -

    Setup the widget from its description

    +
    +
    +pyFAI.average.average_dark(lstimg, center_method='mean', cutoff=None, quantiles=(0.5, 0.5))
    +

    Averages a serie of dark (or flat) images. +Centers the result on the mean or the median ... +but averages all frames within cutoff*std

    - + + +
    Parameters:dico (dict) – dictionary with description of the widget
    Parameters:
      +
    • lstimg – list of 2D images or a 3D stack
    • +
    • center_method (str) – is the center calculated by a “mean”, “median”, +“quantile”, “std”
    • +
    • cutoff (float or None) – keep all data where (I-center)/std < cutoff
    • +
    • quantiles (tuple(float, float) or None) – 2-tuple of floats average out data between the two +quantiles
    • +
    +
    Returns:

    2D image averaged

    +
    -
    -
    -set_input_data(stack, stack_name=None)
    -
    - -
    -
    -set_ponifile(ponifile=None)
    -
    - -
    -
    -set_validators()
    -

    Set all validators for text entries

    -
    - -
    - -
    -
    -class pyFAI.integrate_widget.Browser(default_url='http://google.com')
    -

    Bases: PyQt4.QtGui.QMainWindow

    -
    -
    -browse()
    -

    Make a web browse on a specific url and show the page on the -Webview widget.

    -
    - -
    - -
    -
    -

    geometry Module

    -
    -
    -class pyFAI.geometry.Geometry(dist=1, poni1=0, poni2=0, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None)
    -

    Bases: object

    -

    This class is an azimuthal integrator based on P. Boesecke’s geometry and -histogram algorithm by Manolo S. del Rio and V.A Sole

    -

    Detector is assumed to be corrected from “raster orientation” effect. -It is not addressed here but rather in the Detector object or at read time. -Considering there is no tilt:

    -
      -
    • Detector fast dimension (dim2) is supposed to be horizontal -(dimension X of the image)
    • -
    • Detector slow dimension (dim1) is supposed to be vertical, upwards -(dimension Y of the image)
    • -
    • The third dimension is chose such as the referential is -orthonormal, so dim3 is along incoming X-ray beam
    • -
    -

    Axis 1 is along first dimension of detector (when not tilted), -this is the slow dimension of the image array in C or Y -x1={1,0,0}

    -

    Axis 2 is along second dimension of detector (when not tilted), -this is the fast dimension of the image in C or X -x2={0,1,0}

    -

    Axis 3 is along the incident X-Ray beam -x3={0,0,1}

    -

    We define the 3 rotation around axis 1, 2 and 3:

    -

    rotM1 = RotationMatrix[rot1,x1] = {{1,0,0},{0,cos[rot1],-sin[rot1]},{0,sin[rot1],cos[rot1]}} -rotM2 = RotationMatrix[rot2,x2] = {{cos[rot2],0,sin[rot2]},{0,1,0},{-sin[rot2],0,cos[rot2]}} -rotM3 = RotationMatrix[rot3,x3] = {{cos[rot3],-sin[rot3],0},{sin[rot3],cos[rot3],0},{0,0,1}}

    -

    Rotations of the detector are applied first Rot around axis 1, -then axis 2 and finally around axis 3:

    -

    R = rotM3.rotM2.rotM1

    -
    -
    R = {{cos[rot2] cos[rot3],cos[rot3] sin[rot1] sin[rot2]-cos[rot1] sin[rot3],cos[rot1] cos[rot3] sin[rot2]+sin[rot1] sin[rot3]},
    -
    {cos[rot2] sin[rot3],cos[rot1] cos[rot3]+sin[rot1] sin[rot2] sin[rot3],-cos[rot3] sin[rot1]+cos[rot1] sin[rot2] sin[rot3]}, -{-sin[rot2],cos[rot2] sin[rot1],cos[rot1] cos[rot2]}}
    -
    -

    In Python notation:

    -

    R.x1 = [cos(rot2)*cos(rot3),cos(rot2)*sin(rot3),-sin(rot2)]

    -

    R.x2 = [cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3),cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3), cos(rot2)*sin(rot1)]

    -

    R.x3 = [cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3),-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3), cos(rot1)*cos(rot2)]

    -
      -
    • Coordinates of the Point of Normal Incidence:

      -

      PONI = R.{0,0,L}

      -
      -
      PONI = [L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)),
      -

      L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)),L*cos(rot1)*cos(rot2)]

      -
      -
      -
    • -
    • Any pixel on detector plan at coordinate (d1, d2) in -meters. Detector is at z=L

      -

      P={d1,d2,L}

      -

      R.P = [t1, t2, t3] -t1 = R.P.x1 = d1*cos(rot2)*cos(rot3) + d2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) + L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) -t2 = R.P.x2 = d1*cos(rot2)*sin(rot3) + d2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) + L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) -t3 = R.P.x3 = d2*cos(rot2)*sin(rot1) - d1*sin(rot2) + L*cos(rot1)*cos(rot2)

      -
    • -
    • Distance sample (origin) to detector point (d1,d2)

      -
      -
      |R.P| = sqrt(pow(Abs(L*cos(rot1)*cos(rot2) + d2*cos(rot2)*sin(rot1) - d1*sin(rot2)),2) +
      -

      pow(Abs(d1*cos(rot2)*cos(rot3) + d2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) + -L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3))),2) + -pow(Abs(d1*cos(rot2)*sin(rot3) + L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + -d2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3))),2))

      -
      -
      -
    • -
    • cos(2theta) is defined as (R.P component along x3) over the distance from origin to data point |R.P|

      -
    • -
    -

    tth = ArcCos [-(R.P).x3/|R.P|]

    -
    -
    tth = Arccos((-(L*cos(rot1)*cos(rot2)) - d2*cos(rot2)*sin(rot1) + d1*sin(rot2))/
    -
    -
    sqrt(pow(Abs(L*cos(rot1)*cos(rot2) + d2*cos(rot2)*sin(rot1) - d1*sin(rot2)),2) +
    -
    -
    pow(Abs(d1*cos(rot2)*cos(rot3) + d2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) +
    -
    -
    L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3))),2) +
    -
    pow(Abs(d1*cos(rot2)*sin(rot3) + L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) +
    -
    -

    d2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3))),2)))

    -
    -
    -
    -
    -
      -
    • tan(2theta) is defined as sqrt(t1**2 + t2**2) / t3
    • -
    -

    tth = ArcTan2 [sqrt(t1**2 + t2**2) , t3 ]

    -

    Getting 2theta from it’s tangeant seems both more precise (around -beam stop very far from sample) and faster by about 25% Currently -there is a swich in the method to follow one path or the other.

    -
      -
    • Tangeant of angle chi is defined as (R.P component along x1) -over (R.P component along x2). Arctan2 should be used in actual -calculation
    • -
    -
    -

    chi = ArcTan[((R.P).x1) / ((R.P).x2)]

    -
    -
    chi = ArcTan2(d1*cos(rot2)*cos(rot3) + d2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) +
    -
    -
    L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)),
    -
    -
    d1*cos(rot2)*sin(rot3) + L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) +
    -
    d2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)))
    -
    -
    +
    +
    +pyFAI.average.average_images(listImages, output=None, threshold=0.1, minimum=None, maximum=None, darks=None, flats=None, filter_='mean', correct_flat_from_dark=False, cutoff=None, quantiles=None, fformat='edf', monitor_key=None)
    +
    +
    Takes a list of filenames and create an average frame discarding all
    +
    saturated pixels.
    -
    -
    -
    -array_from_unit(shape=None, typ='center', unit=2th_deg)
    -

    Generate an array of position in different dimentions (R, Q, -2Theta)

    - - -
    Parameters:
      -
    • shape (ndarray.shape) – shape of the expected array
    • -
    • typ (str) – “center”, “corner” or “delta”
    • -
    • unit (pyFAI.units.Enum) – can be Q, TTH, R for now
    • +
    • listImages – list of string representing the filenames
    • +
    • output – name of the optional output file
    • +
    • threshold – what is the upper limit? all pixel > max*(1-threshold) +are discareded.
    • +
    • minimum – minimum valid value or True
    • +
    • maximum – maximum valid value
    • +
    • darks – list of dark current images for subtraction
    • +
    • flats – list of flat field images for division
    • +
    • filter – can be “min”, “max”, “median”, “mean”, “sum”, “quantiles” +(default=’mean’)
    • +
    • correct_flat_from_dark – shall the flat be re-corrected ?
    • +
    • cutoff – keep all data where (I-center)/std < cutoff
    • +
    • quantiles – 2-tuple containing the lower and upper quantile (0<q<1) +to average out.
    • +
    • fformat – file format of the output image, default: edf
    • +
    • str (monitor_key) – Key containing the monitor. Can be none.
    Returns:

    R, Q or 2Theta array depending on unit

    -
    Return type:

    ndarray

    +
    Returns:

    filename with the data or the data ndarray in case format=None

    -
    -
    -calc_pos_zyx(d0=None, d1=None, d2=None, param=None, corners=False, use_cython=True)
    -

    Calculate the position of a set of points in space in the sample’s centers referential.

    -

    This is usually used for calculating the pixel position in space.

    +
    +
    +pyFAI.average.bounding_box(img)
    +

    Tries to guess the bounding box around a valid massif

    - + + +
    Parameters:
      -
    • d0 – altitude on the point compared to the detector (i.e. z), may be None
    • -
    • d1 – position on the detector along the slow dimention (i.e. y)
    • -
    • d2 – position on the detector along the fastest dimention (i.e. x)
    • -
    • corners – return positions on the corners (instead of center)
    • -
    -
    Parameters:img – 2D array like
    Returns:4-typle (d0_min, d1_min, d0_max, d1_max)
    -
    -
    :return 3-tuple of nd-array, with dim0=along the beam,
    -
    dim1=along slowest dimension -dim2=along fastest dimension
    -
    -
    -
    -calc_transmission(t0, shape=None)
    -

    Defines the absorption correction for a phosphor screen or a scintillator -from t0, the normal transmission of the screen.

    -
    -
    Icor = Iobs(1-t0)/(1-exp(ln(t0)/cos(incidence)))
    -
    1-exp(ln(t0)/cos(incidence)
    -
    let t = —————————–
    -
    1 - t0
    -
    -

    See reference on: -J. Appl. Cryst. (2002). 35, 356–359 G. Wu et al. CCD phosphor

    +
    +
    +pyFAI.average.common_prefix(string_list)
    +

    Return the common prefix of a list of strings

    +

    TODO: move it into utils package

    - + - +
    Parameters:
      -
    • t0 – value of the normal transmission (from 0 to 1)
    • -
    • shape – shape of the array
    • -
    -
    Parameters:string_list (list(str)) – List of strings
    Returns:

    actual

    -
    Return type:str
    -
    -
    -calcfrom1d(tth, I, shape=None, mask=None, dim1_unit=2th_deg, correctSolidAngle=True, dummy=0.0, polarization_factor=None, dark=None, flat=None)
    -

    Computes a 2D image from a 1D integrated profile

    +
    +
    +pyFAI.average.create_algorithm(filter_name, cut_off=None, quantiles=None)
    +

    Factory to create algorithm according to parameters

    - + + + + +
    Parameters:
      -
    • tth – 1D array with radial unit
    • -
    • I – scattering intensity
    • -
    • shape – shape of the image (if not defined by the detector)
    • -
    • dim1_unit – unit for the “tth” array
    • -
    • correctSolidAngle
    • -
    • dummy – value for masked pixels
    • -
    • polarization_factor – set to true to use previously used value
    • -
    • dark – dark current correction
    • -
    • flat – flatfield corrction
    • +
    • cutoff (float or None) – keep all data where (I-center)/std < cutoff
    • +
    • quantiles (tuple(float, float) or None) – 2-tuple of floats average out data between the two +quantiles
    Returns:

    2D image reconstructed

    +
    Returns:

    An algorithm

    +
    Return type:

    ImageReductionFilter

    +
    Raises AlgorithmCreationError:
     

    If it is not possible to create the +algorithm

    -
    -
    -center_array(shape=None, unit='2th')
    -

    Generate a 2D array of the given shape with (i,j) (radial -angle ) for all elements.

    - --- - - - - - -
    Parameters:shape (2-tuple of integer) – expected shape
    Returns:3d array with shape=(*shape,4,2) the two elements are: -* dim3[0]: radial angle 2th, q, r, ... -* dim3[1]: azimuthal angle chi
    +
    +
    +pyFAI.average.f
    +

    alias of SumAveraging

    -
    -
    -chi(d1, d2, path='cython')
    -

    Calculate the chi (azimuthal angle) for the centre of a pixel -at coordinate d1,d2 which in the lab ref has coordinate:

    -

    X1 = p1*cos(rot2)*cos(rot3) + p2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) - L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) -X2 = p1*cos(rot2)*sin(rot3) - L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + p2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) -X3 = -(L*cos(rot1)*cos(rot2)) + p2*cos(rot2)*sin(rot1) - p1*sin(rot2) -hence tan(Chi) = X2 / X1

    +
    +
    +pyFAI.average.is_algorithm_name_exists(filter_name)
    +

    Return true if the name is a name of a filter algorithm

    +
    + +
    +
    +pyFAI.average.remove_saturated_pixel(ds, threshold=0.1, minimum=None, maximum=None)
    +

    Remove saturated fixes from an array inplace.

    -
    Parameters:
      -
    • d1 (float or array of them) – pixel coordinate along the 1st dimention (C convention)
    • -
    • d2 (float or array of them) – pixel coordinate along the 2nd dimention (C convention)
    • -
    • path – can be “tan” (i.e via numpy) or “cython”
    • +
    • ds – a dataset as ndarray
    • +
    • threshold (float) – what is the upper limit? +all pixel > max*(1-threshold) are discareded.
    • +
    • minimum (float) – minumum valid value (or True for auto-guess)
    • +
    • maximum (float) – maximum valid value
    Returns:

    chi, the azimuthal angle in rad

    +
    Returns:

    the input dataset

    +
    +
    +

    azimuthalIntegrator Module

    +
    +
    +class pyFAI.azimuthalIntegrator.AzimuthalIntegrator(dist=1, poni1=0, poni2=0, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None)
    +

    Bases: pyFAI.geometry.Geometry

    +

    This class is an azimuthal integrator based on P. Boesecke’s +geometry and histogram algorithm by Manolo S. del Rio and V.A Sole

    +

    All geometry calculation are done in the Geometry class

    +

    main methods are:

    +
    >>> tth, I = ai.integrate1d(data, npt, unit="2th_deg")
    +>>> q, I, sigma = ai.integrate1d(data, npt, unit="q_nm^-1", error_model="poisson")
    +>>> regrouped = ai.integrate2d(data, npt_rad, npt_azim, unit="q_nm^-1")[0]
    +
    +
    +
    +
    +DEFAULT_METHOD = 'splitbbox'
    +
    +
    -
    -chiArray(shape=None)
    -

    Generate an array of azimuthal angle chi(i,j) for all elements in the detector.

    -

    Azimuthal angles are in radians

    -

    Nota: Refers to the pixel centers !

    - +
    +__init__(dist=1, poni1=0, poni2=0, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None)
    +
    - - - +
    Parameters:shape – the shape of the chi array
    Returns:the chi array as numpy.ndarray
    Parameters:
      +
    • dist (float) – distance sample - detector plan (orthogonal distance, not along the beam), in meter.
    • +
    • poni1 (float) – coordinate of the point of normal incidence along the detector’s first dimension, in meter
    • +
    • poni2 (float) – coordinate of the point of normal incidence along the detector’s second dimension, in meter
    • +
    • rot1 (float) – first rotation from sample ref to detector’s ref, in radians
    • +
    • rot2 (float) – second rotation from sample ref to detector’s ref, in radians
    • +
    • rot3 (float) – third rotation from sample ref to detector’s ref, in radians
    • +
    • pixel1 (float) – Deprecated. Pixel size of the fist dimension of the detector, in meter. +If both pixel1 and pixel2 are not None, detector pixel size is overwritten. +Prefer defining the detector pixel size on the provided detector object. +Prefer defining the detector pixel size on the provided detector +object (detector.pixel1 = 5e-6).
    • +
    • pixel2 (float) – Deprecated. Pixel size of the second dimension of the detector, in meter. +If both pixel1 and pixel2 are not None, detector pixel size is overwritten. +Prefer defining the detector pixel size on the provided detector +object (detector.pixel2 = 5e-6).
    • +
    • splineFile (str) – Deprecated. File containing the geometric distortion of the detector. +If not None, pixel1 and pixel2 are ignored and detector spline is overwritten. +Prefer defining the detector spline manually +(detector.splineFile = "file.spline").
    • +
    • detector (str or pyFAI.Detector) – name of the detector or Detector instance. String +description is deprecated. Prefer using the result of the detector +factory: pyFAI.detector_factory("eiger4m")
    • +
    • wavelength (float) – Wave length used in meter
    • +
    +
    -
    -chi_corner(d1, d2)
    -

    Calculate the chi (azimuthal angle) for the corner of a pixel -at coordinate d1,d2 which in the lab ref has coordinate:

    -

    X1 = p1*cos(rot2)*cos(rot3) + p2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) - L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) -X2 = p1*cos(rot2)*sin(rot3) - L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + p2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) -X3 = -(L*cos(rot1)*cos(rot2)) + p2*cos(rot2)*sin(rot1) - p1*sin(rot2) -hence tan(Chi) = X2 / X1

    +
    +create_mask(data, mask=None, dummy=None, delta_dummy=None, mode='normal')
    +

    Combines various masks into another one.

    - + +
    Parameters:
      -
    • d1 (float or array of them) – pixel coordinate along the 1st dimention (C convention)
    • -
    • d2 (float or array of them) – pixel coordinate along the 2nd dimention (C convention)
    • +
    • data (ndarray) – input array of data
    • +
    • mask (ndarray) – input mask (if none, self.mask is used)
    • +
    • dummy (float) – value of dead pixels
    • +
    • delta_dumy – precision of dummy pixels
    • +
    • mode (str) – can be “normal” or “numpy” (inverted) or “where” applied to the mask
    Returns:

    chi, the azimuthal angle in rad

    +
    Returns:

    the new mask

    +
    Return type:

    ndarray of bool

    -
    - -
    -
    -chia
    -

    chi array in cache

    -
    - -
    -
    -cornerArray(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    - -
    -
    -cornerQArray(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    - -
    -
    -cornerRArray(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    - -
    -
    -cornerRd2Array(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +

    This method combine two masks (dynamic mask from data & +dummy and mask) to generate a new one with the ‘or’ binary +operation. One can adjust the level, with the dummy and +the delta_dummy parameter, when you consider the data +values needs to be masked out.

    +

    This method can work in two different mode:

    +
    +
      +
    • “normal”: False for valid pixels, True for bad pixels
    • +
    • “numpy”: True for valid pixels, false for others
    • +
    +
    +

    This method tries to accomodate various types of masks (like +valid=0 & masked=-1, ...) and guesses if an input mask needs +to be inverted.

    -
    -corner_array(shape=None, unit='2th', use_cython=True)
    -

    Generate a 3D array of the given shape with (i,j) (radial -angle 2th, azimuthal angle chi ) for all elements.

    +
    +dark_correction(data, dark=None)
    +

    Correct for Dark-current effects. +If dark is not defined, correct for a dark set by “set_darkfiles”

    - + - +
    Parameters:shape (2-tuple of integer) – expected shape
    Parameters:
      +
    • data – input ndarray with the image
    • +
    • dark – ndarray with dark noise or None
    • +
    +
    Returns:3d array with shape=(*shape,4,2) the two elements are: -* dim3[0]: radial angle 2th, q, r, ... -* dim3[1]: azimuthal angle chi
    Returns:

    2tuple: corrected_data, dark_actually used (or None)

    +
    -
    -correct_SA_spline
    +
    +darkcurrent
    +
    + +
    +
    +empty
    -
    -cosIncidance(d1, d2, path='cython')
    -

    Calculate the incidence angle (alpha) for current pixels (P). -The poni being the point of normal incidence, -it’s incidence angle is ${alpha} = 0$ hence $cos({alpha}) = 1$

    +
    +flat_correction(data, flat=None)
    +

    Correct for flat field. +If flat is not defined, correct for a flat set by “set_flatfiles”

    -
    Parameters:
      -
    • d1 – 1d or 2d set of points in pixel coord
    • -
    • d2 – 1d or 2d set of points in pixel coord
    • +
    • data – input ndarray with the image
    • +
    • dark – ndarray with dark noise or None
    Returns:

    cosine of the incidence angle

    +
    Returns:

    2tuple: corrected_data, flat_actually used (or None)

    -
    -
    -del_chia()
    -
    - -
    -
    -del_dssa()
    +
    +
    +flatfield
    -
    -del_qa()
    +
    +get_darkcurrent()
    -
    -del_ra()
    +
    +get_empty()
    -
    -del_ttha()
    +
    +get_flatfield()
    -
    -delta2Theta(shape=None)
    -

    Generate a 3D array of the given shape with (i,j) with the max -distance between the center and any corner in 2 theta

    +
    +integrate1d(data, npt, filename=None, correctSolidAngle=True, variance=None, error_model=None, radial_range=None, azimuth_range=None, mask=None, dummy=None, delta_dummy=None, polarization_factor=None, dark=None, flat=None, method='csr', unit=q_nm^-1, safe=True, normalization_factor=1.0, block_size=32, profile=False, all=False)
    +

    Calculate the azimuthal integrated Saxs curve in q(nm^-1) by default

    +

    Multi algorithm implementation (tries to be bullet proof), suitable for SAXS, WAXS, ... and much more

    - - - + - -
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:2D-array containing the max delta angle between a pixel center and any corner in 2theta-angle (rad)
    Parameters:
      +
    • data (ndarray) – 2D array from the Detector/CCD camera
    • +
    • npt (int) – number of points in the output pattern
    • +
    • filename (str) – output filename in 2/3 column ascii format
    • +
    • correctSolidAngle (bool) – correct for solid angle of each pixel if True
    • +
    • variance (ndarray) – array containing the variance of the data. If not available, no error propagation is done
    • +
    • error_model (str) – When the variance is unknown, an error model can be given: “poisson” (variance = I), “azimuthal” (variance = (I-<I>)^2)
    • +
    • radial_range ((float, float), optional) – The lower and upper range of the radial unit. If not provided, range is simply (data.min(), data.max()). Values outside the range are ignored.
    • +
    • azimuth_range ((float, float), optional) – The lower and upper range of the azimuthal angle in degree. If not provided, range is simply (data.min(), data.max()). Values outside the range are ignored.
    • +
    • mask (ndarray) – array (same size as image) with 1 for masked pixels, and 0 for valid pixels
    • +
    • dummy (float) – value for dead/masked pixels
    • +
    • delta_dummy (float) – precision for dummy value
    • +
    • polarization_factor (float) – polarization factor between -1 (vertical) and +1 (horizontal). +0 for circular polarization or random, +None for no correction, +True for using the former correction
    • +
    • dark (ndarray) – dark noise image
    • +
    • flat (ndarray) – flat field image
    • +
    • method (str) – can be “numpy”, “cython”, “BBox” or “splitpixel”, “lut”, “csr”, “nosplit_csr”, “full_csr”, “lut_ocl” and “csr_ocl” if you want to go on GPU. To Specify the device: “csr_ocl_1,2”
    • +
    • unit (pyFAI.units.Enum) – Output units, can be “q_nm^-1”, “q_A^-1”, “2th_deg”, “2th_rad”, “r_mm” for now
    • +
    • safe (bool) – Do some extra checks to ensure LUT/CSR is still valid. False is faster.
    • +
    • normalization_factor (float) – Value of a normalization monitor
    • +
    • block_size – size of the block for OpenCL integration (unused?)
    • +
    • profile – set to True to enable profiling in OpenCL
    • +
    • all (bool) – if true return a dictionary with many more parameters (deprecated, please refer to the documentation of Integrate1dResult).
    • +
    +
    -
    - -
    -
    -deltaChi(shape=None)
    -

    Generate a 3D array of the given shape with (i,j) with the max -distance between the center and any corner in chi-angle (rad)

    - --- - + - +
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:

    q/2th/r bins center positions and regrouped intensity (and error array if variance or variance model provided), uneless all==True.

    +
    Returns:2D-array containing the max delta angle between a pixel center and any corner in chi-angle (rad)
    Return type:

    Integrate1dResult, dict

    +
    -
    -deltaQ(shape=None)
    -

    Generate a 2D array of the given shape with (i,j) with the max -distance between the center and any corner in q_vector unit -(nm^-1)

    +
    +integrate2d(data, npt_rad, npt_azim=360, filename=None, correctSolidAngle=True, variance=None, error_model=None, radial_range=None, azimuth_range=None, mask=None, dummy=None, delta_dummy=None, polarization_factor=None, dark=None, flat=None, method='bbox', unit=q_nm^-1, safe=True, normalization_factor=1.0, all=False)
    +

    Calculate the azimuthal regrouped 2d image in q(nm^-1)/chi(deg) by default

    +

    Multi algorithm implementation (tries to be bullet proof)

    - - - + + + + +
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:array 2D containing the max delta Q between a pixel center and any corner in q_vector unit (nm^-1)
    Parameters:
      +
    • data (ndarray) – 2D array from the Detector/CCD camera
    • +
    • npt_rad (int) – number of points in the radial direction
    • +
    • npt_azim (int) – number of points in the azimuthal direction
    • +
    • filename (str) – output image (as edf format)
    • +
    • correctSolidAngle (bool) – correct for solid angle of each pixel if True
    • +
    • variance (ndarray) – array containing the variance of the data. If not available, no error propagation is done
    • +
    • error_model (str) – When the variance is unknown, an error model can be given: “poisson” (variance = I), “azimuthal” (variance = (I-<I>)^2)
    • +
    • radial_range ((float, float), optional) – The lower and upper range of the radial unit. If not provided, range is simply (data.min(), data.max()). Values outside the range are ignored.
    • +
    • azimuth_range ((float, float), optional) – The lower and upper range of the azimuthal angle in degree. If not provided, range is simply (data.min(), data.max()). Values outside the range are ignored.
    • +
    • mask (ndarray) – array (same size as image) with 1 for masked pixels, and 0 for valid pixels
    • +
    • dummy (float) – value for dead/masked pixels
    • +
    • delta_dummy (float) – precision for dummy value
    • +
    • polarization_factor (float) – polarization factor between -1 (vertical) and +1 (horizontal). 0 for circular polarization or random, None for no correction
    • +
    • dark (ndarray) – dark noise image
    • +
    • flat (ndarray) – flat field image
    • +
    • method (str) – can be “numpy”, “cython”, “BBox” or “splitpixel”, “lut”, “csr; “lut_ocl” and “csr_ocl” if you want to go on GPU. To Specify the device: “csr_ocl_1,2”
    • +
    • unit (pyFAI.units.Enum) – Output units, can be “q_nm^-1”, “q_A^-1”, “2th_deg”, “2th_rad”, “r_mm” for now
    • +
    • safe (bool) – Do some extra checks to ensure LUT is still valid. False is faster.
    • +
    • normalization_factor (float) – Value of a normalization monitor
    • +
    • all (bool) – if true, return many more intermediate results as a dict (deprecated, please refer to the documentation of Integrate2dResult).
    • +
    +
    Returns:

    azimuthaly regrouped intensity, q/2theta/r pos. and chi pos.

    +
    Return type:

    Integrate2dResult, dict

    +
    -
    -deltaR(shape=None)
    -

    Generate a 2D array of the given shape with (i,j) with the max -distance between the center and any corner in radius unit (mm)

    - +
    +reset()
    +

    Reset azimuthal integrator in addition to other arrays.

    +
    + +
    +
    +save1D(filename, dim1, I, error=None, dim1_unit=2th_deg, has_dark=False, has_flat=False, polarization_factor=None, normalization_factor=None)
    +
    - - - +
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:array 2D containing the max delta Q between a pixel center and any corner in q_vector unit (nm^-1)
    Parameters:
      +
    • filename (str) – the filename used to save the 1D integration
    • +
    • dim1 (numpy.ndarray) – the x coordinates of the integrated curve
    • +
    • I (numpy.mdarray) – The integrated intensity
    • +
    • error (numpy.ndarray or None) – the error bar for each intensity
    • +
    • dim1_unit (pyFAI.units.Unit) – the unit of the dim1 array
    • +
    • has_dark (bool) – save the darks filenames (default: no)
    • +
    • has_flat (bool) – save the flat filenames (default: no)
    • +
    • polarization_factor (float) – the polarization factor
    • +
    • normalization_factor (float) – the monitor value
    • +
    +
    +

    This method save the result of a 1D integration.

    -
    -deltaRd2(shape=None)
    -

    Generate a 2D array of the given shape with (i,j) with the max -distance between the center and any corner in unit: reciprocal spacing squarred (1/nm^2)

    - +
    +save2D(filename, I, dim1, dim2, error=None, dim1_unit=2th_deg, has_dark=False, has_flat=False, polarization_factor=None, normalization_factor=None)
    +
    - - - +
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:array 2D containing the max delta (d*)^2 between a pixel center and any corner in reciprocal spacing squarred (1/nm^2)
    Parameters:
      +
    • filename (str) – the filename used to save the 2D histogram
    • +
    • dim1 (numpy.ndarray) – the 1st coordinates of the histogram
    • +
    • dim1 – the 2nd coordinates of the histogram
    • +
    • I (numpy.mdarray) – The integrated intensity
    • +
    • error (numpy.ndarray or None) – the error bar for each intensity
    • +
    • dim1_unit (pyFAI.units.Unit) – the unit of the dim1 array
    • +
    • has_dark (bool) – save the darks filenames (default: no)
    • +
    • has_flat (bool) – save the flat filenames (default: no)
    • +
    • polarization_factor (float) – the polarization factor
    • +
    • normalization_factor (float) – the monitor value
    • +
    +
    +

    This method save the result of a 2D integration.

    -
    -delta_array(shape=None, unit='2th')
    -

    Generate a 2D array of the given shape with (i,j) (delta-radial -angle) for all elements.

    +
    +saxs(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    + +
    +
    +separate(data, npt_rad=1024, npt_azim=512, unit='2th_deg', method='splitpixel', percentile=50, mask=None, restore_mask=True)
    +

    Separate bragg signal from powder/amorphous signal using azimuthal integration, +median filering and projected back before subtraction.

    - + - +
    Parameters:shape (2-tuple of integer) – expected shape
    Parameters:
      +
    • data – input image as numpy array
    • +
    • npt_rad – number of radial points
    • +
    • npt_azim – number of azimuthal points
    • +
    • unit – unit to be used for integration
    • +
    • method – pathway for integration and sort
    • +
    • percentile – which percentile use for cutting out
    • +
    • mask – masked out pixels array
    • +
    • restore_mask – masked pixels have the same value as input data provided
    • +
    +
    Returns:3d array with shape=(*shape,4,2) the two elements are: -* dim3[0]: radial angle 2th, q, r, ... -* dim3[1]: azimuthal angle chi
    Returns:

    bragg, amorphous

    +
    -
    -diffSolidAngle(d1, d2)
    -

    Calculate the solid angle of the current pixels (P) versus the PONI (C)

    -
    -
    Omega(P) A cos(a) SC^2 3 SC^3
    -
    -
    dOmega = ——— = ——— x ——— = cos (a) = ——
    -
    Omega(C) SP^2 A cos(0) SP^3
    -
    -

    cos(a) = SC/SP

    - +
    +set_darkcurrent(dark)
    +
    + +
    +
    +set_darkfiles(files=None, method='mean')
    +
    - - -
    Parameters:
      -
    • d1 – 1d or 2d set of points
    • -
    • d2 – 1d or 2d set of points (same size&shape as d1)
    • +
    Parameters:
      +
    • files (str or list(str) or None) – file(s) used to compute the dark.
    • +
    • method (str) – method used to compute the dark, “mean” or “median”
    Returns:

    solid angle correction array

    -
    +

    Set the dark current from one or mutliple files, avaraged +according to the method provided

    -
    -
    -dist
    +
    +
    +set_empty(value)
    -
    -
    -dssa
    -

    solid angle array in cache

    -
    +
    +
    +set_flatfield(flat)
    +
    -
    -getFit2D()
    -

    Export geometry setup with the geometry of Fit2D

    - +
    +set_flatfiles(files, method='mean')
    +
    - +
    Returns:dict with parameters compatible with fit2D geometry
    Parameters:
      +
    • files (str or list(str) or None) – file(s) used to compute the dark.
    • +
    • method (str) – method used to compute the dark, “mean” or “median”
    • +
    +
    +

    Set the flat field from one or mutliple files, averaged +according to the method provided

    -
    -getPyFAI()
    -

    Export geometry setup with the geometry of PyFAI

    +
    +setup_CSR(shape, npt, mask=None, pos0_range=None, pos1_range=None, mask_checksum=None, unit=2th_deg, split='bbox')
    +

    Prepare a look-up-table

    - +
    Returns:dict with the parameter-set of the PyFAI geometry
    Parameters:
      +
    • shape ((int, int)) – shape of the dataset
    • +
    • npt (int or (int, int)) – number of points in the the output pattern
    • +
    • mask (ndarray) – array with masked pixel (1=masked)
    • +
    • pos0_range ((float, float)) – range in radial dimension
    • +
    • pos1_range ((float, float)) – range in azimuthal dimension
    • +
    • mask_checksum (int (or anything else ...)) – checksum of the mask buffer
    • +
    • unit (pyFAI.units.Enum) – use to propagate the LUT object for further checkings
    • +
    • split – Splitting scheme: valid options are “no”, “bbox”, “full”
    • +
    +
    +

    This method is called when a look-up table needs to be set-up. +The shape parameter, correspond to the shape of the original +datatset. It is possible to customize the number of point of +the output histogram with the npt parameter which can be +either an integer for an 1D integration or a 2-tuple of +integer in case of a 2D integration. The LUT will have a +different shape: (npt, lut_max_size), the later parameter +being calculated during the instanciation of the splitBBoxLUT +class.

    +

    It is possible to prepare the LUT with a predefine +mask. This operation can speedup the computation of the +later integrations. Instead of applying the patch on the +dataset, it is taken into account during the histogram +computation. If provided the mask_checksum prevent the +re-calculation of the mask. When the mask changes, its +checksum is used to reset (or not) the LUT (which is a very +time consuming operation !)

    +

    It is also possible to restrain the range of the 1D or 2D +pattern with the pos1_range and pos2_range.

    +

    The unit parameter is just propagated to the LUT integrator +for further checkings: The aim is to prevent an integration to +be performed in 2th-space when the LUT was setup in q space.

    -
    -getSPD()
    -

    get the SPD like parameter set: For geometry description see -Peter Boesecke J.Appl.Cryst.(2007).40, s423–s427

    -

    Basically the main difference with pyFAI is the order of the axis which are flipped

    +
    +setup_LUT(shape, npt, mask=None, pos0_range=None, pos1_range=None, mask_checksum=None, unit=2th_deg)
    +

    Prepare a look-up-table

    - +
    Returns:dictionnary with those parameters: -SampleDistance: distance from sample to detector at the PONI (orthogonal projection) -Center_1, pixel position of the PONI along fastest axis -Center_2: pixel position of the PONI along slowest axis -Rot_1: rotation around the fastest axis (x) -Rot_2: rotation around the slowest axis (y) -Rot_3: rotation around the axis ORTHOGONAL to the detector plan -PSize_1: pixel size in meter along the fastest dimention -PSize_2: pixel size in meter along the slowst dimention -splineFile: name of the file containing the spline -BSize_1: pixel binning factor along the fastest dimention -BSize_2: pixel binning factor along the slowst dimention -WaveLength: wavelength used in meter
    Parameters:
      +
    • shape ((int, int)) – shape of the dataset
    • +
    • npt (int or (int, int)) – number of points in the the output pattern
    • +
    • mask (ndarray) – array with masked pixel (1=masked)
    • +
    • pos0_range ((float, float)) – range in radial dimension
    • +
    • pos1_range ((float, float)) – range in azimuthal dimension
    • +
    • mask_checksum (int (or anything else ...)) – checksum of the mask buffer
    • +
    • unit (pyFAI.units.Enum) – use to propagate the LUT object for further checkings
    • +
    +
    +

    This method is called when a look-up table needs to be set-up. +The shape parameter, correspond to the shape of the original +datatset. It is possible to customize the number of point of +the output histogram with the npt parameter which can be +either an integer for an 1D integration or a 2-tuple of +integer in case of a 2D integration. The LUT will have a +different shape: (npt, lut_max_size), the later parameter +being calculated during the instanciation of the splitBBoxLUT +class.

    +

    It is possible to prepare the LUT with a predefine +mask. This operation can speedup the computation of the +later integrations. Instead of applying the patch on the +dataset, it is taken into account during the histogram +computation. If provided the mask_checksum prevent the +re-calculation of the mask. When the mask changes, its +checksum is used to reset (or not) the LUT (which is a very +time consuming operation !)

    +

    It is also possible to restrain the range of the 1D or 2D +pattern with the pos1_range and pos2_range.

    +

    The unit parameter is just propagated to the LUT integrator +for further checkings: The aim is to prevent an integration to +be performed in 2th-space when the LUT was setup in q space.

    -
    -get_chia()
    -
    +
    +xrpd(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_correct_solid_angle_for_spline()
    -
    - -
    -
    -get_dist()
    -
    - -
    -
    -get_dssa()
    -
    - -
    -
    -get_mask()
    -
    +
    +xrpd2(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_maskfile()
    -
    +
    +xrpd2_histogram(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_pixel1()
    -
    +
    +xrpd2_numpy(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_pixel2()
    -
    +
    +xrpd2_splitBBox(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_poni1()
    -
    +
    +xrpd2_splitPixel(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_poni2()
    -
    +
    +xrpd_CSR_OCL(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_qa()
    -
    +
    +xrpd_LUT(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_ra()
    -
    +
    +xrpd_LUT_OCL(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_rot1()
    -
    +
    +xrpd_OpenCL(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_rot2()
    -
    +
    +xrpd_cython(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_rot3()
    -
    +
    +xrpd_numpy(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -get_shape(shape=None)
    -

    Guess what is the best shape .... -:param shape: force this value (2-tuple of int) -:return: 2-tuple of int

    +
    +xrpd_splitBBox(*arg, **kw)
    +

    decorator that deprecates the use of a function

    -
    -get_spline()
    -
    +
    +xrpd_splitPixel(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -
    -get_splineFile()
    -
    + +
    +
    +

    multi_geometry Module

    +

    Module for treating simultaneously multiple detector configuration +within a single integration

    +
    +
    +class pyFAI.multi_geometry.MultiGeometry(ais, unit='2th_deg', radial_range=(0, 180), azimuth_range=(-180, 180), wavelength=None, empty=0.0, chi_disc=180)
    +

    Bases: object

    +

    This is an Azimuthal integrator containing multiple geometries (when +the detector is on a goniometer arm)

    -
    -get_ttha()
    -
    +
    +__init__(ais, unit='2th_deg', radial_range=(0, 180), azimuth_range=(-180, 180), wavelength=None, empty=0.0, chi_disc=180)
    +

    Constructor of the multi-geometry integrator +:param ais: list of azimuthal integrators +:param radial_range: common range for integration +:param azimuthal_range: common range for integration +:param empty: value for empty pixels +:param chi_disc: if 0, set the chi_discontinuity at

    +
    -
    -get_wavelength()
    -
    +
    +integrate1d(lst_data, npt=1800, correctSolidAngle=True, lst_variance=None, error_model=None, polarization_factor=None, monitors=None, all=False, lst_mask=None, lst_flat=None)
    +

    Perform 1D azimuthal integration

    + +++ + + + + + + + +
    Parameters:
      +
    • lst_data – list of numpy array
    • +
    • npt – number of points int the integration
    • +
    • correctSolidAngle – correct for solid angle (all processing are then done in absolute solid angle !)
    • +
    • lst_variance (list of ndarray) – list of array containing the variance of the data. If not available, no error propagation is done
    • +
    • error_model (str) – When the variance is unknown, an error model can be given: “poisson” (variance = I), “azimuthal” (variance = (I-<I>)^2)
    • +
    • polarization_factor – Apply polarization correction ? is None: not applies. Else provide a value from -1 to +1
    • +
    • monitors – normalization monitors value (list of floats)
    • +
    • all – return a dict with all information in it (deprecated, please refer to the documentation of Integrate1dResult).
    • +
    • lst_mask – numpy.Array or list of numpy.array which mask the lst_data.
    • +
    • lst_flat – numpy.Array or list of numpy.array which flat the lst_data.
    • +
    +
    Returns:

    2th/I or a dict with everything depending on “all”

    +
    Return type:

    Integrate1dResult, dict

    +
    +
    -
    -load(filename)
    -

    Load the refined parameters from a file.

    +
    +integrate2d(lst_data, npt_rad=1800, npt_azim=3600, correctSolidAngle=True, lst_variance=None, error_model=None, polarization_factor=None, monitors=None, all=False, lst_mask=None, lst_flat=None)
    +

    Performs 2D azimuthal integration of multiples frames, one for each geometry

    - + + + + +
    Parameters:filename (string) – name of the file to load
    Parameters:
      +
    • lst_data – list of numpy array
    • +
    • npt – number of points int the integration
    • +
    • correctSolidAngle – correct for solid angle (all processing are then done in absolute solid angle !)
    • +
    • lst_variance (list of ndarray) – list of array containing the variance of the data. If not available, no error propagation is done
    • +
    • error_model (str) – When the variance is unknown, an error model can be given: “poisson” (variance = I), “azimuthal” (variance = (I-<I>)^2)
    • +
    • polarization_factor – Apply polarization correction ? is None: not applies. Else provide a value from -1 to +1
    • +
    • monitors – normalization monitors value (list of floats)
    • +
    • all – return a dict with all information in it (deprecated, please refer to the documentation of Integrate2dResult).
    • +
    • lst_mask – numpy.Array or list of numpy.array which mask the lst_data.
    • +
    • lst_flat – numpy.Array or list of numpy.array which flat the lst_data.
    • +
    +
    Returns:

    I/2th/chi or a dict with everything depending on “all”

    +
    Return type:

    Integrate2dResult, dict

    +
    -
    -
    -mask
    -
    +
    +
    +set_wavelength(value)
    +

    Changes the wavelength of a group of azimuthal integrators

    +
    + + +
    +
    +

    integrate_widget Module

    +

    pyFAI-integrate

    +

    A graphical tool for performing azimuthal integration on series of files.

    +
    +
    +class pyFAI.integrate_widget.AIWidget(input_data=None, output_path=None, output_format=None, slow_dim=None, fast_dim=None, json_file='.azimint.json')
    +

    Bases: PyQt4.QtGui.QWidget

    -
    -maskfile
    +
    +URL = 'http://pyfai.readthedocs.org/en/latest/man/pyFAI-integrate.html'
    -
    -oversampleArray(myarray)
    +
    +__init__(input_data=None, output_path=None, output_format=None, slow_dim=None, fast_dim=None, json_file='.azimint.json')
    -
    -
    -pixel1
    +
    +
    +assign_unit()
    +

    assign unit to the corresponding widget

    +
    + +
    +
    +detector_changed()
    -
    -
    -pixel2
    +
    +
    +die()
    -
    -polarization(shape=None, factor=None, axis_offset=0)
    -

    Calculate the polarization correction accoding to the -polarization factor:

    -
      -
    • If the polarization factor is None, the correction is not applied (returns 1)
    • -
    • If the polarization factor is 0 (circular polarization), the correction correspond to (1+(cos2θ)^2)/2
    • -
    • If the polarization factor is 1 (linear horizontal polarization), there is no correction in the vertical plane and a node at 2th=90, chi=0
    • -
    • If the polarization factor is -1 (linear vertical polarization), there is no correction in the horizontal plane and a node at 2th=90, chi=90
    • -
    • If the polarization is elliptical, the polarization factor varies between -1 and +1.
    • -
    -

    The axis_offset parameter allows correction for the misalignement of the polarization plane (or ellipse main axis) and the the detector’s X axis.

    +
    +dump(filename=None)
    +

    Dump the status of the current widget to a file in JSON

    - + - +
    Parameters:
      -
    • factor – (Ih-Iv)/(Ih+Iv): varies between 0 (no polarization) and 1 (where division by 0 could occure at 2th=90, chi=0)
    • -
    • axis_offset – Angle between the polarization main axis and detector X direction (in radians !!!)
    • -
    -
    Parameters:filename (string) – path where to save the config
    Returns:

    2D array with polarization correction array (intensity/polarisation)

    -
    Returns:dict with configuration
    -
    -
    -poni1
    -
    - -
    -
    -poni2
    -
    -
    -
    -positionArray(shape=None, corners=False, dtype=<type 'numpy.float64'>)
    -

    Generate an array for the pixel position given the shape of the detector.

    -

    if corners is False, the coordinates of the center of the pixel -is returned in an array of shape: (shape[0], shape[1], 3) -where the 3 coordinates are: -* z: along incident beam, -* y: to the top/sky, -* x: towards the center of the ring

    -

    If is True, the corner of each pixels are then returned. -the output shape is then (shape[0], shape[1], 4, 3)

    +
    +get_config()
    +

    Read the configuration of the plugin and returns it as a dictionary

    - - - +
    Parameters:
      -
    • shape – shape of the array expected
    • -
    • corners – set to true to receive a (...,4,3) array of corner positions
    • -
    • dtype – output format requested
    • -
    -
    Returns:

    3D coodinates as nd-array of size (...,3) or (...,3) (default)

    -
    Returns:dict with all information.
    -

    Nota: this value is not cached and actually generated on demand (costly)

    -
    -qArray(shape=None)
    -

    Generate an array of the given shape with q(i,j) for all -elements.

    +
    +get_method()
    +

    Return the method name for azimuthal intgration

    -
    -qCornerFunct(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    - +
    +help()
    +
    +
    -
    -qFunction(d1, d2, param=None, path='cython')
    -

    Calculates the q value for the center of a given pixel (or set -of pixels) in nm-1

    -

    q = 4pi/lambda sin( 2theta / 2 )

    +
    +openCL_changed()
    +
    + +
    +
    +platform_changed()
    +
    + +
    +
    +proceed()
    +
    + +
    +
    +restore(filename='.azimint.json')
    +

    Restore from JSON file the status of the current widget

    - - - - - +
    Parameters:
      -
    • d1 (scalar or array of scalar) – position(s) in pixel in first dimension (c order)
    • -
    • d2 (scalar or array of scalar) – position(s) in pixel in second dimension (c order)
    • -
    -
    Returns:

    q in in nm^(-1)

    -
    Return type:

    float or array of floats.

    -
    Parameters:filename (str) – path where the config was saved
    -
    -
    -qa
    -

    Q array in cache

    -
    +
    +
    +save_config()
    +
    -
    -rArray(shape=None)
    -

    Generate an array of the given shape with r(i,j) for all elements; -The radius r being in meters.

    +
    +select_darkcurrent()
    +
    + +
    +
    +select_flatfield()
    +
    + +
    +
    +select_maskfile()
    +
    + +
    +
    +select_ponifile()
    +
    + +
    +
    +select_splinefile()
    +
    + +
    +
    +setStackDataObject(stack, stack_name=None)
    +
    + +
    +
    +set_config(dico)
    +

    Setup the widget from its description

    - - - +
    Parameters:shape – expected shape of the detector
    Returns:2d array of the given shape with radius in m from beam center on detector.
    Parameters:dico (dict) – dictionary with description of the widget
    -
    -rCornerFunct(*arg, **kw)
    -

    decorator that deprecates the use of a function

    +
    +set_input_data(stack, stack_name=None)
    +
    + +
    +
    +set_ponifile(ponifile=None)
    +
    + +
    +
    +set_validators()
    +

    Set all validators for text entries

    +
    + +
    + +
    +
    +

    geometry Module

    +

    This modules contrains only one (large) class in charge of:

    +
      +
    • calculating the geometry, i.e. the position in the detector space of each pixel of the detector
    • +
    • manages caches to store intermediate results
    • +
    +
    +
    +class pyFAI.geometry.Geometry(dist=1, poni1=0, poni2=0, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None)
    +

    Bases: object

    +

    This class is an azimuthal integrator based on P. Boesecke’s geometry and +histogram algorithm by Manolo S. del Rio and V.A Sole

    +

    Detector is assumed to be corrected from “raster orientation” effect. +It is not addressed here but rather in the Detector object or at read time. +Considering there is no tilt:

    +
      +
    • Detector fast dimension (dim2) is supposed to be horizontal +(dimension X of the image)
    • +
    • Detector slow dimension (dim1) is supposed to be vertical, upwards +(dimension Y of the image)
    • +
    • The third dimension is chose such as the referential is +orthonormal, so dim3 is along incoming X-ray beam
    • +
    +

    Demonstration of the equation done using Mathematica:

    +
    Axis 1 is allong first dimension of detector (when not tilted), this is the slow dimension of the image array in C or Y
    +In[5]:= x1={1,0,0}
    +Out[5]= {1,0,0}
    + Axis 2 is allong second dimension of detector (when not tilted), this is the fast dimension of the image in C or X
    +In[6]:= x2={0,1,0}
    +Out[6]= {0,1,0}
    +Axis 3 is along the incident X-Ray beam
    +In[7]:= x3={0,0,1}
    +Out[7]= {0,0,1}
    +In[9]:= id3={x1,x2,x3}
    +Out[9]= {{1,0,0},{0,1,0},{0,0,1}}
    +In[10]:= {{1,0,0},{0,1,0},{0,0,1}}
    +Out[10]= {{1,0,0},{0,1,0},{0,0,1}}
    +In[11]:= rotM1=RotationMatrix[rot1,x1]
    +Out[11]= {{1,0,0},{0,Cos[rot1],-Sin[rot1]},{0,Sin[rot1],Cos[rot1]}}
    +In[12]:= rotM2 =  RotationMatrix[rot2,x2]
    +Out[12]= {{Cos[rot2],0,Sin[rot2]},{0,1,0},{-Sin[rot2],0,Cos[rot2]}}
    +In[13]:= rotM3 =  RotationMatrix[rot3,x3]
    +Out[13]= {{Cos[rot3],-Sin[rot3],0},{Sin[rot3],Cos[rot3],0},{0,0,1}}
    +Rotations of the detector are applied first Rot around axis 1, then axis 2 and finally around axis 3
    +In[14]:= R=rotM3.rotM2.rotM1
    +Out[14]= {{Cos[rot2] Cos[rot3],Cos[rot3] Sin[rot1] Sin[rot2]-Cos[rot1] Sin[rot3],Cos[rot1] Cos[rot3] Sin[rot2]+Sin[rot1] Sin[rot3]},{Cos[rot2] Sin[rot3],Cos[rot1] Cos[rot3]+Sin[rot1] Sin[rot2] Sin[rot3],-Cos[rot3] Sin[rot1]+Cos[rot1] Sin[rot2] Sin[rot3]},{-Sin[rot2],Cos[rot2] Sin[rot1],Cos[rot1] Cos[rot2]}}
    +In[15]:= CForm[R.x1]
    +
    +Out[15]//CForm=
    +List(Cos(rot2)*Cos(rot3),Cos(rot2)*Sin(rot3),-Sin(rot2))
    +In[16]:= CForm[R.x2]
    +
    +Out[16]//CForm=
    +List(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3),Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3),Cos(rot2)*Sin(rot1))
    +In[17]:= CForm[R.x3]
    +Out[17]//CForm=
    +List(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3),-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3),Cos(rot1)*Cos(rot2))
    +In[18]:= CForm[Det[R]]
    +Out[18]//CForm=
    +Power(Cos(rot1),2)*Power(Cos(rot2),2)*Power(Cos(rot3),2) + Power(Cos(rot2),2)*Power(Cos(rot3),2)*Power(Sin(rot1),2) + Power(Cos(rot1),2)*Power(Cos(rot3),2)*Power(Sin(rot2),2) + 
    +   Power(Cos(rot3),2)*Power(Sin(rot1),2)*Power(Sin(rot2),2) + Power(Cos(rot1),2)*Power(Cos(rot2),2)*Power(Sin(rot3),2) + Power(Cos(rot2),2)*Power(Sin(rot1),2)*Power(Sin(rot3),2) + 
    +   Power(Cos(rot1),2)*Power(Sin(rot2),2)*Power(Sin(rot3),2) + Power(Sin(rot1),2)*Power(Sin(rot2),2)*Power(Sin(rot3),2)
    +In[13]:=
    +Any pixel on detector plan at coordianate (d1, d2) in meters. Detector is at z=L
    +
    +In[22]:= P={d1,d2,L}
    +CForm[R.P]
    +
    +Out[22]= {d1,d2,L}
    +Out[23]//CForm=
    +List(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),
    +   d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2))
    +In[24]:= t1 = R.P.x1
    +CForm[t1]
    +Out[24]= d1 Cos[rot2] Cos[rot3]+d2 (Cos[rot3] Sin[rot1] Sin[rot2]-Cos[rot1] Sin[rot3])+L (Cos[rot1] Cos[rot3] Sin[rot2]+Sin[rot1] Sin[rot3])
    +Out[25]//CForm=
    +d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))
    +In[26]:= t2 = R.P.x2
    +CForm[t2]
    +Out[26]= d1 Cos[rot2] Sin[rot3]+L (-Cos[rot3] Sin[rot1]+Cos[rot1] Sin[rot2] Sin[rot3])+d2 (Cos[rot1] Cos[rot3]+Sin[rot1] Sin[rot2] Sin[rot3])
    +Out[27]//CForm=
    +d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3))
    +In[28]:= t3=R.P.x3
    +CForm[t3]
    +Out[28]= L Cos[rot1] Cos[rot2]+d2 Cos[rot2] Sin[rot1]-d1 Sin[rot2]
    +Out[29]//CForm=
    +L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2)
    +Distance sample to detector point (d1,d2)
    +(no Mathematica translations)
    +GraphicsBox[
    +TagBox[RasterBox[CompressedData["
    +1:eJxtUstqU1EUDY2iUdSOnBcERwGHDgQf+YNGOrAQSEBBBwlWQfsDcVKsI4sf
    +IAQnGSQtCQ4yyfvVvO69SW7J+9W8GtIkg8SwXfuQSpFu2Pdxzl5rr7XP2bDY
    +Nt+saTSaDzfx2DR/er6zY941XsPPi92Pry1afNxdJS9ejuFwqJNl+XMsFstE
    +o1HijEQio1Qq9bPZbD7SXBHtdnsjGAxK+Xyeut0uTadTms1mNBgMqFwuUyKR
    ++APOd5cxo9HoHjBqqVSis7Mzms/nlMlkyOfziX/GdzodSiaTpCjKqwscar6o
    +qkq9Xo/Oz89pb2+PjEYj2Ww22t7epn6/L/DcF/wdt9u9Di4tPAxarZbgZKzd
    +bmde4jCZTORyuUTPWq1G8Erwb0HdQ2gn+KZ6vU6np6eCm8PhcNDW1hZVKhWx
    +xvusH/P6jronwVCIcpJE2VxOvLvQ5Q8EyGAwkMfjERilUBCYCGrj8fiv8Xj8
    +IIAa1iVJMsnIIWZ4dHRE+1/3hW72pUgK5cALTzyfbzwX4Kt5WSb15IRU8M5w
    +BgcHB2S1WqkL3TxntVgU3CH0g7+XjGs0Gm/D4bDgZS/QQH6/n5xOp+iH/X8z
    +QY+0Xq9fZ9xyudRKknTIGpibZzOZTMQMcYeoWq1SNptlzMzr9T4G5PbFGS4W
    +C12hUHDwbNlHEbr4TMEn7hvW69DwDKV3kGv/3zfUPU2n0z+g6Rj+j/H+jXxv
    +Npvvr/por7qnq+C9G8hbq9Qhr18u+AttYAMa
    +"], {{0, 14}, {14, 0}}, {0, 255},
    +ColorFunction->RGBColor],
    +BoxForm`ImageTag["Byte", ColorSpace -> "RGB", Interleaving -> True],
    +Selectable->False],
    +BaseStyle->"ImageGraphics",
    +ImageSize->Magnification[1],
    +ImageSizeRaw->{14, 14},
    +PlotRange->{{0, 14}, {0, 14}}]
    +
    +
    +In[30]:= dist = Norm[R.P]
    +CForm[dist]
    +Out[30]= √(Abs[L Cos[rot1] Cos[rot2]+d2 Cos[rot2] Sin[rot1]-d1 Sin[rot2]]^2+Abs[d1 Cos[rot2] Cos[rot3]+d2 (Cos[rot3] Sin[rot1] Sin[rot2]-Cos[rot1] Sin[rot3])+L (Cos[rot1] Cos[rot3] Sin[rot2]+Sin[rot1] Sin[rot3])]^2+Abs[d1 Cos[rot2] Sin[rot3]+L (-Cos[rot3] Sin[rot1]+Cos[rot1] Sin[rot2] Sin[rot3])+d2 (Cos[rot1] Cos[rot3]+Sin[rot1] Sin[rot2] Sin[rot3])]^2)
    +Out[31]//CForm=
    +Sqrt(Power(Abs(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2)),2) + Power(Abs(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +       L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))),2) + Power(Abs(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3))),
    +     2))
    +cos(2theta) can be defined as (R.P component along x3) over the distance |R.P|
    +In[32]:= tthc = ArcCos [-(R.P).x3/Norm[R.P]]
    +CForm[tthc]
    +
    +Out[32]= ArcCos[(-L Cos[rot1] Cos[rot2]-d2 Cos[rot2] Sin[rot1]+d1 Sin[rot2])/(√(Abs[L Cos[rot1] Cos[rot2]+d2 Cos[rot2] Sin[rot1]-d1 Sin[rot2]]^2+Abs[d1 Cos[rot2] Cos[rot3]+d2 (Cos[rot3] Sin[rot1] Sin[rot2]-Cos[rot1] Sin[rot3])+L (Cos[rot1] Cos[rot3] Sin[rot2]+Sin[rot1] Sin[rot3])]^2+Abs[d1 Cos[rot2] Sin[rot3]+L (-Cos[rot3] Sin[rot1]+Cos[rot1] Sin[rot2] Sin[rot3])+d2 (Cos[rot1] Cos[rot3]+Sin[rot1] Sin[rot2] Sin[rot3])]^2))]
    +Out[33]//CForm=
    +ArcCos((-(L*Cos(rot1)*Cos(rot2)) - d2*Cos(rot2)*Sin(rot1) + d1*Sin(rot2))/
    +    Sqrt(Power(Abs(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2)),2) + Power(Abs(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +         L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))),2) + Power(Abs(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + 
    +         d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3))),2)))
    +
    +
    +
    +In[41]:= ttht = ArcTan[t3,Sqrt[t1^2 + t2^2]]
    +
    +CForm[ttht]
    +
    +
    +Out[41]= ArcTan[L Cos[rot1] Cos[rot2]+d2 Cos[rot2] Sin[rot1]-d1 Sin[rot2],√((d1 Cos[rot2] Cos[rot3]+d2 (Cos[rot3] Sin[rot1] Sin[rot2]-Cos[rot1] Sin[rot3])+L (Cos[rot1] Cos[rot3] Sin[rot2]+Sin[rot1] Sin[rot3]))^2+(d1 Cos[rot2] Sin[rot3]+L (-Cos[rot3] Sin[rot1]+Cos[rot1] Sin[rot2] Sin[rot3])+d2 (Cos[rot1] Cos[rot3]+Sin[rot1] Sin[rot2] Sin[rot3]))^2)]
    +Out[42]//CForm=
    +ArcTan(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),
    +      2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))
    +Tangeant of angle chi is defined as (R.P component along x1) over (R.P component along x2). Arctan2 should be used in actual calculation
    +In[36]:= chi =ArcTan[t1  , t2]
    +CForm[chi]
    +Out[36]= ArcTan[d1 Cos[rot2] Cos[rot3]+d2 (Cos[rot3] Sin[rot1] Sin[rot2]-Cos[rot1] Sin[rot3])+L (Cos[rot1] Cos[rot3] Sin[rot2]+Sin[rot1] Sin[rot3]),d1 Cos[rot2] Sin[rot3]+L (-Cos[rot3] Sin[rot1]+Cos[rot1] Sin[rot2] Sin[rot3])+d2 (Cos[rot1] Cos[rot3]+Sin[rot1] Sin[rot2] Sin[rot3])]
    +Out[37]//CForm=
    +ArcTan(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),
    +   d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)))
    +Coodinates of the Point of Normal Incidence
    +
    +In[38]:= PONI = R.{0,0,L}
    +CForm[PONI]
    +Out[38]= {L (Cos[rot1] Cos[rot3] Sin[rot2]+Sin[rot1] Sin[rot3]),L (-Cos[rot3] Sin[rot1]+Cos[rot1] Sin[rot2] Sin[rot3]),L Cos[rot1] Cos[rot2]}
    +Out[39]//CForm=
    +List(L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)),L*Cos(rot1)*Cos(rot2))
    +Derivatives of 2Theta
    +In[43]:= CForm[D[ttht,d1]]
    +Out[43]//CForm=
    +((L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2))*(2*Cos(rot2)*Cos(rot3)*(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +           L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))) + 2*Cos(rot2)*Sin(rot3)*
    +         (d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)))))/
    +    (2.*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))*
    +      (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +          L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))
    +     + (Sin(rot2)*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))/
    +    (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),
    +       2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))
    +In[44]:= CForm[D[ttht,d2]]
    +
    +Out[44]//CForm=
    +((L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2))*(2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3))*
    +         (d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))) + 
    +        2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3))*(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)))))/
    +    (2.*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))*
    +      (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +          L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))
    +     - (Cos(rot2)*Sin(rot1)*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))/
    +    (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),
    +       2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))
    +In[47]:= CForm[D[ttht,L]]
    +Out[47]//CForm=
    +((L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2))*(2*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))*
    +         (d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))) + 
    +        2*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3))*(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)))))/
    +    (2.*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))*
    +      (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +          L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))
    +     - (Cos(rot1)*Cos(rot2)*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))/
    +    (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),
    +       2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))
    +In[48]:= CForm[D[ttht,rot1]]
    +Out[48]//CForm=
    +((L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2))*(2*(L*(-(Cos(rot3)*Sin(rot1)*Sin(rot2)) + Cos(rot1)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)))*
    +         (d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))) + 
    +        2*(d2*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + L*(-(Cos(rot1)*Cos(rot3)) - Sin(rot1)*Sin(rot2)*Sin(rot3)))*
    +         (d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)))))/
    +    (2.*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))*
    +      (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +          L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))
    +     - ((d2*Cos(rot1)*Cos(rot2) - L*Cos(rot2)*Sin(rot1))*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))/
    +    (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),
    +       2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))
    +In[49]:= CForm[D[ttht,rot2]]
    +Out[49]//CForm=
    +((L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2))*(2*(L*Cos(rot1)*Cos(rot2)*Cos(rot3) + d2*Cos(rot2)*Cos(rot3)*Sin(rot1) - d1*Cos(rot3)*Sin(rot2))*
    +         (d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3))) + 
    +        2*(L*Cos(rot1)*Cos(rot2)*Sin(rot3) + d2*Cos(rot2)*Sin(rot1)*Sin(rot3) - d1*Sin(rot2)*Sin(rot3))*
    +         (d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)))))/
    +    (2.*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +        Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))*
    +      (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +          L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))
    +     - ((-(d1*Cos(rot2)) - L*Cos(rot1)*Sin(rot2) - d2*Sin(rot1)*Sin(rot2))*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +          L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))
    +     /(Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +        L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))
    +In[50]:= CForm[D[ttht,rot3]]
    +Out[50]//CForm=
    +((L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2))*(2*(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)))*
    +        (-(d1*Cos(rot2)*Sin(rot3)) + L*(Cos(rot3)*Sin(rot1) - Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(-(Cos(rot1)*Cos(rot3)) - Sin(rot1)*Sin(rot2)*Sin(rot3))) + 
    +       2*(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)))*
    +        (d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)))))/
    +   (2.*Sqrt(Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + 
    +       Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2))*
    +     (Power(L*Cos(rot1)*Cos(rot2) + d2*Cos(rot2)*Sin(rot1) - d1*Sin(rot2),2) + Power(d1*Cos(rot2)*Cos(rot3) + d2*(Cos(rot3)*Sin(rot1)*Sin(rot2) - Cos(rot1)*Sin(rot3)) + 
    +         L*(Cos(rot1)*Cos(rot3)*Sin(rot2) + Sin(rot1)*Sin(rot3)),2) + Power(d1*Cos(rot2)*Sin(rot3) + L*(-(Cos(rot3)*Sin(rot1)) + Cos(rot1)*Sin(rot2)*Sin(rot3)) + d2*(Cos(rot1)*Cos(rot3) + Sin(rot1)*Sin(rot2)*Sin(rot3)),2)))
    +
    +
    +
    +
    +__init__(dist=1, poni1=0, poni2=0, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None)
    +
    +++ + + + +
    Parameters:
      +
    • dist – distance sample - detector plan (orthogonal distance, not along the beam), in meter.
    • +
    • poni1 – coordinate of the point of normal incidence along the detector’s first dimension, in meter
    • +
    • poni2 – coordinate of the point of normal incidence along the detector’s second dimension, in meter
    • +
    • rot1 – first rotation from sample ref to detector’s ref, in radians
    • +
    • rot2 – second rotation from sample ref to detector’s ref, in radians
    • +
    • rot3 – third rotation from sample ref to detector’s ref, in radians
    • +
    • pixel1 (float) – Deprecated. Pixel size of the fist dimension of the detector, in meter. +If both pixel1 and pixel2 are not None, detector pixel size is overwritten. +Prefer defining the detector pixel size on the provided detector object. +Prefer defining the detector pixel size on the provided detector +object (detector.pixel1 = 5e-6).
    • +
    • pixel2 (float) – Deprecated. Pixel size of the second dimension of the detector, in meter. +If both pixel1 and pixel2 are not None, detector pixel size is overwritten. +Prefer defining the detector pixel size on the provided detector +object (detector.pixel2 = 5e-6).
    • +
    • splineFile (str) – Deprecated. File containing the geometric distortion of the detector. +If not None, pixel1 and pixel2 are ignored and detector spline is overwritten. +Prefer defining the detector spline manually +(detector.splineFile = "file.spline").
    • +
    • detector (str or pyFAI.Detector) – name of the detector or Detector instance. String +description is deprecated. Prefer using the result of the detector +factory: pyFAI.detector_factory("eiger4m")
    • +
    • wavelength (float) – Wave length used in meter
    • +
    +
    -
    -rFunction(d1, d2, param=None, path='cython')
    -

    Calculates the radius value for the center of a given pixel -(or set of pixels) in m

    -
    -
    r = distance to the incident beam
    +
    +array_from_unit(shape=None, typ='center', unit=2th_deg)
    +

    Generate an array of position in different dimentions (R, Q, +2Theta)

    - -
    Parameters:
      -
    • d1 (scalar or array of scalar) – position(s) in pixel in first dimension (c order)
    • -
    • d2 (scalar or array of scalar) – position(s) in pixel in second dimension (c order)
    • +
    • shape (ndarray.shape) – shape of the expected array
    • +
    • typ (str) – “center”, “corner” or “delta”
    • +
    • unit (pyFAI.units.Enum) – can be Q, TTH, R for now
    Returns:

    r in in m

    +
    Returns:

    R, Q or 2Theta array depending on unit

    Return type:

    float or array of floats.

    +
    Return type:

    ndarray

    -
    -
    -ra
    -

    R array in cache

    -
    -
    -
    -rd2Array(shape=None)
    -

    Generate an array of the given shape with (d*(i,j))^2 for all pixels.

    -

    d*^2 is the reciprocal spacing squared in inverse nm squared

    +
    +calc_pos_zyx(d0=None, d1=None, d2=None, param=None, corners=False, use_cython=True)
    +

    Calculate the position of a set of points in space in the sample’s centers referential.

    +

    This is usually used for calculating the pixel position in space.

    - + + +
    Parameters:shape – expected shape of the detector
    Parameters:
      +
    • d0 – altitude on the point compared to the detector (i.e. z), may be None
    • +
    • d1 – position on the detector along the slow dimention (i.e. y)
    • +
    • d2 – position on the detector along the fastest dimention (i.e. x)
    • +
    • corners – return positions on the corners (instead of center)
    • +
    +
    Returns:

    3-tuple of nd-array, with dim0=along the beam, +dim1=along slowest dimension +dim2=along fastest dimension

    +
    -

    :return:2d array of the given shape with reciprocal spacing squared

    -
    -read(filename)
    -

    Load the refined parameters from a file.

    +
    +calc_transmission(t0, shape=None)
    +

    Defines the absorption correction for a phosphor screen or a scintillator +from t0, the normal transmission of the screen.

    +
    +

    Icor = \frac{Iobs(1-t0)}{1-exp(ln(t0)/cos(incidence))}
+
+let_t = \frac{1-exp(ln(t0)/cos(incidence))}{1 - t0}

    +

    See reference on: +J. Appl. Cryst. (2002). 35, 356–359 G. Wu et al. CCD phosphor

    - + + +
    Parameters:filename (string) – name of the file to load
    Parameters:
      +
    • t0 – value of the normal transmission (from 0 to 1)
    • +
    • shape – shape of the array
    • +
    +
    Returns:

    actual

    +
    -
    -reset()
    -

    reset most arrays that are cached: used when a parameter -changes.

    -
    - -
    -
    -rot1
    -
    - -
    -
    -rot2
    -
    - -
    -
    -rot3
    -
    - -
    -
    -save(filename)
    -

    Save the geometry parameters.

    +
    +calcfrom1d(tth, I, shape=None, mask=None, dim1_unit=2th_deg, correctSolidAngle=True, dummy=0.0, polarization_factor=None, dark=None, flat=None)
    +

    Computes a 2D image from a 1D integrated profile

    - + + +
    Parameters:filename (string) – name of the file where to save the parameters
    Parameters:
      +
    • tth – 1D array with radial unit
    • +
    • I – scattering intensity
    • +
    • shape – shape of the image (if not defined by the detector)
    • +
    • dim1_unit – unit for the “tth” array
    • +
    • correctSolidAngle
    • +
    • dummy – value for masked pixels
    • +
    • polarization_factor – set to true to use previously used value
    • +
    • dark – dark current correction
    • +
    • flat – flatfield corrction
    • +
    +
    Returns:

    2D image reconstructed

    +
    -
    -setChiDiscAtPi()
    -

    Set the position of the discontinuity of the chi axis between --pi and +pi. This is the default behavour

    -
    - -
    -
    -setChiDiscAtZero()
    -

    Set the position of the discontinuity of the chi axis between -0 and 2pi. By default it is between pi and -pi

    +
    +center_array(shape=None, unit='2th')
    +

    Generate a 2D array of the given shape with (i,j) (radial +angle ) for all elements.

    + +++ + + + + + +
    Parameters:shape (2-tuple of integer) – expected shape
    Returns:3d array with shape=(*shape,4,2) the two elements are: +- dim3[0]: radial angle 2th, q, r... +- dim3[1]: azimuthal angle chi
    -
    -setFit2D(directDist, centerX, centerY, tilt=0.0, tiltPlanRotation=0.0, pixelX=None, pixelY=None, splineFile=None)
    -

    Set the Fit2D-like parameter set: For geometry description see -HPR 1996 (14) pp-240

    -

    Warning: Fit2D flips automatically images depending on their file-format. -By reverse engineering we noticed this behavour for Tiff and Mar345 images (at least). -To obtaine correct result you will have to flip images using numpy.flipud.

    +
    +chi(d1, d2, path='cython')
    +

    Calculate the chi (azimuthal angle) for the centre of a pixel +at coordinate d1,d2 which in the lab ref has coordinate:

    +

    X1 = p1*cos(rot2)*cos(rot3) + p2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) - L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) +X2 = p1*cos(rot2)*sin(rot3) - L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + p2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) +X3 = -(L*cos(rot1)*cos(rot2)) + p2*cos(rot2)*sin(rot1) - p1*sin(rot2) +hence tan(Chi) = X2 / X1

    - + +
    Parameters:
      -
    • direct – direct distance from sample to detector along the incident beam (in millimeter as in fit2d)
    • -
    • tilt – tilt in degrees
    • -
    • tiltPlanRotation – Rotation (in degrees) of the tilt plan arround the Z-detector axis -* 0deg -> Y does not move, +X goes to Z<0 -* 90deg -> X does not move, +Y goes to Z<0 -* 180deg -> Y does not move, +X goes to Z>0 -* 270deg -> X does not move, +Y goes to Z>0
    • -
    • pixelX,pixelY – as in fit2d they ar given in micron, not in meter
    • -
    • centerY (centerX,) – pixel position of the beam center
    • -
    • splineFile – name of the file containing the spline
    • +
    Parameters:
      +
    • d1 (float or array of them) – pixel coordinate along the 1st dimention (C convention)
    • +
    • d2 (float or array of them) – pixel coordinate along the 2nd dimention (C convention)
    • +
    • path – can be “tan” (i.e via numpy) or “cython”
    Returns:

    chi, the azimuthal angle in rad

    +
    -
    -setOversampling(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    - -
    -
    -setPyFAI(**kwargs)
    -

    set the geometry from a pyFAI-like dict

    +
    +chiArray(shape=None)
    +

    Generate an array of azimuthal angle chi(i,j) for all elements in the detector.

    +

    Azimuthal angles are in radians

    +

    Nota: Refers to the pixel centers !

    + +++ + + + + + +
    Parameters:shape – the shape of the chi array
    Returns:the chi array as numpy.ndarray
    -
    -setSPD(SampleDistance, Center_1, Center_2, Rot_1=0, Rot_2=0, Rot_3=0, PSize_1=None, PSize_2=None, splineFile=None, BSize_1=1, BSize_2=1, WaveLength=None)
    -

    Set the SPD like parameter set: For geometry description see -Peter Boesecke J.Appl.Cryst.(2007).40, s423–s427

    -

    Basically the main difference with pyFAI is the order of the axis which are flipped

    +
    +chi_corner(d1, d2)
    +

    Calculate the chi (azimuthal angle) for the corner of a pixel +at coordinate d1,d2 which in the lab ref has coordinate:

    +

    X1 = p1*cos(rot2)*cos(rot3) + p2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) - L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) +X2 = p1*cos(rot2)*sin(rot3) - L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + p2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) +X3 = -(L*cos(rot1)*cos(rot2)) + p2*cos(rot2)*sin(rot1) - p1*sin(rot2) +hence tan(Chi) = X2 / X1

    - + + +
    Parameters:SampleDistance – distance from sample to detector at the PONI (orthogonal projection)
    Parameters:
      +
    • d1 (float or array of them) – pixel coordinate along the 1st dimention (C convention)
    • +
    • d2 (float or array of them) – pixel coordinate along the 2nd dimention (C convention)
    • +
    +
    Returns:

    chi, the azimuthal angle in rad

    +
    -

    :param Center_1, pixel position of the PONI along fastest axis -:param Center_2: pixel position of the PONI along slowest axis -:param Rot_1: rotation around the fastest axis (x) -:param Rot_2: rotation around the slowest axis (y) -:param Rot_3: rotation around the axis ORTHOGONAL to the detector plan -:param PSize_1: pixel size in meter along the fastest dimention -:param PSize_2: pixel size in meter along the slowst dimention -:param splineFile: name of the file containing the spline -:param BSize_1: pixel binning factor along the fastest dimention -:param BSize_2: pixel binning factor along the slowst dimention -:param WaveLength: wavelength used

    -
    -
    -set_chia(_)
    -
    - -
    -
    -set_correct_solid_angle_for_spline(value)
    -
    - -
    -
    -set_dist(value)
    -
    - -
    -
    -set_dssa(_)
    -
    - -
    -
    -set_mask(mask)
    -
    - -
    -
    -set_maskfile(maskfile)
    -
    +
    +
    +chia
    +

    chi array in cache

    +
    -
    -set_pixel1(pixel1)
    -
    +
    +cornerArray(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -set_pixel2(pixel2)
    -
    +
    +cornerQArray(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -set_poni1(value)
    -
    +
    +cornerRArray(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -set_poni2(value)
    -
    +
    +cornerRd2Array(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -set_qa(_)
    -
    +
    +corner_array(shape=None, unit=None, use_cython=True)
    +

    Generate a 3D array of the given shape with (i,j) (radial +angle 2th, azimuthal angle chi ) for all elements.

    + +++ + + + + + +
    Parameters:shape (2-tuple of integer) – expected shape
    Returns:3d array with shape=(*shape,4,2) the two elements are: +- dim3[0]: radial angle 2th, q, r... +- dim3[1]: azimuthal angle chi
    +
    -
    -
    -set_ra(_)
    +
    +
    +correct_SA_spline
    -
    -set_rot1(value)
    -
    +
    +cosIncidance(d1, d2, path='cython')
    +

    Calculate the incidence angle (alpha) for current pixels (P). +The poni being the point of normal incidence, +it’s incidence angle is ${alpha} = 0$ hence $cos({alpha}) = 1$

    + +++ + + + + + +
    Parameters:
      +
    • d1 – 1d or 2d set of points in pixel coord
    • +
    • d2 – 1d or 2d set of points in pixel coord
    • +
    +
    Returns:

    cosine of the incidence angle

    +
    +
    -
    -set_rot2(value)
    +
    +del_chia()
    -
    -set_rot3(value)
    +
    +del_dssa()
    -
    -set_spline(spline)
    +
    +del_qa()
    -
    -set_splineFile(splineFile)
    +
    +del_ra()
    -
    -set_ttha(_)
    +
    +del_ttha()
    -
    -set_wavelength(value)
    -
    - -
    -
    -classmethod sload(filename)
    -

    A static method combining the constructor and the loader from -a file

    +
    +delta2Theta(shape=None)
    +

    Generate a 3D array of the given shape with (i,j) with the max +distance between the center and any corner in 2 theta

    - + - +
    Parameters:filename (string) – name of the file to load
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:instance of Gerometry of AzimuthalIntegrator set-up with the parameter from the file.
    Returns:2D-array containing the max delta angle between a pixel center and any corner in 2theta-angle (rad)
    -
    -solidAngleArray(shape=None, order=3, absolute=False)
    -

    Generate an array for the solid angle correction -given the shape of the detector.

    -

    solid_angle = cos(incidence)^3

    +
    +deltaChi(shape=None)
    +

    Generate a 3D array of the given shape with (i,j) with the max +distance between the center and any corner in chi-angle (rad)

    - + - + + +
    Parameters:
      -
    • shape – shape of the array expected
    • -
    • order – should be 3, power of the formula just obove
    • -
    • absolute – the absolute solid angle is calculated as:
    • -
    -
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:2D-array containing the max delta angle between a pixel center and any corner in chi-angle (rad)
    -

    SA = pix1*pix2/dist^2 * cos(incidence)^3

    -
    -
    -spline
    -
    - -
    -
    -splineFile
    -
    -
    -
    -tth(d1, d2, param=None, path='cython')
    -

    Calculates the 2theta value for the center of a given pixel -(or set of pixels)

    +
    +deltaQ(shape=None)
    +

    Generate a 2D array of the given shape with (i,j) with the max +distance between the center and any corner in q_vector unit +(nm^-1)

    - - - + - +
    Parameters:
      -
    • d1 (scalar or array of scalar) – position(s) in pixel in first dimension (c order)
    • -
    • d2 (scalar or array of scalar) – position(s) in pixel in second dimension (c order)
    • -
    • path – can be “cos”, “tan” or “cython”
    • -
    -
    Returns:

    2theta in radians

    -
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Return type:

    float or array of floats.

    -
    Returns:array 2D containing the max delta Q between a pixel center and any corner in q_vector unit (nm^-1)
    -
    -tth_corner(*arg, **kw)
    -

    decorator that deprecates the use of a function

    -
    - -
    -
    -ttha
    -

    2theta array in cache

    +
    +deltaR(shape=None)
    +

    Generate a 2D array of the given shape with (i,j) with the max +distance between the center and any corner in radius unit (mm)

    + +++ + + + + + +
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:array 2D containing the max delta Q between a pixel center and any corner in q_vector unit (nm^-1)
    -
    -twoThetaArray(shape=None)
    -

    Generate an array of two-theta(i,j) in radians for each pixel in detector

    -

    the 2theta array values are in radians

    +
    +deltaRd2(shape=None)
    +

    Generate a 2D array of the given shape with (i,j) with the max +distance between the center and any corner in unit: reciprocal spacing squarred (1/nm^2)

    - + - +
    Parameters:shape – shape of the detector
    Parameters:shape – The shape of the detector array: 2-tuple of integer
    Returns:array of 2theta position in radians
    Returns:array 2D containing the max delta (d*)^2 between a pixel center and any corner in reciprocal spacing squarred (1/nm^2)
    -
    -
    -wavelength
    -
    -
    -
    -write(filename)
    -

    Save the geometry parameters.

    +
    +delta_array(shape=None, unit='2th')
    +

    Generate a 2D array of the given shape with (i,j) (delta-radial +angle) for all elements.

    - + + +
    Parameters:filename (string) – name of the file where to save the parameters
    Parameters:shape (2-tuple of integer) – expected shape
    Returns:3d array with shape=(*shape,4,2) the two elements are:
      +
    • dim3[0]: radial angle 2th, q, r...
    • +
    • dim3[1]: azimuthal angle chi
    • +
    +
    - - -
    -
    -

    geometryRefinement Module

    -
    -
    -class pyFAI.geometryRefinement.GeometryRefinement(data, dist=1, poni1=None, poni2=None, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    -

    Bases: pyFAI.azimuthalIntegrator.AzimuthalIntegrator

    -
    -anneal(maxiter=1000000)
    -
    +
    +diffSolidAngle(d1, d2)
    +

    Calculate the solid angle of the current pixels (P) versus the PONI (C)

    +
    +

    dOmega = \frac{Omega(P)}{Omega(C)}
+       = \frac{A \cdot cos(a)}{SP^2} \cdot \frac{SC^2}{A \cdot cos(0)}
+       = \frac{3}{cos(a)}
+       = \frac{SC^3}{SP^3}
 
-<dl class= -

    -calc_2th(rings, wavelength=None)
    -
    +cos(a) = \frac{SC}{SP}"/>

    +
    - + +
    Parameters:
      -
    • rings – indices of the rings. starts at 0 and self.dSpacing should be long enough !!!
    • -
    • wavelength – wavelength in meter
    • +
    Parameters:
      +
    • d1 – 1d or 2d set of points
    • +
    • d2 – 1d or 2d set of points (same size&shape as d1)
    Returns:

    solid angle correction array

    +
    -
    -
    -chi2(param=None)
    +
    +
    +dist
    -
    -
    -chi2_wavelength(param=None)
    -
    +
    +
    +dssa
    +

    solid angle array in cache

    +
    -
    -confidence(with_rot=True)
    -

    Confidence interval obtained from the second derivative of the error function -next to its minimum value.

    -

    Note the confidence interval increases with the number of points which is “surprizing”

    +
    +getFit2D()
    +

    Export geometry setup with the geometry of Fit2D

    - - - +
    Parameters:with_rot – if true include rot1 & rot2 in the parameter set.
    Returns:std_dev, confidence
    Returns:dict with parameters compatible with fit2D geometry
    -
    -curve_fit(with_rot=True)
    -

    Refine the geometry and provide confidence interval -Use curve_fit from scipy.optimize to not only refine the geometry (unconstrained fit)

    +
    +getPyFAI()
    +

    Export geometry setup with the geometry of PyFAI

    - - - +
    Parameters:with_rot – include rotation intro error measurment
    Returns:std_dev, confidence
    Returns:dict with the parameter-set of the PyFAI geometry
    -
    -
    -dist_max
    -
    - -
    -
    -dist_min
    -
    +
    +
    +getSPD()
    +

    get the SPD like parameter set: For geometry description see +Peter Boesecke J.Appl.Cryst.(2007).40, s423–s427

    +

    Basically the main difference with pyFAI is the order of the axis which are flipped

    + +++ + + + +
    Returns:dictionnary with those parameters: +SampleDistance: distance from sample to detector at the PONI (orthogonal projection) +Center_1, pixel position of the PONI along fastest axis +Center_2: pixel position of the PONI along slowest axis +Rot_1: rotation around the fastest axis (x) +Rot_2: rotation around the slowest axis (y) +Rot_3: rotation around the axis ORTHOGONAL to the detector plan +PSize_1: pixel size in meter along the fastest dimention +PSize_2: pixel size in meter along the slowst dimention +splineFile: name of the file containing the spline +BSize_1: pixel binning factor along the fastest dimention +BSize_2: pixel binning factor along the slowst dimention +WaveLength: wavelength used in meter
    +
    -
    -get_dist_max()
    +
    +get_chia()
    -
    -get_dist_min()
    +
    +get_correct_solid_angle_for_spline()
    -
    -get_poni1_max()
    +
    +get_dist()
    -
    -get_poni1_min()
    +
    +get_dssa()
    -
    -get_poni2_max()
    +
    +get_mask()
    -
    -get_poni2_min()
    +
    +get_maskfile()
    -
    -get_rot1_max()
    +
    +get_pixel1()
    -
    -get_rot1_min()
    +
    +get_pixel2()
    -
    -get_rot2_max()
    +
    +get_poni1()
    -
    -get_rot2_min()
    +
    +get_poni2()
    -
    -get_rot3_max()
    +
    +get_qa()
    -
    -get_rot3_min()
    +
    +get_ra()
    -
    -get_wavelength_max()
    +
    +get_rot1()
    -
    -get_wavelength_min()
    +
    +get_rot2()
    -
    -guess_poni()
    -

    Poni can be guessed by the centroid of the ring with lowest 2Theta

    -
    - -
    -
    -poni1_max
    -
    - -
    -
    -poni1_min
    -
    - -
    -
    -poni2_max
    -
    - -
    -
    -poni2_min
    -
    - -
    -
    -refine1()
    -
    - -
    -
    -refine2(maxiter=1000000, fix=['wavelength'])
    -
    - -
    -
    -refine2_wavelength(maxiter=1000000, fix=['wavelength'])
    -
    - -
    -
    -residu1(param, d1, d2, rings)
    +
    +get_rot3()
    -
    -residu1_wavelength(param, d1, d2, rings)
    -
    +
    +get_shape(shape=None)
    +

    Guess what is the best shape ....

    + +++ + + + + + +
    Parameters:shape – force this value (2-tuple of int)
    Returns:2-tuple of int
    +
    -
    -residu2(param, d1, d2, rings)
    +
    +get_spline()
    -
    -residu2_wavelength(param, d1, d2, rings)
    +
    +get_splineFile()
    -
    -residu2_wavelength_weighted(param, d1, d2, rings, weight)
    +
    +get_ttha()
    -
    -residu2_weighted(param, d1, d2, rings, weight)
    +
    +get_wavelength()
    -
    -roca()
    -

    run roca to optimise the parameter set

    +
    +load(filename)
    +

    Load the refined parameters from a file.

    + +++ + + + +
    Parameters:filename (string) – name of the file to load
    -
    -rot1_max
    -
    - -
    -
    -rot1_min
    +
    +mask
    -
    -rot2_max
    +
    +maskfile
    -
    -
    -rot2_min
    +
    +
    +oversampleArray(myarray)
    -
    -rot3_max
    +
    +pixel1
    -
    -rot3_min
    -
    - -
    -
    -set_dist_max(value)
    -
    - -
    -
    -set_dist_min(value)
    -
    - -
    -
    -set_poni1_max(value)
    -
    - -
    -
    -set_poni1_min(value)
    -
    - -
    -
    -set_poni2_max(value)
    +
    +pixel2
    -
    -set_poni2_min(value)
    -
    +
    +polarization(shape=None, factor=None, axis_offset=0)
    +

    Calculate the polarization correction accoding to the +polarization factor:

    +
      +
    • If the polarization factor is None, the correction is not applied (returns 1)
    • +
    • If the polarization factor is 0 (circular polarization), the correction correspond to (1+(cos2θ)^2)/2
    • +
    • If the polarization factor is 1 (linear horizontal polarization), there is no correction in the vertical plane and a node at 2th=90, chi=0
    • +
    • If the polarization factor is -1 (linear vertical polarization), there is no correction in the horizontal plane and a node at 2th=90, chi=90
    • +
    • If the polarization is elliptical, the polarization factor varies between -1 and +1.
    • +
    +

    The axis_offset parameter allows correction for the misalignement of the polarization plane (or ellipse main axis) and the the detector’s X axis.

    + +++ + + + + + +
    Parameters:
      +
    • factor – (Ih-Iv)/(Ih+Iv): varies between 0 (no polarization) and 1 (where division by 0 could occure at 2th=90, chi=0)
    • +
    • axis_offset – Angle between the polarization main axis and detector X direction (in radians !!!)
    • +
    +
    Returns:

    2D array with polarization correction array (intensity/polarisation)

    +
    +
    -
    -
    -set_rot1_max(value)
    +
    +
    +poni1
    -
    -
    -set_rot1_min(value)
    +
    +
    +poni2
    -
    -set_rot2_max(value)
    -
    +
    +positionArray(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -set_rot2_min(value)
    -
    +
    +position_array(shape=None, corners=False, dtype=<type 'numpy.float64'>, use_cython=True)
    +

    Generate an array for the pixel position given the shape of the detector.

    +

    if corners is False, the coordinates of the center of the pixel +is returned in an array of shape: (shape[0], shape[1], 3) +where the 3 coordinates are: +* z: along incident beam, +* y: to the top/sky, +* x: towards the center of the ring

    +

    If is True, the corner of each pixels are then returned. +the output shape is then (shape[0], shape[1], 4, 3)

    + +++ + + + + + +
    Parameters:
      +
    • shape – shape of the array expected
    • +
    • corners – set to true to receive a (...,4,3) array of corner positions
    • +
    • dtype – output format requested. Double precision is needed for fitting the geometry
    • +
    • use_cython ((bool)) – set to false to test the Python path (slower)
    • +
    +
    Returns:

    3D coodinates as nd-array of size (...,3) or (...,3) (default)

    +
    +

    Nota: this value is not cached and actually generated on demand (costly)

    +
    -
    -set_rot3_max(value)
    -
    +
    +qArray(shape=None)
    +

    Generate an array of the given shape with q(i,j) for all +elements.

    +
    -
    -set_rot3_min(value)
    -
    +
    +qCornerFunct(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -set_tolerance(value=10)
    -

    Set the tolerance for a refinement of the geometry; in percent of the original value

    +
    +qFunction(d1, d2, param=None, path='cython')
    +

    Calculates the q value for the center of a given pixel (or set +of pixels) in nm-1

    +

    q = 4pi/lambda sin( 2theta / 2 )

    - + + + + +
    Parameters:value – Tolerance as a percentage
    Parameters:
      +
    • d1 (scalar or array of scalar) – position(s) in pixel in first dimension (c order)
    • +
    • d2 (scalar or array of scalar) – position(s) in pixel in second dimension (c order)
    • +
    +
    Returns:

    q in in nm^(-1)

    +
    Return type:

    float or array of floats.

    +
    -
    -
    -set_wavelength_max(value)
    -
    - -
    -
    -set_wavelength_min(value)
    -
    +
    +
    +qa
    +

    Q array in cache

    +
    -
    -simplex(maxiter=1000000)
    -
    - -
    -
    -wavelength_max
    -
    - -
    -
    -wavelength_min
    -
    - - - -
    -
    -

    detectors Module

    -

    Description of all detectors with a factory to instantiate them

    -
    -
    -class pyFAI.detectors.ADSC_Q210(pixel1=5.1e-05, pixel2=5.1e-05)
    -

    Bases: pyFAI.detectors.Detector

    -

    ADSC Quantum 210r detector, 2x2 chips

    -

    Informations from -http://www.adsc-xray.com/products/ccd-detectors/q210r-ccd-detector/

    -

    Question: how are the gaps handled ?

    -
    -
    -MAX_SHAPE = (4096, 4096)
    -
    - -
    -
    -aliases = ['Quantum 210']
    -
    - -
    -
    -force_pixel = True
    -
    - -
    - -
    -
    -class pyFAI.detectors.ADSC_Q270(pixel1=6.48e-05, pixel2=6.48e-05)
    -

    Bases: pyFAI.detectors.Detector

    -

    ADSC Quantum 270r detector, 2x2 chips

    -

    Informations from -http://www.adsc-xray.com/products/ccd-detectors/q270-ccd-detector/

    -

    Question: how are the gaps handled ?

    -
    -
    -MAX_SHAPE = (4168, 4168)
    -
    - -
    -
    -aliases = ['Quantum 270']
    -
    - -
    -
    -force_pixel = True
    -
    - -
    - -
    -
    -class pyFAI.detectors.ADSC_Q315(pixel1=5.1e-05, pixel2=5.1e-05)
    -

    Bases: pyFAI.detectors.Detector

    -

    ADSC Quantum 315r detector, 3x3 chips

    -

    Informations from -http://www.adsc-xray.com/products/ccd-detectors/q315r-ccd-detector/

    -

    Question: how are the gaps handled ?

    -
    -
    -MAX_SHAPE = (6144, 6144)
    -
    - -
    -
    -aliases = ['Quantum 315']
    -
    - -
    -
    -force_pixel = True
    -
    - +
    +rArray(shape=None)
    +

    Generate an array of the given shape with r(i,j) for all elements; +The radius r being in meters.

    + +++ + + + + + +
    Parameters:shape – expected shape of the detector
    Returns:2d array of the given shape with radius in m from beam center on detector.
    -
    -
    -class pyFAI.detectors.ADSC_Q4(pixel1=8.2e-05, pixel2=8.2e-05)
    -

    Bases: pyFAI.detectors.Detector

    -

    ADSC Quantum 4r detector, 2x2 chips

    -

    Informations from -http://proteincrystallography.org/detectors/adsc.php

    -

    Question: how are the gaps handled ?

    -
    -
    -MAX_SHAPE = (2304, 2304)
    -
    - -
    -
    -aliases = ['Quantum 4']
    -
    - -
    -
    -force_pixel = True
    -
    - +
    +
    +rCornerFunct(*arg, **kw)
    +

    decorator that deprecates the use of a function

    -
    -
    -class pyFAI.detectors.Aarhus(pixel1=2.5e-05, pixel2=2.5e-05, radius=0.3)
    -

    Bases: pyFAI.detectors.Detector

    -

    Cylindrical detector made of a bent imaging-plate. -Developped at the Danish university of Aarhus -r = 1.2m or 0.3m

    -

    The image has to be laid-out horizontally

    -

    Nota: the detector is bending towards the sample, hence reducing the sample-detector distance. -This is why z<0 (or p3<0)

    -

    TODO: update cython code for 3d detectors -use expand2d instead of outer product with ones

    -
    -
    -IS_FLAT = False
    -
    - -
    -
    -MAX_SHAPE = (1000, 16000)
    -
    -
    -
    -calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    -

    Calculate the position of each pixel center in cartesian coordinate -and in meter of a couple of coordinates. -The half pixel offset is taken into account here !!! -Adapted to Nexus detector definition

    +
    +rFunction(d1, d2, param=None, path='cython')
    +

    Calculates the radius value for the center of a given pixel +(or set of pixels) in m

    +
    +
    r = distance to the incident beam
    - -
    Parameters:
      -
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • -
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • -
    • center – retrieve the coordinate of the center of the pixel
    • -
    • use_cython – set to False to test Python implementeation
    • +
    • d1 (scalar or array of scalar) – position(s) in pixel in first dimension (c order)
    • +
    • d2 (scalar or array of scalar) – position(s) in pixel in second dimension (c order)
    Returns:

    position in meter of the center of each pixels.

    +
    Returns:

    r in in m

    Return type:

    ndarray

    +
    Return type:

    float or array of floats.

    -

    d1 and d2 must have the same shape, returned array will have -the same shape.

    -
    -force_pixel = True
    -
    +
    +ra
    +

    R array in cache

    +
    -
    -get_pixel_corners(use_cython=True)
    -

    Calculate the position of the corner of the pixels

    -

    This should be overwritten by class representing non-contiguous detector (Xpad, ...)

    +
    +rd2Array(shape=None)
    +

    Generate an array of the given shape with (d*(i,j))^2 for all pixels.

    +

    d*^2 is the reciprocal spacing squared in inverse nm squared

    - + + +
    Returns:4D array containing: -pixel index (slow dimension) -pixel index (fast dimension) -corner index (A, B, C or D), triangles or hexagons can be handled the same way -vertex position (z,y,x)
    Parameters:shape – expected shape of the detector
    Returns:2d array of the given shape with reciprocal spacing squared
    +
    +
    +read(filename)
    +

    Load the refined parameters from a file.

    + +++ + + + +
    Parameters:filename (string) – name of the file to load
    -
    -
    -class pyFAI.detectors.Apex2(pixel1=0.00012, pixel2=0.00012)
    -

    Bases: pyFAI.detectors.Detector

    -

    BrukerApex2 detector

    -

    Actually a derivative from the Fairchild detector with higher binning

    -
    -
    -DEFAULT_PIXEL1 = 6e-05
    -
    - -
    -
    -DEFAULT_PIXEL2 = 6e-05
    -
    +
    +
    +reset()
    +

    reset most arrays that are cached: used when a parameter +changes.

    +
    -
    -MAX_SHAPE = (1024, 1024)
    +
    +rot1
    -
    -aliases = ['ApexII', 'Bruker']
    +
    +rot2
    -
    -force_pixel = True
    -
    - -
    - -
    -
    -class pyFAI.detectors.Basler(pixel=3.75e-06)
    -

    Bases: pyFAI.detectors.Detector

    -

    Basler camera are simple CCD camara over GigaE

    -
    -
    -MAX_SHAPE = (966, 1296)
    -
    - -
    -
    -aliases = ['aca1300']
    -
    - -
    -
    -force_pixel = True
    -
    - -
    - -
    -
    -class pyFAI.detectors.Detector(pixel1=None, pixel2=None, splineFile=None, max_shape=None)
    -

    Bases: object

    -

    Generic class representing a 2D detector

    -
    -
    -API_VERSION = '1.0'
    -
    - -
    -
    -IS_CONTIGUOUS = True
    -
    - -
    -
    -IS_FLAT = True
    -
    - -
    -
    -aliases = []
    -
    - -
    -
    -binning
    +
    +rot3
    -
    -calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    -

    Calculate the position of each pixel center in cartesian coordinate -and in meter of a couple of coordinates. -The half pixel offset is taken into account here !!! -Adapted to Nexus detector definition

    +
    +save(filename)
    +

    Save the geometry parameters.

    - - - - - +
    Parameters:
      -
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • -
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • -
    • center – retrieve the coordinate of the center of the pixel, unless gives one corner
    • -
    • use_cython – set to False to test Python implementation
    • -
    -
    Returns:

    position in meter of the center of each pixels.

    -
    Return type:

    3xndarray, the later being None if IS_FLAT

    -
    Parameters:filename (string) – name of the file where to save the parameters
    -

    d1 and d2 must have the same shape, returned array will have -the same shape.

    -

    pos_z is None for flat detectors

    -
    -calc_mask()
    -

    Method calculating the mask for a given detector

    -

    Detectors with gaps should overwrite this method with -something actually calculating the mask!

    - --- - - - - - -
    Returns:the mask with valid pixel to 0
    Return type:numpy ndarray of int8 or None
    +
    +setChiDiscAtPi()
    +

    Set the position of the discontinuity of the chi axis between +-pi and +pi. This is the default behavour

    -
    -
    -classmethod factory(name, config=None)
    -

    A kind of factory...

    +
    +
    +setChiDiscAtZero()
    +

    Set the position of the discontinuity of the chi axis between +0 and 2pi. By default it is between pi and -pi

    +
    + +
    +
    +setFit2D(directDist, centerX, centerY, tilt=0.0, tiltPlanRotation=0.0, pixelX=None, pixelY=None, splineFile=None)
    +

    Set the Fit2D-like parameter set: For geometry description see +HPR 1996 (14) pp-240

    +

    Warning: Fit2D flips automatically images depending on their file-format. +By reverse engineering we noticed this behavour for Tiff and Mar345 images (at least). +To obtaine correct result you will have to flip images using numpy.flipud.

    - - - - -
    Parameters:
      -
    • name (str) – name of a detector
    • -
    • config (dict or JSON representation of it.) – configuration of the detector
    • +
    Parameters:
      +
    • direct – direct distance from sample to detector along the incident beam (in millimeter as in fit2d)
    • +
    • tilt – tilt in degrees
    • +
    • tiltPlanRotation – Rotation (in degrees) of the tilt plan arround the Z-detector axis +* 0deg -> Y does not move, +X goes to Z<0 +* 90deg -> X does not move, +Y goes to Z<0 +* 180deg -> Y does not move, +X goes to Z>0 +* 270deg -> X does not move, +Y goes to Z>0
    • +
    • pixelX,pixelY – as in fit2d they ar given in micron, not in meter
    • +
    • centerY (centerX,) – pixel position of the beam center
    • +
    • splineFile – name of the file containing the spline
    Returns:

    an instance of the right detector, set-up if possible

    -
    Return type:

    pyFAI.detectors.Detector

    -
    -
    -
    -force_pixel = False
    -
    +
    +
    +setOversampling(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    -
    -getFit2D()
    -

    Helper method to serialize the description of a detector using the Fit2d units

    - --- - - - - - -
    Returns:representation of the detector easy to serialize
    Return type:dict
    +
    +setPyFAI(**kwargs)
    +

    set the geometry from a pyFAI-like dict

    -
    -getPyFAI()
    -

    Helper method to serialize the description of a detector using the pyFAI way -with everything in S.I units.

    +
    +setSPD(SampleDistance, Center_1, Center_2, Rot_1=0, Rot_2=0, Rot_3=0, PSize_1=None, PSize_2=None, splineFile=None, BSize_1=1, BSize_2=1, WaveLength=None)
    +

    Set the SPD like parameter set: For geometry description see +Peter Boesecke J.Appl.Cryst.(2007).40, s423–s427

    +

    Basically the main difference with pyFAI is the order of the axis which are flipped

    - - - +
    Returns:representation of the detector easy to serialize
    Return type:dict
    Parameters:
      +
    • SampleDistance – distance from sample to detector at the PONI (orthogonal projection)
    • +
    • Center_1 – pixel position of the PONI along fastest axis
    • +
    • Center_2 – pixel position of the PONI along slowest axis
    • +
    • Rot_1 – rotation around the fastest axis (x)
    • +
    • Rot_2 – rotation around the slowest axis (y)
    • +
    • Rot_3 – rotation around the axis ORTHOGONAL to the detector plan
    • +
    • PSize_1 – pixel size in meter along the fastest dimention
    • +
    • PSize_2 – pixel size in meter along the slowst dimention
    • +
    • splineFile – name of the file containing the spline
    • +
    • BSize_1 – pixel binning factor along the fastest dimention
    • +
    • BSize_2 – pixel binning factor along the slowst dimention
    • +
    • WaveLength – wavelength used
    • +
    +
    -
    -get_binning()
    +
    +set_chia(_)
    -
    -get_mask()
    +
    +set_correct_solid_angle_for_spline(value)
    -
    -get_maskfile()
    +
    +set_dist(value)
    -
    -get_name()
    -

    Get a meaningful name for detector

    -
    +
    +set_dssa(_)
    +
    -
    -get_pixel1()
    +
    +set_mask(mask)
    -
    -get_pixel2()
    +
    +set_maskfile(maskfile)
    -
    -get_pixel_corners()
    -

    Calculate the position of the corner of the pixels

    -

    This should be overwritten by class representing non-contiguous detector (Xpad, ...)

    -

    Precision float32 is ok: precision of 1µm for a detector size of 1m

    - --- - - - -
    Returns:4D array containing: -pixel index (slow dimension) -pixel index (fast dimension) -corner index (A, B, C or D), triangles or hexagons can be handled the same way -vertex position (z,y,x)
    -
    +
    +set_pixel1(pixel1)
    +
    -
    -get_splineFile()
    +
    +set_pixel2(pixel2)
    -
    -guess_binning(data)
    -

    Guess the binning/mode depending on the image shape -:param data: 2-tuple with the shape of the image or the image with a .shape attribute.

    -
    - -
    -
    -mask
    +
    +set_poni1(value)
    -
    -
    -maskfile
    +
    +
    +set_poni2(value)
    -
    -
    -name
    -

    Get a meaningful name for detector

    -
    +
    +
    +set_qa(_)
    +
    -
    -
    -pixel1
    +
    +
    +set_ra(_)
    -
    -
    -pixel2
    +
    +
    +set_rot1(value)
    -
    -
    -registry = {'imxpads10': <class 'pyFAI.detectors.ImXPadS10'>, 'rayonix_mx225hs': <class 'pyFAI.detectors.RayonixMx225hs'>, 'd5': <class 'pyFAI.detectors.Xpad_flat'>, 'thaleselectronics': <class 'pyFAI.detectors.Pixium'>, 'imxpad_s10': <class 'pyFAI.detectors.ImXPadS10'>, 'rayonix_mx340hs': <class 'pyFAI.detectors.RayonixMx340hs'>, 'condor': <class 'pyFAI.detectors.Fairchild'>, 'pilatuscdte2m': <class 'pyFAI.detectors.PilatusCdTe2M'>, 'oxd_titan': <class 'pyFAI.detectors.Titan'>, 'dexela_2923': <class 'pyFAI.detectors.Dexela2923'>, 'pilatus6m': <class 'pyFAI.detectors.Pilatus6M'>, 'titan_2k_x_2k': <class 'pyFAI.detectors.Titan'>, 'hf_262k': <class 'pyFAI.detectors.HF_262k'>, 'rayonixmx225': <class 'pyFAI.detectors.RayonixMx225'>, 'rayonixsx200': <class 'pyFAI.detectors.RayonixSx200'>, 'eiger4m': <class 'pyFAI.detectors.Eiger4M'>, 'rayonix_lx170': <class 'pyFAI.detectors.RayonixLx170'>, 'pilatuscdte300kw': <class 'pyFAI.detectors.PilatusCdTe300kw'>, 'pilatus300k': <class 'pyFAI.detectors.Pilatus300k'>, 'quantum_270': <class 'pyFAI.detectors.ADSC_Q270'>, 'rayonixmx300': <class 'pyFAI.detectors.RayonixMx300'>, 'pilatuscdte1m': <class 'pyFAI.detectors.PilatusCdTe1M'>, 'perkin': <class 'pyFAI.detectors.Perkin'>, 'rayonixmx340hs': <class 'pyFAI.detectors.RayonixMx340hs'>, 'rayonix_mx325': <class 'pyFAI.detectors.RayonixMx325'>, 'adsc_q270': <class 'pyFAI.detectors.ADSC_Q270'>, 'oxdtitan': <class 'pyFAI.detectors.Titan'>, 'dexela2923': <class 'pyFAI.detectors.Dexela2923'>, 'xpads540flat': <class 'pyFAI.detectors.Xpad_flat'>, 'titan': <class 'pyFAI.detectors.Titan'>, 'aarhus': <class 'pyFAI.detectors.Aarhus'>, 'rayonix_mx425hs': <class 'pyFAI.detectors.RayonixMx425hs'>, 'hf_4m': <class 'pyFAI.detectors.HF_4M'>, 'pilatuscdte300k': <class 'pyFAI.detectors.PilatusCdTe300k'>, 'thales_electronics': <class 'pyFAI.detectors.Pixium'>, 'rayonixmx300hs': <class 'pyFAI.detectors.RayonixMx300hs'>, 'pixium4700detector': <class 'pyFAI.detectors.Pixium'>, 'agilenttitan': <class 'pyFAI.detectors.Titan'>, 'rayonixsx165': <class 'pyFAI.detectors.RayonixSx165'>, 'pilatus100k': <class 'pyFAI.detectors.Pilatus100k'>, 'perkin_elmer': <class 'pyFAI.detectors.Perkin'>, 'aca1300': <class 'pyFAI.detectors.Basler'>, 'quantum315': <class 'pyFAI.detectors.ADSC_Q315'>, 'rayonixsx85hs': <class 'pyFAI.detectors.RayonixSx85hs'>, 'imxpads140': <class 'pyFAI.detectors.ImXPadS140'>, 'rayonix_mx170': <class 'pyFAI.detectors.RayonixMx170'>, 'pilatus300kw': <class 'pyFAI.detectors.Pilatus300kw'>, 'hf-130k': <class 'pyFAI.detectors.HF_130K'>, 'rayonixsx30hs': <class 'pyFAI.detectors.RayonixSx30hs'>, 'mar345': <class 'pyFAI.detectors.Mar345'>, 'perkindetector': <class 'pyFAI.detectors.Perkin'>, 'rayonix_lx255hs': <class 'pyFAI.detectors.RayonixLx255'>, 'rayonix_mx225': <class 'pyFAI.detectors.RayonixMx225'>, 'eiger1m': <class 'pyFAI.detectors.Eiger1M'>, 'mar_345': <class 'pyFAI.detectors.Mar345'>, 'pilatus2m': <class 'pyFAI.detectors.Pilatus2M'>, 'hf-1m': <class 'pyFAI.detectors.HF_1M'>, 'fairchildcondor486:90': <class 'pyFAI.detectors.Fairchild'>, 'rayonixmx170': <class 'pyFAI.detectors.RayonixMx170'>, 'mar165': <class 'pyFAI.detectors.RayonixSx165'>, 'hf_2m': <class 'pyFAI.detectors.HF_2M'>, 'titan2kx2k': <class 'pyFAI.detectors.Titan'>, 'rayonix_mx300hs': <class 'pyFAI.detectors.RayonixMx300hs'>, 'hf-9.4m': <class 'pyFAI.detectors.HF_9M'>, 'fairchild_condor_486:90': <class 'pyFAI.detectors.Fairchild'>, 'hf-262k': <class 'pyFAI.detectors.HF_262k'>, 'xpad_flat': <class 'pyFAI.detectors.Xpad_flat'>, 'quantum_315': <class 'pyFAI.detectors.ADSC_Q315'>, 'pi': <class 'pyFAI.detectors.RaspberryPi'>, 'pilatus1m': <class 'pyFAI.detectors.Pilatus1M'>, 'xpad_s540_flat': <class 'pyFAI.detectors.Xpad_flat'>, 'pixium_4700_detector': <class 'pyFAI.detectors.Pixium'>, 'basler': <class 'pyFAI.detectors.Basler'>, 'rayonix_sx200': <class 'pyFAI.detectors.RayonixSx200'>, 'quantum270': <class 'pyFAI.detectors.ADSC_Q270'>, 'perkin_detector': <class 'pyFAI.detectors.Perkin'>, 'mar3450': <class 'pyFAI.detectors.Mar345'>, 'pixium': <class 'pyFAI.detectors.Pixium'>, 'fairchild': <class 'pyFAI.detectors.Fairchild'>, 'raspberry': <class 'pyFAI.detectors.RaspberryPi'>, 'rayonixmx225hs': <class 'pyFAI.detectors.RayonixMx225hs'>, 'apexii': <class 'pyFAI.detectors.Apex2'>, 'quantum_210': <class 'pyFAI.detectors.ADSC_Q210'>, 'bruker': <class 'pyFAI.detectors.Apex2'>, 'raspberrypi': <class 'pyFAI.detectors.RaspberryPi'>, 'rayonixmx425hs': <class 'pyFAI.detectors.RayonixMx425hs'>, 'eiger16m': <class 'pyFAI.detectors.Eiger16M'>, 'imxpads70': <class 'pyFAI.detectors.ImXPadS70'>, 'rayonix_sx30hs': <class 'pyFAI.detectors.RayonixSx30hs'>, 'hf_130k': <class 'pyFAI.detectors.HF_130K'>, 'agilent_titan': <class 'pyFAI.detectors.Titan'>, 'rayonixlx255hs': <class 'pyFAI.detectors.RayonixLx255'>, 'rayonix133': <class 'pyFAI.detectors.Rayonix133'>, 'rayonix_lx255': <class 'pyFAI.detectors.RayonixLx255'>, 'perkinelmer': <class 'pyFAI.detectors.Perkin'>, 'rayonix': <class 'pyFAI.detectors.Rayonix'>, 'rayonix_sx165': <class 'pyFAI.detectors.RayonixSx165'>, 'adsc_q4': <class 'pyFAI.detectors.ADSC_Q4'>, 'rayonixlx255': <class 'pyFAI.detectors.RayonixLx255'>, 'apex2': <class 'pyFAI.detectors.Apex2'>, 'hf-2.4m': <class 'pyFAI.detectors.HF_2M'>, 'detector': <class 'pyFAI.detectors.Detector'>, 'imxpad_s140': <class 'pyFAI.detectors.ImXPadS140'>, 'adsc_q210': <class 'pyFAI.detectors.ADSC_Q210'>, 'quantum4': <class 'pyFAI.detectors.ADSC_Q4'>, 'rayonixlx170': <class 'pyFAI.detectors.RayonixLx170'>, 'hf_9m': <class 'pyFAI.detectors.HF_9M'>, 'quantum210': <class 'pyFAI.detectors.ADSC_Q210'>, 'hf_1m': <class 'pyFAI.detectors.HF_1M'>, 'mar133': <class 'pyFAI.detectors.Rayonix133'>, 'pilatus200k': <class 'pyFAI.detectors.Pilatus200k'>, 'imxpad_s70': <class 'pyFAI.detectors.ImXPadS70'>, 'adsc_q315': <class 'pyFAI.detectors.ADSC_Q315'>, 'rayonixmx325': <class 'pyFAI.detectors.RayonixMx325'>, 'rayonix_sx85hs': <class 'pyFAI.detectors.RayonixSx85hs'>, 'eiger9m': <class 'pyFAI.detectors.Eiger9M'>, 'hf-4m': <class 'pyFAI.detectors.HF_4M'>, 'rayonix_mx300': <class 'pyFAI.detectors.RayonixMx300'>, 'quantum_4': <class 'pyFAI.detectors.ADSC_Q4'>}
    +
    +
    +set_rot2(value)
    -
    -save(filename)
    -

    Saves the detector description into a NeXus file, adapted from: -http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html -Main differences:

    -
    -
      -
    • differentiate pixel center from pixel corner offsets
    • -
    • store all offsets are ndarray according to slow/fast dimension (not x, y)
    • -
    -
    +
    +set_rot3(value)
    +
    + +
    +
    +set_spline(spline)
    +
    + +
    +
    +set_splineFile(splineFile)
    +
    + +
    +
    +set_ttha(_)
    +
    + +
    +
    +set_wavelength(value)
    +
    + +
    +
    +classmethod sload(filename)
    +

    A static method combining the constructor and the loader from +a file

    - + + +
    Parameters:filename – name of the file on the disc
    Parameters:filename (string) – name of the file to load
    Returns:instance of Gerometry of AzimuthalIntegrator set-up with the parameter from the file.
    -
    -setFit2D(**kwarg)
    -

    Twin method of getFit2D: setup a detector instance according to a description

    +
    +solidAngleArray(shape=None, order=3, absolute=False)
    +

    Generate an array for the solid angle correction +given the shape of the detector.

    +

    solid_angle = cos(incidence)^3

    - +
    Parameters:kwarg – dictionary containing pixel1, pixel2 and splineFile
    Parameters:
      +
    • shape – shape of the array expected
    • +
    • order – should be 3, power of the formula just obove
    • +
    • absolute – the absolute solid angle is calculated as:
    • +
    +
    +

    SA = pix1*pix2/dist^2 * cos(incidence)^3

    +
    +
    +spline
    +
    + +
    +
    +splineFile
    +
    +
    -
    -setPyFAI(**kwarg)
    -

    Twin method of getPyFAI: setup a detector instance according to a description

    +
    +tth(d1, d2, param=None, path='cython')
    +

    Calculates the 2theta value for the center of a given pixel +(or set of pixels)

    - + + + + +
    Parameters:kwarg – dictionary containing detector, pixel1, pixel2 and splineFile
    Parameters:
      +
    • d1 (scalar or array of scalar) – position(s) in pixel in first dimension (c order)
    • +
    • d2 (scalar or array of scalar) – position(s) in pixel in second dimension (c order)
    • +
    • path – can be “cos”, “tan” or “cython”
    • +
    +
    Returns:

    2theta in radians

    +
    Return type:

    float or array of floats.

    +
    -
    -set_binning(bin_size=(1, 1))
    -

    Set the “binning” of the detector,

    +
    +tth_corner(*arg, **kw)
    +

    decorator that deprecates the use of a function

    +
    + +
    +
    +ttha
    +

    2theta array in cache

    +
    + +
    +
    +twoThetaArray(shape=None)
    +

    Generate an array of two-theta(i,j) in radians for each pixel in detector

    +

    the 2theta array values are in radians

    - + + +
    Parameters:bin_size ((int, int)) – binning as integer or tuple of integers.
    Parameters:shape – shape of the detector
    Returns:array of 2theta position in radians
    +
    +
    +wavelength
    +
    +
    -
    -set_config(config)
    -

    Sets the configuration of the detector. This implies: -- Orientation: integers -- Binning -- ROI

    -

    The configuration is either a python dictionary or a JSON string or a file containing this JSON configuration

    -

    keys in that dictionary are : -“orientation”: integers from 0 to 7 -“binning”: integer or 2-tuple of integers. If only one integer is provided, -“offset”: coordinate (in pixels) of the start of the detector

    +
    +write(filename)
    +

    Save the geometry parameters.

    + +++ + + + +
    Parameters:filename (string) – name of the file where to save the parameters
    -
    -
    -set_dx(dx=None)
    -

    set the pixel-wise displacement along X (dim2):

    +
    +
    +

    geometryRefinement Module

    +
    +
    +class pyFAI.geometryRefinement.GeometryRefinement(data, dist=1, poni1=None, poni2=None, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    +

    Bases: pyFAI.azimuthalIntegrator.AzimuthalIntegrator

    -
    -set_dy(dy=None)
    -

    set the pixel-wise displacement along Y (dim1):

    +
    +__init__(data, dist=1, poni1=None, poni2=None, rot1=0, rot2=0, rot3=0, pixel1=None, pixel2=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    +
    +++ + + + +
    Parameters:
      +
    • data – ndarray float64 shape = n, 3 +col0: pos in dim0 (in pixels) +col1: pos in dim1 (in pixels) +col2: ring index in calibrant object
    • +
    • dist – guessed sample-detector distance (optional, in m)
    • +
    • poni1 – guessed PONI coordinate along the Y axis (optional, in m)
    • +
    • poni2 – guessed PONI coordinate along the X axis (optional, in m)
    • +
    • rot1 – guessed tilt of the detector around the Y axis (optional, in rad)
    • +
    • rot2 – guessed tilt of the detector around the X axis (optional, in rad)
    • +
    • rot3 – guessed tilt of the detector around the incoming beam axis (optional, in rad)
    • +
    • pixel1 – Pixel size along the vertical direction of the detector (in m), almost mandatory
    • +
    • pixel2 – Pixel size along the horizontal direction of the detector (in m), almost mandatory
    • +
    • splineFile – file describing the detector as 2 cubic splines. Replaces pixel1 & pixel2
    • +
    • detector – name of the detector or Detector instance. Replaces splineFile, pixel1 & pixel2
    • +
    • wavelength – wavelength in m (1.54e-10)
    • +
    • calibrant – instance of pyFAI.calibrant.Calibrant containing the d-Spacing
    • +
    +
    -
    -set_mask(mask)
    +
    +anneal(maxiter=1000000)
    -
    -set_maskfile(maskfile)
    -
    +
    +calc_2th(rings, wavelength=None)
    +
    +++ + + + +
    Parameters:
      +
    • rings – indices of the rings. starts at 0 and self.dSpacing should be long enough !!!
    • +
    • wavelength – wavelength in meter
    • +
    +
    +
    -
    -set_pixel1(value)
    +
    +chi2(param=None)
    -
    -set_pixel2(value)
    +
    +chi2_wavelength(param=None)
    -
    -set_splineFile(splineFile)
    -
    +
    +confidence(with_rot=True)
    +

    Confidence interval obtained from the second derivative of the error function +next to its minimum value.

    +

    Note the confidence interval increases with the number of points which is “surprizing”

    + +++ + + + + + +
    Parameters:with_rot – if true include rot1 & rot2 in the parameter set.
    Returns:std_dev, confidence
    +
    + +
    +
    +curve_fit(with_rot=True)
    +

    Refine the geometry and provide confidence interval +Use curve_fit from scipy.optimize to not only refine the geometry (unconstrained fit)

    + +++ + + + + + +
    Parameters:with_rot – include rotation intro error measurment
    Returns:std_dev, confidence
    +
    -
    -splineFile
    +
    +dist_max
    -
    -uniform_pixel = True
    +
    +dist_min
    - +
    +
    +get_dist_max()
    +
    -
    -
    -class pyFAI.detectors.DetectorMeta(name, bases, dct)
    -

    Bases: type

    -

    Metaclass used to register all detector classes inheriting from Detector

    -
    +
    +
    +get_dist_min()
    +
    -
    -
    -class pyFAI.detectors.Dexela2923(pixel1=7.5e-05, pixel2=7.5e-05)
    -

    Bases: pyFAI.detectors.Detector

    -

    Dexela CMOS family detector

    -
    -
    -MAX_SHAPE = (3888, 3072)
    +
    +
    +get_poni1_max()
    -
    -
    -aliases = ['Dexela 2923']
    +
    +
    +get_poni1_min()
    -
    -
    -force_pixel = True
    +
    +
    +get_poni2_max()
    -
    +
    +
    +get_poni2_min()
    +
    -
    -
    -class pyFAI.detectors.Eiger(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    -

    Bases: pyFAI.detectors.Detector

    -

    Eiger detector: generic description containing mask algorithm

    -
    -
    -MODULE_GAP = (37, 10)
    +
    +
    +get_rot1_max()
    -
    -
    -MODULE_SIZE = (514, 1030)
    +
    +
    +get_rot1_min()
    -
    -calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    -

    Calculate the position of each pixel center in cartesian coordinate -and in meter of a couple of coordinates. -The half pixel offset is taken into account here !!!

    - --- - - - - - - - -
    Parameters:
      -
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • -
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • -
    -
    Returns:

    p1, p2 position in meter of the center of each pixels.

    -
    Return type:

    2-tuple of numpy.ndarray

    -
    -

    d1 and d2 must have the same shape, returned array will have -the same shape.

    -
    +
    +get_rot2_max()
    +
    -
    -calc_mask()
    -

    Returns a generic mask for Pilatus detectors...

    -
    +
    +get_rot2_min()
    +
    -
    -
    -force_pixel = True
    +
    +
    +get_rot3_max()
    -
    +
    +
    +get_rot3_min()
    +
    -
    -
    -class pyFAI.detectors.Eiger16M(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    -

    Bases: pyFAI.detectors.Eiger

    -

    Eiger 16M detector

    -
    -
    -MAX_SHAPE = (4371, 4150)
    +
    +
    +get_wavelength_max()
    +
    + +
    +
    +get_wavelength_min()
    +
    +
    +guess_poni()
    +

    Poni can be guessed by the centroid of the ring with lowest 2Theta

    -
    -
    -class pyFAI.detectors.Eiger1M(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    -

    Bases: pyFAI.detectors.Eiger

    -

    Eiger 1M detector

    -
    -MAX_SHAPE = (1065, 1030)
    +
    +poni1_max
    -
    - -
    -
    -class pyFAI.detectors.Eiger4M(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    -

    Bases: pyFAI.detectors.Eiger

    -

    Eiger 4M detector

    -
    -MAX_SHAPE = (2167, 2070)
    +
    +poni1_min
    -
    +
    +
    +poni2_max
    +
    -
    -
    -class pyFAI.detectors.Eiger9M(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    -

    Bases: pyFAI.detectors.Eiger

    -

    Eiger 9M detector

    -
    -MAX_SHAPE = (3269, 3110)
    +
    +poni2_min
    -
    +
    +
    +refine1()
    +
    -
    -
    -class pyFAI.detectors.FReLoN(splineFile=None)
    -

    Bases: pyFAI.detectors.Detector

    -

    FReLoN detector: -The spline is mandatory to correct for geometric distortion of the taper

    -

    TODO: create automatically a mask that removes pixels out of the “valid reagion”

    -
    -calc_mask()
    -

    Returns a generic mask for Frelon detectors... -All pixels which (center) turns to be out of the valid region are by default discarded

    -
    +
    +refine2(maxiter=1000000, fix=None)
    +
    -
    +
    +
    +refine2_wavelength(maxiter=1000000, fix=None)
    +
    -
    -
    -class pyFAI.detectors.Fairchild(pixel1=1.5e-05, pixel2=1.5e-05)
    -

    Bases: pyFAI.detectors.Detector

    -

    Fairchild Condor 486:90 detector

    -
    -
    -MAX_SHAPE = (4096, 4096)
    +
    +
    +residu1(param, d1, d2, rings)
    -
    -
    -aliases = ['Fairchild', 'Condor', 'Fairchild Condor 486:90']
    +
    +
    +residu1_wavelength(param, d1, d2, rings)
    -
    -
    -force_pixel = True
    +
    +
    +residu2(param, d1, d2, rings)
    -
    -
    -uniform_pixel = True
    +
    +
    +residu2_wavelength(param, d1, d2, rings)
    +
    + +
    +
    +residu2_wavelength_weighted(param, d1, d2, rings, weight)
    +
    + +
    +
    +residu2_weighted(param, d1, d2, rings, weight)
    +
    +
    +roca()
    +

    run roca to optimise the parameter set

    -
    -
    -class pyFAI.detectors.HF_130K(pixel1=0.00015, pixel2=0.00015)
    -

    Bases: pyFAI.detectors.Detector

    -

    ADSC HF-130K 1 module

    -

    Informations from -http://www.adsc-xray.com/products/pixel-array-detectors/hf-130k/

    -
    -MAX_SHAPE = (256, 512)
    +
    +rot1_max
    -
    -aliases = ['HF-130k']
    +
    +rot1_min
    -
    -force_pixel = True
    +
    +rot2_max
    -
    - -
    -
    -class pyFAI.detectors.HF_1M(pixel1=0.00015, pixel2=0.00015)
    -

    Bases: pyFAI.detectors.Detector

    -

    ADSC HF-1M 2x4 modules

    -

    Informations from -http://www.adsc-xray.com/products/pixel-array-detectors/hf-1m/

    -

    Nota: gaps between modules is not known/described

    -
    -MAX_SHAPE = (1024, 1024)
    +
    +rot2_min
    -
    -aliases = ['HF-1M']
    +
    +rot3_max
    -
    -force_pixel = True
    +
    +rot3_min
    +
    + +
    +
    +set_dist_max(value)
    +
    + +
    +
    +set_dist_min(value)
    +
    + +
    +
    +set_poni1_max(value)
    +
    + +
    +
    +set_poni1_min(value)
    +
    + +
    +
    +set_poni2_max(value)
    +
    + +
    +
    +set_poni2_min(value)
    +
    + +
    +
    +set_rot1_max(value)
    +
    + +
    +
    +set_rot1_min(value)
    +
    + +
    +
    +set_rot2_max(value)
    +
    +
    +set_rot2_min(value)
    +
    + +
    +
    +set_rot3_max(value)
    +
    + +
    +
    +set_rot3_min(value)
    +
    + +
    +
    +set_tolerance(value=10)
    +

    Set the tolerance for a refinement of the geometry; in percent of the original value

    + +++ + + + +
    Parameters:value – Tolerance as a percentage
    -
    -
    -class pyFAI.detectors.HF_262k(pixel1=0.00015, pixel2=0.00015)
    -

    Bases: pyFAI.detectors.Detector

    -

    ADSC HF-262k 2 module

    -

    Informations from -http://www.adsc-xray.com/products/pixel-array-detectors/hf-262k/

    -

    Nota: gaps between modules is not known/described

    -
    -
    -MAX_SHAPE = (512, 512)
    +
    +
    +set_wavelength_max(value)
    +
    + +
    +
    +set_wavelength_min(value)
    +
    + +
    +
    +simplex(maxiter=1000000)
    -
    -aliases = ['HF-262k']
    +
    +wavelength_max
    -
    -force_pixel = True
    +
    +wavelength_min
    +
    +
    +

    detectors Module

    +

    Description of all detectors with a factory to instantiate them

    -
    -class pyFAI.detectors.HF_2M(pixel1=0.00015, pixel2=0.00015)
    +
    +class pyFAI.detectors.ADSC_Q210(pixel1=5.1e-05, pixel2=5.1e-05)

    Bases: pyFAI.detectors.Detector

    -

    ADSC HF-1M 3x6 modules

    +

    ADSC Quantum 210r detector, 2x2 chips

    Informations from -http://www.adsc-xray.com/products/pixel-array-detectors/hf-2.4m/

    -

    Nota: gaps between modules is not known/described

    +http://www.adsc-xray.com/products/ccd-detectors/q210r-ccd-detector/

    +

    Question: how are the gaps handled ?

    -
    -MAX_SHAPE = (1536, 1536)
    +
    +MAX_SHAPE = (4096, 4096)
    +
    + +
    +
    +__init__(pixel1=5.1e-05, pixel2=5.1e-05)
    -
    -aliases = ['HF-2.4M']
    +
    +aliases = ['Quantum 210']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.HF_4M(pixel1=0.00015, pixel2=0.00015)
    +
    +class pyFAI.detectors.ADSC_Q270(pixel1=6.48e-05, pixel2=6.48e-05)

    Bases: pyFAI.detectors.Detector

    -

    ADSC HF-4M 4x8 modules

    +

    ADSC Quantum 270r detector, 2x2 chips

    Informations from -http://www.adsc-xray.com/products/pixel-array-detectors/hf-4m/

    +http://www.adsc-xray.com/products/ccd-detectors/q270-ccd-detector/

    +

    Question: how are the gaps handled ?

    -
    -MAX_SHAPE = (2048, 2048)
    +
    +MAX_SHAPE = (4168, 4168)
    +
    + +
    +
    +__init__(pixel1=6.48e-05, pixel2=6.48e-05)
    -
    -aliases = ['HF-4M']
    +
    +aliases = ['Quantum 270']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.HF_9M(pixel1=0.00015, pixel2=0.00015)
    +
    +class pyFAI.detectors.ADSC_Q315(pixel1=5.1e-05, pixel2=5.1e-05)

    Bases: pyFAI.detectors.Detector

    -

    ADSC HF-130K 1 module

    +

    ADSC Quantum 315r detector, 3x3 chips

    Informations from -http://www.adsc-xray.com/products/pixel-array-detectors/hf-9-4m/

    +http://www.adsc-xray.com/products/ccd-detectors/q315r-ccd-detector/

    +

    Question: how are the gaps handled ?

    -
    -MAX_SHAPE = (3072, 3072)
    +
    +MAX_SHAPE = (6144, 6144)
    +
    + +
    +
    +__init__(pixel1=5.1e-05, pixel2=5.1e-05)
    -
    -aliases = ['HF-9.4M']
    +
    +aliases = ['Quantum 315']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.ImXPadS10(pixel1=0.00013, pixel2=0.00013, max_shape=None, module_size=None)
    +
    +class pyFAI.detectors.ADSC_Q4(pixel1=8.2e-05, pixel2=8.2e-05)

    Bases: pyFAI.detectors.Detector

    -

    ImXPad detector: ImXPad s10 detector with 1x1modules

    +

    ADSC Quantum 4r detector, 2x2 chips

    +

    Informations from +http://proteincrystallography.org/detectors/adsc.php

    +

    Question: how are the gaps handled ?

    -
    -BORDER_SIZE_RELATIVE = 2.5
    +
    +MAX_SHAPE = (2304, 2304)
    +
    + +
    +
    +__init__(pixel1=8.2e-05, pixel2=8.2e-05)
    -
    -MAX_SHAPE = (120, 80)
    +
    +aliases = ['Quantum 4']
    -
    -MODULE_SIZE = (120, 80)
    +
    +force_pixel = True
    +
    + +
    +
    +class pyFAI.detectors.Aarhus(pixel1=2.5e-05, pixel2=2.5e-05, radius=0.3)
    +

    Bases: pyFAI.detectors.Detector

    +

    Cylindrical detector made of a bent imaging-plate. +Developped at the Danish university of Aarhus +r = 1.2m or 0.3m

    +

    The image has to be laid-out horizontally

    +

    Nota: the detector is bending towards the sample, hence reducing the sample-detector distance. +This is why z<0 (or p3<0)

    +

    TODO: update cython code for 3d detectors +use expand2d instead of outer product with ones

    -
    -PIXEL_SIZE = (0.00013, 0.00013)
    +
    +IS_FLAT = False
    -
    -aliases = ['Imxpad S10']
    +
    +MAX_SHAPE = (1000, 16000)
    -
    -calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    +
    +__init__(pixel1=2.5e-05, pixel2=2.5e-05, radius=0.3)
    +
    + +
    +
    +calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)

    Calculate the position of each pixel center in cartesian coordinate and in meter of a couple of coordinates. -The half pixel offset is taken into account here !!!

    +The half pixel offset is taken into account here !!! +Adapted to Nexus detector definition

    @@ -3456,6 +3724,8 @@

    Navigation

    @@ -3471,29 +3741,16 @@

    Navigation

    the same shape.

    -
    -
    -calc_mask()
    -

    Calculate the mask

    -
    +
    +
    +force_pixel = True
    +
    -
    -calc_pixels_edges()
    -

    Calculate the position of the pixel edges

    -
    - -
    -
    -force_pixel = True
    -
    - -
    -
    -get_pixel_corners()
    +
    +get_pixel_corners(use_cython=True)

    Calculate the position of the corner of the pixels

    This should be overwritten by class representing non-contiguous detector (Xpad, ...)

    -

    Precision float32 is ok: precision of 1µm for a detector size of 1m

    Parameters:
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • +
    • center – retrieve the coordinate of the center of the pixel
    • +
    • use_cython – set to False to test Python implementeation
    @@ -3508,1133 +3765,3687 @@

    Navigation

    -
    -
    -uniform_pixel = False
    -
    -
    -
    -class pyFAI.detectors.ImXPadS140(pixel1=0.00013, pixel2=0.00013)
    -

    Bases: pyFAI.detectors.ImXPadS10

    -

    ImXPad detector: ImXPad s140 detector with 2x7modules

    +
    +class pyFAI.detectors.Apex2(pixel1=0.00012, pixel2=0.00012)
    +

    Bases: pyFAI.detectors.Detector

    +

    BrukerApex2 detector

    +

    Actually a derivative from the Fairchild detector with higher binning

    -
    -BORDER_PIXEL_SIZE_RELATIVE = 2.5
    +
    +DEFAULT_PIXEL1 = 6e-05
    -
    -MAX_SHAPE = (240, 560)
    +
    +DEFAULT_PIXEL2 = 6e-05
    -
    -MODULE_SIZE = (120, 80)
    +
    +MAX_SHAPE = (1024, 1024)
    -
    -
    -PIXEL_SIZE = (0.00013, 0.00013)
    -
    +
    +
    +__init__(pixel1=0.00012, pixel2=0.00012)
    +

    Defaults to 2x2 binning

    +
    -
    -aliases = ['Imxpad S140']
    +
    +aliases = ['ApexII', 'Bruker']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.ImXPadS70(pixel1=0.00013, pixel2=0.00013)
    -

    Bases: pyFAI.detectors.ImXPadS10

    -

    ImXPad detector: ImXPad s70 detector with 1x7modules

    -
    -
    -BORDER_SIZE_RELATIVE = 2.5
    -
    - -
    -
    -MAX_SHAPE = (120, 560)
    -
    - -
    -
    -MODULE_SIZE = (120, 80)
    -
    - +
    +class pyFAI.detectors.Basler(pixel=3.75e-06)
    +

    Bases: pyFAI.detectors.Detector

    +

    Basler camera are simple CCD camara over GigaE

    -
    -PIXEL_EDGES = None
    +
    +MAX_SHAPE = (966, 1296)
    -
    -
    -PIXEL_SIZE = (0.00013, 0.00013)
    +
    +
    +__init__(pixel=3.75e-06)
    -
    -aliases = ['Imxpad S70']
    +
    +aliases = ['aca1300']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.Mar345(pixel1=0.0001, pixel2=0.0001)
    -

    Bases: pyFAI.detectors.Detector

    -

    Mar345 Imaging plate detector

    -

    In this detector, pixels are always square -The valid image size are 2300, 2000, 1600, 1200, 3450, 3000, 2400, 1800

    +
    +class pyFAI.detectors.Detector(pixel1=None, pixel2=None, splineFile=None, max_shape=None)
    +

    Bases: object

    +

    Generic class representing a 2D detector

    -
    -MAX_SHAPE = (3450, 3450)
    +
    +API_VERSION = '1.0'
    -
    -VALID_SIZE = {2000: 0.00015, 1600: 0.00015, 3000: 0.0001, 2400: 0.0001, 3450: 0.0001, 1200: 0.00015, 2300: 0.00015, 1800: 0.0001}
    +
    +IS_CONTIGUOUS = True
    -
    -aliases = ['MAR 345', 'Mar3450']
    +
    +IS_FLAT = True
    -
    -calc_mask()
    +
    +__init__(pixel1=None, pixel2=None, splineFile=None, max_shape=None)
    +
    +++ + + + +
    Parameters:
      +
    • pixel1 (float) – size of the pixel in meter along the slow dimension (often Y)
    • +
    • pixel2 (float) – size of the pixel in meter along the fast dimension (often X)
    • +
    • splineFile (str) – path to file containing the geometric correction.
    • +
    • max_shape (2-tuple of integrers) – maximum size of the detector
    • +
    +
    +
    + +
    +
    +aliases = []
    -
    -force_pixel = True
    +
    +binning
    -
    -guess_binning(data)
    -

    Guess the binning/mode depending on the image shape -:param data: 2-tuple with the shape of the image or the image with a .shape attribute.

    -
    - +
    +calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    +

    Calculate the position of each pixel center in cartesian coordinate +and in meter of a couple of coordinates. +The half pixel offset is taken into account here !!! +Adapted to Nexus detector definition

    + +++ + + + + + + + +
    Parameters:
      +
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • +
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • +
    • center – retrieve the coordinate of the center of the pixel, unless gives one corner
    • +
    • use_cython – set to False to test Python implementation
    • +
    +
    Returns:

    position in meter of the center of each pixels.

    +
    Return type:

    3xndarray, the later being None if IS_FLAT

    +
    +

    d1 and d2 must have the same shape, returned array will have +the same shape.

    +

    pos_z is None for flat detectors

    -
    -
    -class pyFAI.detectors.NexusDetector(filename=None)
    -

    Bases: pyFAI.detectors.Detector

    -

    Class representing a 2D detector loaded from a NeXus file

    -
    -getFit2D()
    -

    Helper method to serialize the description of a detector using the Fit2d units

    +
    +calc_mask()
    +

    Method calculating the mask for a given detector

    +

    Detectors with gaps should overwrite this method with +something actually calculating the mask!

    - + - +
    Returns:representation of the detector easy to serialize
    Returns:the mask with valid pixel to 0
    Return type:dict
    Return type:numpy ndarray of int8 or None
    -
    -
    -getPyFAI()
    -

    Helper method to serialize the description of a detector using the pyFAI way -with everything in S.I units.

    +
    +
    +classmethod factory(name, config=None)
    +

    A kind of factory...

    - + - + + +
    Returns:representation of the detector easy to serialize
    Parameters:
      +
    • name (str) – name of a detector
    • +
    • config (dict or JSON representation of it.) – configuration of the detector
    • +
    +
    Return type:dict
    Returns:

    an instance of the right detector, set-up if possible

    +
    Return type:

    pyFAI.detectors.Detector

    +
    +
    +
    +force_pixel = False
    +
    +
    -
    -load(filename)
    -

    Loads the detector description from a NeXus file, adapted from: -http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html

    +
    +getFit2D()
    +

    Helper method to serialize the description of a detector using the Fit2d units

    - + + +
    Parameters:filename – name of the file on the disk
    Returns:representation of the detector easy to serialize
    Return type:dict
    -
    -
    -classmethod sload(filename)
    -

    Instantiate the detector description from a NeXus file, adapted from: -http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html

    +
    +
    +getPyFAI()
    +

    Helper method to serialize the description of a detector using the pyFAI way +with everything in S.I units.

    - + - +
    Parameters:filename – name of the file on the disk
    Returns:representation of the detector easy to serialize
    Returns:Detector instance
    Return type:dict
    -
    - -
    -
    -class pyFAI.detectors.Perkin(pixel1=0.0002, pixel2=0.0002)
    -

    Bases: pyFAI.detectors.Detector

    -

    Perkin detector

    -
    -
    -DEFAULT_PIXEL1 = 0.0002
    +
    +
    +get_binning()
    -
    -
    -DEFAULT_PIXEL2 = 0.0002
    +
    +
    +get_mask()
    -
    -
    -MAX_SHAPE = (4096, 4096)
    +
    +
    +get_maskfile()
    +
    + +
    +
    +get_name()
    +

    Get a meaningful name for detector

    +
    + +
    +
    +get_pixel1()
    +
    + +
    +
    +get_pixel2()
    +
    + +
    +
    +get_pixel_corners()
    +

    Calculate the position of the corner of the pixels

    +

    This should be overwritten by class representing non-contiguous detector (Xpad, ...)

    +

    Precision float32 is ok: precision of 1µm for a detector size of 1m

    + +++ + + + +
    Returns:4D array containing: +pixel index (slow dimension) +pixel index (fast dimension) +corner index (A, B, C or D), triangles or hexagons can be handled the same way +vertex position (z,y,x)
    +
    + +
    +
    +get_splineFile()
    +
    +
    +guess_binning(data)
    +

    Guess the binning/mode depending on the image shape +:param data: 2-tuple with the shape of the image or the image with a .shape attribute.

    +
    +
    -
    -aliases = ['Perkin detector', 'Perkin Elmer']
    +
    +mask
    -
    -force_pixel = True
    +
    +maskfile
    +
    +
    +name
    +

    Get a meaningful name for detector

    -
    -
    -class pyFAI.detectors.Pilatus(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.Detector

    -

    Pilatus detector: generic description containing mask algorithm

    -

    Sub-classed by Pilatus1M, Pilatus2M and Pilatus6M

    -
    -MODULE_GAP = (17, 7)
    +
    +pixel1
    -
    -MODULE_SIZE = (195, 487)
    +
    +pixel2
    +
    + +
    +
    +registry = {'pilatus1m_cdte': <class 'pyFAI.detectors.PilatusCdTe1M'>, 'imxpads10': <class 'pyFAI.detectors.ImXPadS10'>, 'pilatus1mcdte': <class 'pyFAI.detectors.PilatusCdTe1M'>, 'rayonix_mx225hs': <class 'pyFAI.detectors.RayonixMx225hs'>, 'pilatus_cdte_2m': <class 'pyFAI.detectors.PilatusCdTe2M'>, 'd5': <class 'pyFAI.detectors.Xpad_flat'>, 'eiger_500k': <class 'pyFAI.detectors.Eiger500k'>, 'rayonix_mx170-hs': <class 'pyFAI.detectors.RayonixMx170'>, 'imxpad_s10': <class 'pyFAI.detectors.ImXPadS10'>, 'rayonix_mx340hs': <class 'pyFAI.detectors.RayonixMx340hs'>, 'condor': <class 'pyFAI.detectors.Fairchild'>, 'eiger16m': <class 'pyFAI.detectors.Eiger16M'>, 'pilatus_1m': <class 'pyFAI.detectors.Pilatus1M'>, 'oxd_titan': <class 'pyFAI.detectors.Titan'>, 'perkin_detector': <class 'pyFAI.detectors.Perkin'>, 'pilatus6m': <class 'pyFAI.detectors.Pilatus6M'>, 'titan_2k_x_2k': <class 'pyFAI.detectors.Titan'>, 'hf_262k': <class 'pyFAI.detectors.HF_262k'>, 'thales_electronics': <class 'pyFAI.detectors.Pixium'>, 'rayonixlx255': <class 'pyFAI.detectors.RayonixLx255'>, 'rayonixsx200': <class 'pyFAI.detectors.RayonixSx200'>, 'eiger4m': <class 'pyFAI.detectors.Eiger4M'>, 'rayonix_lx170': <class 'pyFAI.detectors.RayonixLx170'>, 'pilatuscdte300kw': <class 'pyFAI.detectors.PilatusCdTe300kw'>, 'pilatus300k': <class 'pyFAI.detectors.Pilatus300k'>, 'picamv2': <class 'pyFAI.detectors.RaspberryPi8M'>, 'picamv1': <class 'pyFAI.detectors.RaspberryPi5M'>, 'quantum_270': <class 'pyFAI.detectors.ADSC_Q270'>, 'rayonixmx300': <class 'pyFAI.detectors.RayonixMx300'>, 'pilatus300kw_cdte': <class 'pyFAI.detectors.PilatusCdTe300kw'>, 'rayonixlx225hs': <class 'pyFAI.detectors.RayonixLx255'>, 'pilatuscdte1m': <class 'pyFAI.detectors.PilatusCdTe1M'>, 'raspberrypi5m': <class 'pyFAI.detectors.RaspberryPi5M'>, 'pilatus_cdte_300kw': <class 'pyFAI.detectors.PilatusCdTe300kw'>, 'perkin': <class 'pyFAI.detectors.Perkin'>, 'rayonixmx340hs': <class 'pyFAI.detectors.RayonixMx340hs'>, 'rayonix_mx325': <class 'pyFAI.detectors.RayonixMx325'>, 'picam_v2': <class 'pyFAI.detectors.RaspberryPi8M'>, 'adsc_q270': <class 'pyFAI.detectors.ADSC_Q270'>, 'rayonixmx170hs': <class 'pyFAI.detectors.RayonixMx170'>, 'pilatus_6m': <class 'pyFAI.detectors.Pilatus6M'>, 'oxdtitan': <class 'pyFAI.detectors.Titan'>, 'dexela2923': <class 'pyFAI.detectors.Dexela2923'>, 'xpads540flat': <class 'pyFAI.detectors.Xpad_flat'>, 'titan': <class 'pyFAI.detectors.Titan'>, 'aarhus': <class 'pyFAI.detectors.Aarhus'>, 'rayonix_mx425hs': <class 'pyFAI.detectors.RayonixMx425hs'>, 'hf_4m': <class 'pyFAI.detectors.HF_4M'>, 'pilatuscdte2m': <class 'pyFAI.detectors.PilatusCdTe2M'>, 'pilatuscdte300k': <class 'pyFAI.detectors.PilatusCdTe300k'>, 'pilatus_1m_cdte': <class 'pyFAI.detectors.PilatusCdTe1M'>, 'pilatus_300kw': <class 'pyFAI.detectors.Pilatus300kw'>, 'rayonixmx170-hs': <class 'pyFAI.detectors.RayonixMx170'>, 'rayonixmx300hs': <class 'pyFAI.detectors.RayonixMx300hs'>, 'pixium4700detector': <class 'pyFAI.detectors.Pixium'>, 'thaleselectronics': <class 'pyFAI.detectors.Pixium'>, 'agilenttitan': <class 'pyFAI.detectors.Titan'>, 'eiger500k': <class 'pyFAI.detectors.Eiger500k'>, 'rayonixsx165': <class 'pyFAI.detectors.RayonixSx165'>, 'pilatus100k': <class 'pyFAI.detectors.Pilatus100k'>, 'rayonix_lx170-hs': <class 'pyFAI.detectors.RayonixLx170'>, 'perkin_elmer': <class 'pyFAI.detectors.Perkin'>, 'aca1300': <class 'pyFAI.detectors.Basler'>, 'quantum315': <class 'pyFAI.detectors.ADSC_Q315'>, 'quantum4': <class 'pyFAI.detectors.ADSC_Q4'>, 'rayonixsx85hs': <class 'pyFAI.detectors.RayonixSx85hs'>, 'eiger_4m': <class 'pyFAI.detectors.Eiger4M'>, 'imxpads140': <class 'pyFAI.detectors.ImXPadS140'>, 'rayonix_mx170': <class 'pyFAI.detectors.RayonixMx170'>, 'pilatus300kw': <class 'pyFAI.detectors.Pilatus300kw'>, 'hf-130k': <class 'pyFAI.detectors.HF_130K'>, 'pilatus_100k': <class 'pyFAI.detectors.Pilatus100k'>, 'rayonixsx30hs': <class 'pyFAI.detectors.RayonixSx30hs'>, 'mar345': <class 'pyFAI.detectors.Mar345'>, 'perkindetector': <class 'pyFAI.detectors.Perkin'>, 'rayonix_mx425_hs': <class 'pyFAI.detectors.RayonixMx425hs'>, 'rayonix_mx225': <class 'pyFAI.detectors.RayonixMx225'>, 'eiger1m': <class 'pyFAI.detectors.Eiger1M'>, 'mar_345': <class 'pyFAI.detectors.Mar345'>, 'pilatus2m': <class 'pyFAI.detectors.Pilatus2M'>, 'hf_9m': <class 'pyFAI.detectors.HF_9M'>, 'rayonixlx170hs': <class 'pyFAI.detectors.RayonixLx170'>, 'hf-1m': <class 'pyFAI.detectors.HF_1M'>, 'eiger_1m': <class 'pyFAI.detectors.Eiger1M'>, 'rayonix_lx170_hs': <class 'pyFAI.detectors.RayonixLx170'>, 'rayonixmx170': <class 'pyFAI.detectors.RayonixMx170'>, 'pilatus2mcdte': <class 'pyFAI.detectors.PilatusCdTe2M'>, 'mar165': <class 'pyFAI.detectors.RayonixSx165'>, 'rayonixlx255-hs': <class 'pyFAI.detectors.RayonixLx255'>, 'pilatus_200k': <class 'pyFAI.detectors.Pilatus200k'>, 'hf_2m': <class 'pyFAI.detectors.HF_2M'>, 'titan2kx2k': <class 'pyFAI.detectors.Titan'>, 'pilatus_cdte_1m': <class 'pyFAI.detectors.PilatusCdTe1M'>, 'hf-9.4m': <class 'pyFAI.detectors.HF_9M'>, 'fairchild_condor_486:90': <class 'pyFAI.detectors.Fairchild'>, 'hf-262k': <class 'pyFAI.detectors.HF_262k'>, 'xpad_flat': <class 'pyFAI.detectors.Xpad_flat'>, 'quantum_315': <class 'pyFAI.detectors.ADSC_Q315'>, 'eiger_16m': <class 'pyFAI.detectors.Eiger16M'>, 'pilatus_300k': <class 'pyFAI.detectors.Pilatus300k'>, 'raspberrypi8m': <class 'pyFAI.detectors.RaspberryPi8M'>, 'pilatus1m': <class 'pyFAI.detectors.Pilatus1M'>, 'xpad_s540_flat': <class 'pyFAI.detectors.Xpad_flat'>, 'pixium_4700_detector': <class 'pyFAI.detectors.Pixium'>, 'basler': <class 'pyFAI.detectors.Basler'>, 'pilatus2m_cdte': <class 'pyFAI.detectors.PilatusCdTe2M'>, 'rayonix_sx200': <class 'pyFAI.detectors.RayonixSx200'>, 'quantum270': <class 'pyFAI.detectors.ADSC_Q270'>, 'dexela_2923': <class 'pyFAI.detectors.Dexela2923'>, 'mar3450': <class 'pyFAI.detectors.Mar345'>, 'pixium': <class 'pyFAI.detectors.Pixium'>, 'fairchild': <class 'pyFAI.detectors.Fairchild'>, 'rayonixmx225hs': <class 'pyFAI.detectors.RayonixMx225hs'>, 'apexii': <class 'pyFAI.detectors.Apex2'>, 'quantum_210': <class 'pyFAI.detectors.ADSC_Q210'>, 'bruker': <class 'pyFAI.detectors.Apex2'>, 'pilatus300kwcdte': <class 'pyFAI.detectors.PilatusCdTe300kw'>, 'pilatus_2m': <class 'pyFAI.detectors.Pilatus2M'>, 'rayonixmx425hs': <class 'pyFAI.detectors.RayonixMx425hs'>, 'imxpads70': <class 'pyFAI.detectors.ImXPadS70'>, 'pilatus_300k_cdte': <class 'pyFAI.detectors.PilatusCdTe300k'>, 'rayonix_sx30hs': <class 'pyFAI.detectors.RayonixSx30hs'>, 'eiger9m': <class 'pyFAI.detectors.Eiger9M'>, 'agilent_titan': <class 'pyFAI.detectors.Titan'>, 'rayonixlx255hs': <class 'pyFAI.detectors.RayonixLx255'>, 'rayonix133': <class 'pyFAI.detectors.Rayonix133'>, 'rayonix_lx255': <class 'pyFAI.detectors.RayonixLx255'>, 'rayonixlx170-hs': <class 'pyFAI.detectors.RayonixLx170'>, 'perkinelmer': <class 'pyFAI.detectors.Perkin'>, 'rayonix': <class 'pyFAI.detectors.Rayonix'>, 'rayonix_sx165': <class 'pyFAI.detectors.RayonixSx165'>, 'rayonix_mx300hs': <class 'pyFAI.detectors.RayonixMx300hs'>, 'rayonix_lx255-hs': <class 'pyFAI.detectors.RayonixLx255'>, 'adsc_q4': <class 'pyFAI.detectors.ADSC_Q4'>, 'rayonixmx225': <class 'pyFAI.detectors.RayonixMx225'>, 'rayonix_sx30_hs': <class 'pyFAI.detectors.RayonixSx30hs'>, 'apex2': <class 'pyFAI.detectors.Apex2'>, 'hf-2.4m': <class 'pyFAI.detectors.HF_2M'>, 'pilatus_cdte_300k': <class 'pyFAI.detectors.PilatusCdTe300k'>, 'detector': <class 'pyFAI.detectors.Detector'>, 'pilatus_2m_cdte': <class 'pyFAI.detectors.PilatusCdTe2M'>, 'picam_v1': <class 'pyFAI.detectors.RaspberryPi5M'>, 'imxpad_s140': <class 'pyFAI.detectors.ImXPadS140'>, 'fairchildcondor486:90': <class 'pyFAI.detectors.Fairchild'>, 'adsc_q210': <class 'pyFAI.detectors.ADSC_Q210'>, 'pilatus300kcdte': <class 'pyFAI.detectors.PilatusCdTe300k'>, 'rayonixlx170': <class 'pyFAI.detectors.RayonixLx170'>, 'pilatus300k_cdte': <class 'pyFAI.detectors.PilatusCdTe300k'>, 'rayonix_sx85_hs': <class 'pyFAI.detectors.RayonixSx85hs'>, 'rayonix_mx170_hs': <class 'pyFAI.detectors.RayonixMx170'>, 'rayonix_lx_255hs': <class 'pyFAI.detectors.RayonixLx255'>, 'quantum210': <class 'pyFAI.detectors.ADSC_Q210'>, 'hf_1m': <class 'pyFAI.detectors.HF_1M'>, 'rayonix_mx225_hs': <class 'pyFAI.detectors.RayonixMx225hs'>, 'mar133': <class 'pyFAI.detectors.Rayonix133'>, 'pilatus200k': <class 'pyFAI.detectors.Pilatus200k'>, 'hf_130k': <class 'pyFAI.detectors.HF_130K'>, 'pilatus_300kw_cdte': <class 'pyFAI.detectors.PilatusCdTe300kw'>, 'imxpad_s70': <class 'pyFAI.detectors.ImXPadS70'>, 'adsc_q315': <class 'pyFAI.detectors.ADSC_Q315'>, 'rayonixmx325': <class 'pyFAI.detectors.RayonixMx325'>, 'rayonix_sx85hs': <class 'pyFAI.detectors.RayonixSx85hs'>, 'eiger_9m': <class 'pyFAI.detectors.Eiger9M'>, 'rayonix_mx300_hs': <class 'pyFAI.detectors.RayonixMx300hs'>, 'hf-4m': <class 'pyFAI.detectors.HF_4M'>, 'rayonix_mx300': <class 'pyFAI.detectors.RayonixMx300'>, 'quantum_4': <class 'pyFAI.detectors.ADSC_Q4'>}
    -
    -calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    -

    Calculate the position of each pixel center in cartesian coordinate -and in meter of a couple of coordinates. -The half pixel offset is taken into account here !!!

    +
    +save(filename)
    +

    Saves the detector description into a NeXus file, adapted from: +http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html +Main differences:

    +
    +
      +
    • differentiate pixel center from pixel corner offsets
    • +
    • store all offsets are ndarray according to slow/fast dimension (not x, y)
    • +
    +
    - + - + +
    Parameters:
      -
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • -
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • -
    -
    Parameters:filename – name of the file on the disc
    Returns:

    position in meter of the center of each pixels.

    -
    +
    + +
    +
    +setFit2D(**kwarg)
    +

    Twin method of getFit2D: setup a detector instance according to a description

    + +++ + - + +
    Parameters:kwarg – dictionary containing pixel1, pixel2 and splineFile
    Return type:

    ndarray

    -
    +
    + +
    +
    +setPyFAI(**kwarg)
    +

    Twin method of getPyFAI: setup a detector instance according to a description

    + +++ +
    Parameters:kwarg – dictionary containing detector, pixel1, pixel2 and splineFile
    -

    d1 and d2 must have the same shape, returned array will have -the same shape.

    -
    -calc_mask()
    -

    Returns a generic mask for Pilatus detectors...

    +
    +set_binning(bin_size=(1, 1))
    +

    Set the “binning” of the detector,

    + +++ + + + +
    Parameters:bin_size ((int, int)) – binning as integer or tuple of integers.
    -
    -
    -force_pixel = True
    -
    +
    +
    +set_config(config)
    +

    Sets the configuration of the detector. This implies: +- Orientation: integers +- Binning +- ROI

    +

    The configuration is either a python dictionary or a JSON string or a file containing this JSON configuration

    +

    keys in that dictionary are : +“orientation”: integers from 0 to 7 +“binning”: integer or 2-tuple of integers. If only one integer is provided, +“offset”: coordinate (in pixels) of the start of the detector

    +
    -
    -get_splineFile()
    -
    +
    +set_dx(dx=None)
    +

    set the pixel-wise displacement along X (dim2):

    +
    -
    -set_splineFile(splineFile=None)
    -

    In this case splinefile is a couple filenames

    +
    +set_dy(dy=None)
    +

    set the pixel-wise displacement along Y (dim1):

    -
    -
    -splineFile
    +
    +
    +set_mask(mask)
    -
    +
    +
    +set_maskfile(maskfile)
    +
    -
    -
    -class pyFAI.detectors.Pilatus100k(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.Pilatus

    -

    Pilatus 100k detector

    -
    -
    -MAX_SHAPE = (195, 487)
    +
    +
    +set_pixel1(value)
    -
    +
    +
    +set_pixel2(value)
    +
    -
    -
    -class pyFAI.detectors.Pilatus1M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.Pilatus

    -

    Pilatus 1M detector

    -
    -
    -MAX_SHAPE = (1043, 981)
    +
    +
    +set_splineFile(splineFile)
    -
    +
    +
    +splineFile
    +
    -
    -
    -class pyFAI.detectors.Pilatus200k(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.Pilatus

    -

    Pilatus 200k detector

    -
    -MAX_SHAPE = (407, 487)
    +
    +uniform_pixel = True
    -
    -class pyFAI.detectors.Pilatus2M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.Pilatus

    -

    Pilatus 2M detector

    -
    -
    -MAX_SHAPE = (1679, 1475)
    +
    +class pyFAI.detectors.DetectorMeta(name, bases, dct)
    +

    Bases: type

    +

    Metaclass used to register all detector classes inheriting from Detector

    +
    +
    +__init__(name, bases, dct)
    -
    -class pyFAI.detectors.Pilatus300k(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.Pilatus

    -

    Pilatus 300k detector

    +
    +class pyFAI.detectors.Dexela2923(pixel1=7.5e-05, pixel2=7.5e-05)
    +

    Bases: pyFAI.detectors.Detector

    +

    Dexela CMOS family detector

    -
    -MAX_SHAPE = (619, 487)
    +
    +MAX_SHAPE = (3888, 3072)
    -
    +
    +
    +__init__(pixel1=7.5e-05, pixel2=7.5e-05)
    +
    -
    -
    -class pyFAI.detectors.Pilatus300kw(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.Pilatus

    -

    Pilatus 300k-wide detector

    -
    -MAX_SHAPE = (195, 1475)
    +
    +aliases = ['Dexela 2923']
    +
    + +
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.Pilatus6M(pixel1=0.000172, pixel2=0.000172)
    -

    Bases: pyFAI.detectors.Pilatus

    -

    Pilatus 6M detector

    +
    +class pyFAI.detectors.Eiger(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    +

    Bases: pyFAI.detectors.Detector

    +

    Eiger detector: generic description containing mask algorithm

    -
    -MAX_SHAPE = (2527, 2463)
    +
    +MODULE_GAP = (37, 10)
    -
    +
    +
    +MODULE_SIZE = (514, 1030)
    +
    -
    -
    -class pyFAI.detectors.PilatusCdTe(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.Pilatus

    -

    Pilatus CdTe detector: Like the Pilatus with an extra 3 pixel in the middle -of every module (vertically)

    -
    -calc_mask()
    -

    Returns a generic mask for Pilatus detectors...

    +
    +__init__(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    +
    + +
    +
    +calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    +

    Calculate the position of each pixel center in cartesian coordinate +and in meter of a couple of coordinates. +The half pixel offset is taken into account here !!!

    + +++ + + + + + + + +
    Parameters:
      +
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • +
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • +
    +
    Returns:

    p1, p2 position in meter of the center of each pixels.

    +
    Return type:

    2-tuple of numpy.ndarray

    +
    +

    d1 and d2 must have the same shape, returned array will have +the same shape.

    +
    +
    +calc_mask()
    +

    Returns a generic mask for Pilatus detectors...

    -
    -
    -class pyFAI.detectors.PilatusCdTe1M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.PilatusCdTe

    -

    Pilatus CdTe 1M detector

    -
    -MAX_SHAPE = (1043, 981)
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.PilatusCdTe2M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.PilatusCdTe

    -

    Pilatus CdTe 2M detector

    +
    +class pyFAI.detectors.Eiger16M(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    +

    Bases: pyFAI.detectors.Eiger

    +

    Eiger 16M detector

    -
    -MAX_SHAPE = (1679, 1475)
    +
    +MAX_SHAPE = (4371, 4150)
    -
    - -
    -
    -class pyFAI.detectors.PilatusCdTe300k(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.PilatusCdTe

    -

    Pilatus CdTe 300k detector

    -
    -MAX_SHAPE = (619, 487)
    +
    +aliases = ['Eiger 16M']
    -
    -class pyFAI.detectors.PilatusCdTe300kw(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    -

    Bases: pyFAI.detectors.PilatusCdTe

    -

    Pilatus CdTe 300k-wide detector

    +
    +class pyFAI.detectors.Eiger1M(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    +

    Bases: pyFAI.detectors.Eiger

    +

    Eiger 1M detector

    -
    -MAX_SHAPE = (195, 1475)
    +
    +MAX_SHAPE = (1065, 1030)
    +
    + +
    +
    +aliases = ['Eiger 1M']
    -
    -class pyFAI.detectors.Pixium(pixel1=0.000308, pixel2=0.000308)
    -

    Bases: pyFAI.detectors.Detector

    -

    PIXIUM 4700 detector

    -

    High energy X ray diffraction using the Pixium 4700 flat panel detector -J E Daniels, M Drakopoulos, et al.; Journal of Synchrotron Radiation 16(Pt 4):463-8 · August 2009

    +
    +class pyFAI.detectors.Eiger4M(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    +

    Bases: pyFAI.detectors.Eiger

    +

    Eiger 4M detector

    -
    -DEFAULT_PIXEL1 = 0.000154
    +
    +MAX_SHAPE = (2167, 2070)
    -
    -DEFAULT_PIXEL2 = 0.000154
    +
    +aliases = ['Eiger 4M']
    -
    -
    -MAX_SHAPE = (1910, 2480)
    -
    +
    +
    +
    +class pyFAI.detectors.Eiger500k(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    +

    Bases: pyFAI.detectors.Eiger

    +

    Eiger 1M detector

    -
    -aliases = ['Pixium 4700 detector', 'Thales Electronics']
    +
    +MAX_SHAPE = (512, 1030)
    -
    -force_pixel = True
    +
    +aliases = ['Eiger 500k']
    -
    -class pyFAI.detectors.RaspberryPi(pixel1=1.4e-06, pixel2=1.4e-06)
    -

    Bases: pyFAI.detectors.Detector

    -

    5 Mpix detector from Raspberry Pi

    +
    +class pyFAI.detectors.Eiger9M(pixel1=7.5e-05, pixel2=7.5e-05, max_shape=None, module_size=None)
    +

    Bases: pyFAI.detectors.Eiger

    +

    Eiger 9M detector

    -
    -MAX_SHAPE = (1944, 2592)
    +
    +MAX_SHAPE = (3269, 3110)
    -
    -aliases = ['Raspberry', 'Pi']
    +
    +aliases = ['Eiger 9M']
    -
    -
    -force_pixel = True
    +
    + +
    +
    +class pyFAI.detectors.FReLoN(splineFile=None)
    +

    Bases: pyFAI.detectors.Detector

    +

    FReLoN detector: +The spline is mandatory to correct for geometric distortion of the taper

    +

    TODO: create automatically a mask that removes pixels out of the “valid reagion”

    +
    +
    +__init__(splineFile=None)
    +
    +
    +calc_mask()
    +

    Returns a generic mask for Frelon detectors... +All pixels which (center) turns to be out of the valid region are by default discarded

    +
    +
    -
    -class pyFAI.detectors.Rayonix(pixel1=3.2e-05, pixel2=3.2e-05)
    +
    +class pyFAI.detectors.Fairchild(pixel1=1.5e-05, pixel2=1.5e-05)

    Bases: pyFAI.detectors.Detector

    +

    Fairchild Condor 486:90 detector

    -
    -BINNED_PIXEL_SIZE = {1: 3.2e-05}
    +
    +MAX_SHAPE = (4096, 4096)
    -
    -
    -MAX_SHAPE = (4096, 4096)
    +
    +
    +__init__(pixel1=1.5e-05, pixel2=1.5e-05)
    -
    -binning
    +
    +aliases = ['Fairchild', 'Condor', 'Fairchild Condor 486:90']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -
    -get_binning()
    +
    +
    +uniform_pixel = True
    -
    -
    -guess_binning(data)
    -

    Guess the binning/mode depending on the image shape -:param data: 2-tuple with the shape of the image or the image with a .shape attribute.

    -
    - -
    -
    -set_binning(bin_size=(1, 1))
    -

    Set the “binning” of the detector,

    - --- - - - -
    Parameters:bin_size (int or (int, int)) – set the binning of the detector
    -
    -
    -
    -class pyFAI.detectors.Rayonix133(pixel1=6.4e-05, pixel2=6.4e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix 133 2D CCD detector detector also known as mar133

    -

    Personnal communication from M. Blum

    -

    What should be the default binning factor for those cameras ?

    -

    Circular detector

    +
    +class pyFAI.detectors.HF_130K(pixel1=0.00015, pixel2=0.00015)
    +

    Bases: pyFAI.detectors.Detector

    +

    ADSC HF-130K 1 module

    +

    Informations from +http://www.adsc-xray.com/products/pixel-array-detectors/hf-130k/

    -
    -BINNED_PIXEL_SIZE = {8: 0.000256, 1: 3.2e-05, 2: 6.4e-05, 4: 0.000128}
    +
    +MAX_SHAPE = (256, 512)
    -
    -
    -MAX_SHAPE = (4096, 4096)
    +
    +
    +__init__(pixel1=0.00015, pixel2=0.00015)
    -
    -aliases = ['MAR133']
    +
    +aliases = ['HF-130k']
    -
    -
    -calc_mask()
    -

    Circular mask

    -
    -
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.RayonixLx170(pixel1=4.42708e-05, pixel2=4.42708e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix lx170 2d CCD Detector (2x1 CCDs).

    -

    Nota: this is the same for lx170hs

    +
    +class pyFAI.detectors.HF_1M(pixel1=0.00015, pixel2=0.00015)
    +

    Bases: pyFAI.detectors.Detector

    +

    ADSC HF-1M 2x4 modules

    +

    Informations from +http://www.adsc-xray.com/products/pixel-array-detectors/hf-1m/

    +

    Nota: gaps between modules is not known/described

    -
    -BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    +MAX_SHAPE = (1024, 1024)
    -
    -
    -MAX_SHAPE = (1920, 3840)
    +
    +
    +__init__(pixel1=0.00015, pixel2=0.00015)
    -
    -aliases = ['Rayonix lx170']
    +
    +aliases = ['HF-1M']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.RayonixLx255(pixel1=4.42708e-05, pixel2=4.42708e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix lx255 2d Detector (3x1 CCDs)

    -

    Nota: this detector is also called lx255hs

    +
    +class pyFAI.detectors.HF_262k(pixel1=0.00015, pixel2=0.00015)
    +

    Bases: pyFAI.detectors.Detector

    +

    ADSC HF-262k 2 module

    +

    Informations from +http://www.adsc-xray.com/products/pixel-array-detectors/hf-262k/

    +

    Nota: gaps between modules is not known/described

    -
    -BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    +MAX_SHAPE = (512, 512)
    +
    + +
    +
    +__init__(pixel1=0.00015, pixel2=0.00015)
    -
    -MAX_SHAPE = (1920, 5760)
    +
    +aliases = ['HF-262k']
    -
    -aliases = ['Rayonix lx255', 'Rayonix lx255hs']
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.RayonixMx170(pixel1=4.42708e-05, pixel2=4.42708e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix mx170 2d CCD Detector (2x2 CCDs).

    -

    Nota: this is the same for mx170hs

    +
    +class pyFAI.detectors.HF_2M(pixel1=0.00015, pixel2=0.00015)
    +

    Bases: pyFAI.detectors.Detector

    +

    ADSC HF-1M 3x6 modules

    +

    Informations from +http://www.adsc-xray.com/products/pixel-array-detectors/hf-2.4m/

    +

    Nota: gaps between modules is not known/described

    -
    -BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    +MAX_SHAPE = (1536, 1536)
    +
    + +
    +
    +__init__(pixel1=0.00015, pixel2=0.00015)
    -
    -MAX_SHAPE = (3840, 3840)
    +
    +aliases = ['HF-2.4M']
    -
    -aliases = ['Rayonix mx170']
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.RayonixMx225(pixel1=7.3242e-05, pixel2=7.3242e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix mx225 2D CCD detector detector

    -

    Nota: this is the same definition for mx225he -Personnal communication from M. Blum

    +
    +class pyFAI.detectors.HF_4M(pixel1=0.00015, pixel2=0.00015)
    +

    Bases: pyFAI.detectors.Detector

    +

    ADSC HF-4M 4x8 modules

    +

    Informations from +http://www.adsc-xray.com/products/pixel-array-detectors/hf-4m/

    -
    -BINNED_PIXEL_SIZE = {8: 0.000292969, 1: 3.6621e-05, 2: 7.3242e-05, 3: 0.000109971, 4: 0.000146484}
    +
    +MAX_SHAPE = (2048, 2048)
    -
    -
    -MAX_SHAPE = (6144, 6144)
    +
    +
    +__init__(pixel1=0.00015, pixel2=0.00015)
    -
    -aliases = ['Rayonix mx225']
    +
    +aliases = ['HF-4M']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.RayonixMx225hs(pixel1=7.8125e-05, pixel2=7.8125e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix mx225hs 2D CCD detector detector

    -

    Pixel size from a personnal communication from M. Blum

    +
    +class pyFAI.detectors.HF_9M(pixel1=0.00015, pixel2=0.00015)
    +

    Bases: pyFAI.detectors.Detector

    +

    ADSC HF-130K 1 module

    +

    Informations from +http://www.adsc-xray.com/products/pixel-array-detectors/hf-9-4m/

    -
    -BINNED_PIXEL_SIZE = {1: 3.90625e-05, 2: 7.8125e-05, 3: 0.0001171875, 4: 0.00015625, 5: 0.0001953125, 6: 0.000234375, 8: 0.0003125, 10: 0.000390625}
    +
    +MAX_SHAPE = (3072, 3072)
    -
    -
    -MAX_SHAPE = (5760, 5760)
    +
    +
    +__init__(pixel1=0.00015, pixel2=0.00015)
    -
    -aliases = ['Rayonix mx225hs']
    +
    +aliases = ['HF-9.4M']
    -
    -force_pixel = True
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.RayonixMx300(pixel1=7.3242e-05, pixel2=7.3242e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix mx300 2D detector (4x4 CCDs)

    -

    Pixel size from a personnal communication from M. Blum

    +
    +class pyFAI.detectors.ImXPadS10(pixel1=0.00013, pixel2=0.00013, max_shape=None, module_size=None)
    +

    Bases: pyFAI.detectors.Detector

    +

    ImXPad detector: ImXPad s10 detector with 1x1modules

    -
    -BINNED_PIXEL_SIZE = {8: 0.000292969, 1: 3.6621e-05, 2: 7.3242e-05, 3: 0.000109971, 4: 0.000146484}
    +
    +BORDER_SIZE_RELATIVE = 2.5
    -
    -MAX_SHAPE = (8192, 8192)
    +
    +MAX_SHAPE = (120, 80)
    -
    -aliases = ['Rayonix mx300']
    +
    +MODULE_SIZE = (120, 80)
    -
    -force_pixel = True
    +
    +PIXEL_SIZE = (0.00013, 0.00013)
    -
    - -
    -
    -class pyFAI.detectors.RayonixMx300hs(pixel1=7.8125e-05, pixel2=7.8125e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix mx300hs 2D detector (4x4 CCDs)

    -

    Pixel size from a personnal communication from M. Blum

    -
    -
    -BINNED_PIXEL_SIZE = {1: 3.90625e-05, 2: 7.8125e-05, 3: 0.0001171875, 4: 0.00015625, 5: 0.0001953125, 6: 0.000234375, 8: 0.0003125, 10: 0.000390625}
    +
    +
    +__init__(pixel1=0.00013, pixel2=0.00013, max_shape=None, module_size=None)
    -
    -MAX_SHAPE = (7680, 7680)
    +
    +aliases = ['Imxpad S10']
    +
    +
    +calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    +

    Calculate the position of each pixel center in cartesian coordinate +and in meter of a couple of coordinates. +The half pixel offset is taken into account here !!!

    + +++ + + + + + + + +
    Parameters:
      +
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • +
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • +
    +
    Returns:

    position in meter of the center of each pixels.

    +
    Return type:

    ndarray

    +
    +

    d1 and d2 must have the same shape, returned array will have +the same shape.

    +
    + +
    +
    +calc_mask()
    +

    Calculate the mask

    +
    + +
    +
    +calc_pixels_edges()
    +

    Calculate the position of the pixel edges

    +
    +
    -
    -aliases = ['Rayonix mx300hs']
    +
    +force_pixel = True
    +
    +
    +get_pixel_corners(d1=None, d2=None)
    +

    Calculate the position of the corner of the pixels

    +

    This should be overwritten by class representing non-contiguous detector (Xpad, ...)

    +

    Precision float32 is ok: precision of 1µm for a detector size of 1m

    + +++ + + + +
    Returns:4D array containing: +pixel index (slow dimension) +pixel index (fast dimension) +corner index (A, B, C or D), triangles or hexagons can be handled the same way +vertex position (z,y,x)
    +
    +
    -
    -force_pixel = True
    +
    +uniform_pixel = False
    -
    -class pyFAI.detectors.RayonixMx325(pixel1=7.9346e-05, pixel2=7.9346e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix mx325 and mx325he 2D detector (4x4 CCD chips)

    -

    Pixel size from a personnal communication from M. Blum

    +
    +class pyFAI.detectors.ImXPadS140(pixel1=0.00013, pixel2=0.00013)
    +

    Bases: pyFAI.detectors.ImXPadS10

    +

    ImXPad detector: ImXPad s140 detector with 2x7modules

    -
    -BINNED_PIXEL_SIZE = {8: 0.000317383, 1: 3.9673e-05, 2: 7.9346e-05, 3: 0.000119135, 4: 0.000158691}
    +
    +BORDER_PIXEL_SIZE_RELATIVE = 2.5
    -
    -MAX_SHAPE = (8192, 8192)
    +
    +MAX_SHAPE = (240, 560)
    -
    -aliases = ['Rayonix mx325']
    +
    +MODULE_SIZE = (120, 80)
    +
    + +
    +
    +PIXEL_SIZE = (0.00013, 0.00013)
    +
    + +
    +
    +__init__(pixel1=0.00013, pixel2=0.00013)
    +
    + +
    +
    +aliases = ['Imxpad S140']
    +
    + +
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.RayonixMx340hs(pixel1=8.85417e-05, pixel2=8.85417e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix mx340hs 2D detector (4x4 CCDs)

    -

    Pixel size from a personnal communication from M. Blum

    +
    +class pyFAI.detectors.ImXPadS70(pixel1=0.00013, pixel2=0.00013)
    +

    Bases: pyFAI.detectors.ImXPadS10

    +

    ImXPad detector: ImXPad s70 detector with 1x7modules

    -
    -BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    +BORDER_SIZE_RELATIVE = 2.5
    -
    -MAX_SHAPE = (7680, 7680)
    +
    +MAX_SHAPE = (120, 560)
    -
    -aliases = ['Rayonix mx340hs']
    +
    +MODULE_SIZE = (120, 80)
    -
    -force_pixel = True
    +
    +PIXEL_EDGES = None
    +
    + +
    +
    +PIXEL_SIZE = (0.00013, 0.00013)
    +
    + +
    +
    +__init__(pixel1=0.00013, pixel2=0.00013)
    +
    + +
    +
    +aliases = ['Imxpad S70']
    +
    + +
    +
    +force_pixel = True
    -
    -class pyFAI.detectors.RayonixMx425hs(pixel1=4.42708e-05, pixel2=4.42708e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix mx425hs 2D CCD camera (5x5 CCD chip)

    -

    Pixel size from a personnal communication from M. Blum

    +
    +class pyFAI.detectors.Mar345(pixel1=0.0001, pixel2=0.0001)
    +

    Bases: pyFAI.detectors.Detector

    +

    Mar345 Imaging plate detector

    +

    In this detector, pixels are always square +The valid image size are 2300, 2000, 1600, 1200, 3450, 3000, 2400, 1800

    -
    -BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    +MAX_SHAPE = (3450, 3450)
    -
    -MAX_SHAPE = (9600, 9600)
    +
    +VALID_SIZE = {2000: 0.00015, 1600: 0.00015, 3000: 0.0001, 2400: 0.0001, 3450: 0.0001, 1200: 0.00015, 2300: 0.00015, 1800: 0.0001}
    +
    + +
    +
    +__init__(pixel1=0.0001, pixel2=0.0001)
    -
    -aliases = ['Rayonix mx425hs']
    +
    +aliases = ['MAR 345', 'Mar3450']
    +
    + +
    +
    +calc_mask()
    +
    + +
    +
    +force_pixel = True
    +
    +
    +guess_binning(data)
    +

    Guess the binning/mode depending on the image shape +:param data: 2-tuple with the shape of the image or the image with a .shape attribute.

    +
    +
    -
    -class pyFAI.detectors.RayonixSx165(pixel1=3.95e-05, pixel2=3.95e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix sx165 2d Detector also known as MAR165.

    -

    Circular detector

    +
    +class pyFAI.detectors.NexusDetector(filename=None)
    +

    Bases: pyFAI.detectors.Detector

    +

    Class representing a 2D detector loaded from a NeXus file

    +
    +
    +__init__(filename=None)
    +
    + +
    +
    +getFit2D()
    +

    Helper method to serialize the description of a detector using the Fit2d units

    + +++ + + + + + +
    Returns:representation of the detector easy to serialize
    Return type:dict
    +
    + +
    +
    +getPyFAI()
    +

    Helper method to serialize the description of a detector using the pyFAI way +with everything in S.I units.

    + +++ + + + + + +
    Returns:representation of the detector easy to serialize
    Return type:dict
    +
    + +
    +
    +load(filename)
    +

    Loads the detector description from a NeXus file, adapted from: +http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html

    + +++ + + + +
    Parameters:filename – name of the file on the disk
    +
    + +
    +
    +classmethod sload(filename)
    +

    Instantiate the detector description from a NeXus file, adapted from: +http://download.nexusformat.org/sphinx/classes/base_classes/NXdetector.html

    + +++ + + + + + +
    Parameters:filename – name of the file on the disk
    Returns:Detector instance
    +
    + +
    + +
    +
    +class pyFAI.detectors.Perkin(pixel1=0.0002, pixel2=0.0002)
    +

    Bases: pyFAI.detectors.Detector

    +

    Perkin detector

    -
    -BINNED_PIXEL_SIZE = {8: 0.000316, 1: 3.95e-05, 2: 7.9e-05, 3: 0.000118616, 4: 0.000158}
    +
    +DEFAULT_PIXEL1 = 0.0002
    -
    -MAX_SHAPE = (4096, 4096)
    +
    +DEFAULT_PIXEL2 = 0.0002
    -
    -aliases = ['MAR165', 'Rayonix Sx165']
    +
    +MAX_SHAPE = (4096, 4096)
    +
    + +
    +
    +__init__(pixel1=0.0002, pixel2=0.0002)
    +
    + +
    +
    +aliases = ['Perkin detector', 'Perkin Elmer']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pilatus(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Detector

    +

    Pilatus detector: generic description containing mask algorithm

    +

    Sub-classed by Pilatus1M, Pilatus2M and Pilatus6M

    +
    +
    +MODULE_GAP = (17, 7)
    +
    + +
    +
    +MODULE_SIZE = (195, 487)
    -
    -calc_mask()
    -

    Circular mask

    +
    +__init__(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +
    + +
    +
    +calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    +

    Calculate the position of each pixel center in cartesian coordinate +and in meter of a couple of coordinates. +The half pixel offset is taken into account here !!!

    + +++ + + + + + + + +
    Parameters:
      +
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • +
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • +
    +
    Returns:

    position in meter of the center of each pixels.

    +
    Return type:

    ndarray

    +
    +

    d1 and d2 must have the same shape, returned array will have +the same shape.

    +
    + +
    +
    +calc_mask()
    +

    Returns a generic mask for Pilatus detectors...

    +
    + +
    +
    +force_pixel = True
    +
    + +
    +
    +get_splineFile()
    +
    + +
    +
    +set_splineFile(splineFile=None)
    +

    In this case splinefile is a couple filenames

    +
    + +
    +
    +splineFile
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pilatus100k(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Pilatus

    +

    Pilatus 100k detector

    +
    +
    +MAX_SHAPE = (195, 487)
    +
    + +
    +
    +aliases = ['Pilatus 100k']
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pilatus1M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Pilatus

    +

    Pilatus 1M detector

    +
    +
    +MAX_SHAPE = (1043, 981)
    +
    + +
    +
    +aliases = ['Pilatus 1M']
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pilatus200k(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Pilatus

    +

    Pilatus 200k detector

    +
    +
    +MAX_SHAPE = (407, 487)
    +
    + +
    +
    +aliases = ['Pilatus 200k']
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pilatus2M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Pilatus

    +

    Pilatus 2M detector

    +
    +
    +MAX_SHAPE = (1679, 1475)
    +
    + +
    +
    +aliases = ['Pilatus 2M']
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pilatus300k(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Pilatus

    +

    Pilatus 300k detector

    +
    +
    +MAX_SHAPE = (619, 487)
    +
    + +
    +
    +aliases = ['Pilatus 300k']
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pilatus300kw(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Pilatus

    +

    Pilatus 300k-wide detector

    +
    +
    +MAX_SHAPE = (195, 1475)
    +
    + +
    +
    +aliases = ['Pilatus 300kw']
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pilatus6M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Pilatus

    +

    Pilatus 6M detector

    +
    +
    +MAX_SHAPE = (2527, 2463)
    +
    + +
    +
    +aliases = ['Pilatus 6M']
    +
    + +
    + +
    +
    +class pyFAI.detectors.PilatusCdTe(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.Pilatus

    +

    Pilatus CdTe detector: Like the Pilatus with an extra 3 pixel in the middle +of every module (vertically)

    +
    +
    +calc_mask()
    +

    Returns a generic mask for Pilatus detectors...

    +
    + +
    + +
    +
    +class pyFAI.detectors.PilatusCdTe1M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.PilatusCdTe

    +

    Pilatus CdTe 1M detector

    +
    +
    +MAX_SHAPE = (1043, 981)
    +
    + +
    +
    +aliases = ['Pilatus CdTe 1M', 'Pilatus 1M CdTe', 'Pilatus1M CdTe', 'Pilatus1MCdTe']
    +
    + +
    + +
    +
    +class pyFAI.detectors.PilatusCdTe2M(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.PilatusCdTe

    +

    Pilatus CdTe 2M detector

    +
    +
    +MAX_SHAPE = (1679, 1475)
    +
    + +
    +
    +aliases = ['Pilatus CdTe 2M', 'Pilatus 2M CdTe', 'Pilatus2M CdTe', 'Pilatus2MCdTe']
    +
    + +
    + +
    +
    +class pyFAI.detectors.PilatusCdTe300k(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.PilatusCdTe

    +

    Pilatus CdTe 300k detector

    +
    +
    +MAX_SHAPE = (619, 487)
    +
    + +
    +
    +aliases = ['Pilatus CdTe 300k', 'Pilatus 300k CdTe', 'Pilatus300k CdTe', 'Pilatus300kCdTe']
    +
    + +
    + +
    +
    +class pyFAI.detectors.PilatusCdTe300kw(pixel1=0.000172, pixel2=0.000172, max_shape=None, module_size=None, x_offset_file=None, y_offset_file=None)
    +

    Bases: pyFAI.detectors.PilatusCdTe

    +

    Pilatus CdTe 300k-wide detector

    +
    +
    +MAX_SHAPE = (195, 1475)
    +
    + +
    +
    +aliases = ['Pilatus CdTe 300kw', 'Pilatus 300kw CdTe', 'Pilatus300kw CdTe', 'Pilatus300kwCdTe']
    +
    + +
    + +
    +
    +class pyFAI.detectors.Pixium(pixel1=0.000308, pixel2=0.000308)
    +

    Bases: pyFAI.detectors.Detector

    +

    PIXIUM 4700 detector

    +

    High energy X ray diffraction using the Pixium 4700 flat panel detector +J E Daniels, M Drakopoulos, et al.; Journal of Synchrotron Radiation 16(Pt 4):463-8 · August 2009

    +
    +
    +DEFAULT_PIXEL1 = 0.000154
    +
    + +
    +
    +DEFAULT_PIXEL2 = 0.000154
    +
    + +
    +
    +MAX_SHAPE = (1910, 2480)
    +
    + +
    +
    +__init__(pixel1=0.000308, pixel2=0.000308)
    +

    Defaults to 2x2 binning

    +
    + +
    +
    +aliases = ['Pixium 4700 detector', 'Thales Electronics']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RaspberryPi5M(pixel1=1.4e-06, pixel2=1.4e-06)
    +

    Bases: pyFAI.detectors.Detector

    +

    5 Mpix detector from Raspberry Pi

    +
    +
    +MAX_SHAPE = (1944, 2592)
    +
    + +
    +
    +__init__(pixel1=1.4e-06, pixel2=1.4e-06)
    +
    + +
    +
    +aliases = ['Picam v1']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RaspberryPi8M(pixel1=1.12e-06, pixel2=1.12e-06)
    +

    Bases: pyFAI.detectors.Detector

    +

    8 Mpix detector from Raspberry Pi

    +
    +
    +MAX_SHAPE = (2464, 3280)
    +
    + +
    +
    +__init__(pixel1=1.12e-06, pixel2=1.12e-06)
    +
    + +
    +
    +aliases = ['Picam v2']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.Rayonix(pixel1=3.2e-05, pixel2=3.2e-05)
    +

    Bases: pyFAI.detectors.Detector

    +
    +
    +BINNED_PIXEL_SIZE = {1: 3.2e-05}
    +
    + +
    +
    +MAX_SHAPE = (4096, 4096)
    +
    + +
    +
    +__init__(pixel1=3.2e-05, pixel2=3.2e-05)
    +
    + +
    +
    +binning
    +
    + +
    +
    +force_pixel = True
    +
    + +
    +
    +get_binning()
    +
    + +
    +
    +guess_binning(data)
    +

    Guess the binning/mode depending on the image shape +:param data: 2-tuple with the shape of the image or the image with a .shape attribute.

    +
    + +
    +
    +set_binning(bin_size=(1, 1))
    +

    Set the “binning” of the detector,

    + +++ + + + +
    Parameters:bin_size (int or (int, int)) – set the binning of the detector
    +
    + +
    + +
    +
    +class pyFAI.detectors.Rayonix133(pixel1=6.4e-05, pixel2=6.4e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix 133 2D CCD detector detector also known as mar133

    +

    Personnal communication from M. Blum

    +

    What should be the default binning factor for those cameras ?

    +

    Circular detector

    +
    +
    +BINNED_PIXEL_SIZE = {8: 0.000256, 1: 3.2e-05, 2: 6.4e-05, 4: 0.000128}
    +
    + +
    +
    +MAX_SHAPE = (4096, 4096)
    +
    + +
    +
    +__init__(pixel1=6.4e-05, pixel2=6.4e-05)
    +
    + +
    +
    +aliases = ['MAR133']
    +
    + +
    +
    +calc_mask()
    +

    Circular mask

    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixLx170(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix lx170 2d CCD Detector (2x1 CCDs).

    +

    Nota: this is the same for lx170hs

    +
    +
    +BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    + +
    +
    +MAX_SHAPE = (1920, 3840)
    +
    + +
    +
    +__init__(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +
    + +
    +
    +aliases = ['Rayonix LX170', 'Rayonix LX170-HS', 'Rayonix LX170 HS', 'RayonixLX170HS']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixLx255(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix lx255 2d Detector (3x1 CCDs)

    +

    Nota: this detector is also called lx255hs

    +
    +
    +BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    + +
    +
    +MAX_SHAPE = (1920, 5760)
    +
    + +
    +
    +__init__(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +
    + +
    +
    +aliases = ['Rayonix LX255', 'Rayonix LX255-HS', 'Rayonix LX 255HS', 'RayonixLX225HS']
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixMx170(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix mx170 2d CCD Detector (2x2 CCDs).

    +

    Nota: this is the same for mx170hs

    +
    +
    +BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    + +
    +
    +MAX_SHAPE = (3840, 3840)
    +
    + +
    +
    +__init__(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +
    + +
    +
    +aliases = ['Rayonix MX170', 'Rayonix MX170-HS', 'RayonixMX170HS', 'Rayonix MX170 HS']
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixMx225(pixel1=7.3242e-05, pixel2=7.3242e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix mx225 2D CCD detector detector

    +

    Nota: this is the same definition for mx225he +Personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {8: 0.000292969, 1: 3.6621e-05, 2: 7.3242e-05, 3: 0.000109971, 4: 0.000146484}
    +
    + +
    +
    +MAX_SHAPE = (6144, 6144)
    +
    + +
    +
    +__init__(pixel1=7.3242e-05, pixel2=7.3242e-05)
    +
    + +
    +
    +aliases = ['Rayonix MX225']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixMx225hs(pixel1=7.8125e-05, pixel2=7.8125e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix mx225hs 2D CCD detector detector

    +

    Pixel size from a personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {1: 3.90625e-05, 2: 7.8125e-05, 3: 0.0001171875, 4: 0.00015625, 5: 0.0001953125, 6: 0.000234375, 8: 0.0003125, 10: 0.000390625}
    +
    + +
    +
    +MAX_SHAPE = (5760, 5760)
    +
    + +
    +
    +__init__(pixel1=7.8125e-05, pixel2=7.8125e-05)
    +
    + +
    +
    +aliases = ['Rayonix MX225HS', 'Rayonix MX225 HS']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixMx300(pixel1=7.3242e-05, pixel2=7.3242e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix mx300 2D detector (4x4 CCDs)

    +

    Pixel size from a personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {8: 0.000292969, 1: 3.6621e-05, 2: 7.3242e-05, 3: 0.000109971, 4: 0.000146484}
    +
    + +
    +
    +MAX_SHAPE = (8192, 8192)
    +
    + +
    +
    +__init__(pixel1=7.3242e-05, pixel2=7.3242e-05)
    +
    + +
    +
    +aliases = ['Rayonix mx300']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixMx300hs(pixel1=7.8125e-05, pixel2=7.8125e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix mx300hs 2D detector (4x4 CCDs)

    +

    Pixel size from a personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {1: 3.90625e-05, 2: 7.8125e-05, 3: 0.0001171875, 4: 0.00015625, 5: 0.0001953125, 6: 0.000234375, 8: 0.0003125, 10: 0.000390625}
    +
    + +
    +
    +MAX_SHAPE = (7680, 7680)
    +
    + +
    +
    +__init__(pixel1=7.8125e-05, pixel2=7.8125e-05)
    +
    + +
    +
    +aliases = ['Rayonix MX300HS', 'Rayonix MX300 HS']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixMx325(pixel1=7.9346e-05, pixel2=7.9346e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix mx325 and mx325he 2D detector (4x4 CCD chips)

    +

    Pixel size from a personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {8: 0.000317383, 1: 3.9673e-05, 2: 7.9346e-05, 3: 0.000119135, 4: 0.000158691}
    +
    + +
    +
    +MAX_SHAPE = (8192, 8192)
    +
    + +
    +
    +__init__(pixel1=7.9346e-05, pixel2=7.9346e-05)
    +
    + +
    +
    +aliases = ['Rayonix MX325']
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixMx340hs(pixel1=8.85417e-05, pixel2=8.85417e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix mx340hs 2D detector (4x4 CCDs)

    +

    Pixel size from a personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    + +
    +
    +MAX_SHAPE = (7680, 7680)
    +
    + +
    +
    +__init__(pixel1=8.85417e-05, pixel2=8.85417e-05)
    +
    + +
    +
    +aliases = ['Rayonix MX340HS', 'Rayonix MX340HS']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixMx425hs(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix mx425hs 2D CCD camera (5x5 CCD chip)

    +

    Pixel size from a personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    + +
    +
    +MAX_SHAPE = (9600, 9600)
    +
    + +
    +
    +__init__(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +
    + +
    +
    +aliases = ['Rayonix MX425HS', 'Rayonix MX425 HS']
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixSx165(pixel1=3.95e-05, pixel2=3.95e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix sx165 2d Detector also known as MAR165.

    +

    Circular detector

    +
    +
    +BINNED_PIXEL_SIZE = {8: 0.000316, 1: 3.95e-05, 2: 7.9e-05, 3: 0.000118616, 4: 0.000158}
    +
    + +
    +
    +MAX_SHAPE = (4096, 4096)
    +
    + +
    +
    +__init__(pixel1=3.95e-05, pixel2=3.95e-05)
    +
    + +
    +
    +aliases = ['MAR165', 'Rayonix Sx165']
    +
    + +
    +
    +calc_mask()
    +

    Circular mask

    +
    + +
    +
    +force_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixSx200(pixel1=4.8e-05, pixel2=4.8e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix sx200 2d CCD Detector.

    +

    Pixel size are personnal communication from M. Blum.

    +
    +
    +BINNED_PIXEL_SIZE = {8: 0.000384, 1: 4.8e-05, 2: 9.6e-05, 3: 0.000144, 4: 0.000192}
    +
    + +
    +
    +MAX_SHAPE = (4096, 4096)
    +
    + +
    +
    +__init__(pixel1=4.8e-05, pixel2=4.8e-05)
    +
    + +
    +
    +aliases = ['Rayonix sx200']
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixSx30hs(pixel1=1.5625e-05, pixel2=1.5625e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix sx30hs 2D CCD camera (1 CCD chip)

    +

    Pixel size from a personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {1: 1.5625e-05, 2: 3.125e-05, 3: 4.6875e-05, 4: 6.25e-05, 5: 7.8125e-05, 6: 9.375e-05, 8: 0.000125, 10: 0.00015625}
    +
    + +
    +
    +MAX_SHAPE = (1920, 1920)
    +
    + +
    +
    +__init__(pixel1=1.5625e-05, pixel2=1.5625e-05)
    +
    + +
    +
    +aliases = ['Rayonix SX30HS', 'Rayonix SX30 HS']
    +
    + +
    + +
    +
    +class pyFAI.detectors.RayonixSx85hs(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +

    Bases: pyFAI.detectors.Rayonix

    +

    Rayonix sx85hs 2D CCD camera (1 CCD chip)

    +

    Pixel size from a personnal communication from M. Blum

    +
    +
    +BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    +
    + +
    +
    +MAX_SHAPE = (1920, 1920)
    +
    + +
    +
    +__init__(pixel1=4.42708e-05, pixel2=4.42708e-05)
    +
    + +
    +
    +aliases = ['Rayonix SX85HS', 'Rayonix SX85 HS']
    +
    + +
    + +
    +
    +class pyFAI.detectors.Titan(pixel1=6e-05, pixel2=6e-05)
    +

    Bases: pyFAI.detectors.Detector

    +

    Titan CCD detector from Agilent. Mask not handled

    +
    +
    +MAX_SHAPE = (2048, 2048)
    +
    + +
    +
    +__init__(pixel1=6e-05, pixel2=6e-05)
    +
    + +
    +
    +aliases = ['Titan 2k x 2k', 'OXD Titan', 'Agilent Titan']
    +
    + +
    +
    +force_pixel = True
    +
    + +
    +
    +uniform_pixel = True
    +
    + +
    + +
    +
    +class pyFAI.detectors.Xpad_flat(pixel1=0.00013, pixel2=0.00013, max_shape=None, module_size=None)
    +

    Bases: pyFAI.detectors.ImXPadS10

    +

    Xpad detector: generic description for +ImXPad detector with 8x7modules

    +
    +
    +BORDER_PIXEL_SIZE_RELATIVE = 2.5
    +
    + +
    +
    +IS_CONTIGUOUS = False
    +
    + +
    +
    +MAX_SHAPE = (960, 560)
    +
    + +
    +
    +MODULE_GAP = (0.00357, 0)
    +
    + +
    +
    +MODULE_SIZE = (120, 80)
    +
    + +
    +
    +PIXEL_SIZE = (0.00013, 0.00013)
    +
    + +
    +
    +__init__(pixel1=0.00013, pixel2=0.00013, max_shape=None, module_size=None)
    +
    + +
    +
    +aliases = ['Xpad S540 flat', 'd5']
    +
    + +
    +
    +calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    +

    Calculate the position of each pixel center in cartesian coordinate +and in meter of a couple of coordinates. +The half pixel offset is taken into account here !!! +Adapted to Nexus detector definition

    + +++ + + + + + + + +
    Parameters:
      +
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • +
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • +
    • center – retrieve the coordinate of the center of the pixel
    • +
    • use_cython – set to False to test Numpy implementation
    • +
    +
    Returns:

    position in meter of the center of each pixels.

    +
    Return type:

    ndarray

    +
    +

    d1 and d2 must have the same shape, returned array will have +the same shape.

    +
    + +
    +
    +calc_mask()
    +

    Returns a generic mask for Xpad detectors... +discards the first line and raw form all modules: +those are 2.5x bigger and often mis - behaving

    +
    + +
    +
    +calc_pixels_edges()
    +

    Calculate the position of the pixel edges, specific to the S540, d5 detector

    +
    + +
    +
    +force_pixel = True
    +
    + +
    +
    +get_pixel_corners()
    +

    Calculate the position of the corner of the pixels

    + +++ + + + +
    Returns:4D array containing: +pixel index (slow dimension) +pixel index (fast dimension) +corner index (A, B, C or D), triangles or hexagons can be handled the same way +vertex position (z,y,x)
    +
    + +
    +
    +uniform_pixel = False
    +
    + +
    + +
    +
    +

    spline Module

    +

    This is piece of software aims at manipulating spline files +describing for geometric corrections of the 2D detectors using cubic-spline.

    +

    Mainly used at ESRF with FReLoN CCD camera.

    +
    +
    +class pyFAI.spline.Spline(filename=None)
    +

    Bases: object

    +

    This class is a python representation of the spline file

    +

    Those file represent cubic splines for 2D detector distortions and +makes heavy use of fitpack (dierckx in netlib) — A Python-C +wrapper to FITPACK (by P. Dierckx). FITPACK is a collection of +FORTRAN programs for curve and surface fitting with splines and +tensor product splines. See +_http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html +or _http://www.netlib.org/dierckx/index.html

    +
    +
    +__init__(filename=None)
    +

    This is the constructor of the Spline class.

    + +++ + + + +
    Parameters:filename (str) – name of the ascii file containing the spline
    +
    + +
    +
    +array2spline(smoothing=1000, timing=False)
    +

    Calculates the spline coefficients from the displacements +matrix using fitpack.

    + +++ + + + +
    Parameters:
      +
    • smoothing (float) – the greater the smoothing, the fewer the number of knots remaining
    • +
    • timing (bool) – print the profiling of the calculation
    • +
    +
    +
    + +
    +
    +bin(binning=None)
    +

    Performs the binning of a spline (same camera with different binning)

    + +++ + + + + + +
    Parameters:binning – binning factor as integer or 2-tuple of integers
    Type:int or (int, int)
    +
    + +
    +
    +comparison(ref, verbose=False)
    +

    Compares the current spline distortion with a reference

    + +++ + + + + + + + +
    Parameters:
      +
    • ref (Spline instance) – another spline file
    • +
    • verbose (bool) – print or not pylab plots
    • +
    +
    Returns:

    True or False depending if the splines are the same or not

    +
    Return type:

    bool

    +
    +
    + +
    +
    +correct(pos)
    +
    + +
    +
    +fliplr()
    +

    Flip the spline +:return: new spline object

    +
    + +
    +
    +fliplrud()
    +

    Flip the spline left-right and up-down +:return: new spline object

    +
    + +
    +
    +flipud()
    +

    Flip the spline up-down +:return: new spline object

    +
    + +
    +
    +getPixelSize()
    +

    Return the size of the pixel from as a 2-tuple of floats expressed +in meters.

    + +++ + + + + + +
    Returns:the size of the pixel from a 2D detector
    Return type:2-tuple of floats expressed in meter.
    +
    + +
    +
    +read(filename)
    +

    read an ascii spline file from file

    + +++ + + + +
    Parameters:filename (str) – file containing the cubic spline distortion file
    +
    + +
    +
    +setPixelSize(pixelSize)
    +

    Sets the size of the pixel from a 2-tuple of floats expressed +in meters.

    + +++ + + + +
    Param:pixel size in meter
    +
    + +
    +
    +spline2array(timing=False)
    +

    Calculates the displacement matrix using fitpack +bisplev(x, y, tck, dx = 0, dy = 0)

    + +++ + + + + + + + +
    Parameters:timing (bool) – profile the calculation or not
    Returns:Nothing !
    Return type:float or ndarray
    +

    Evaluate a bivariate B-spline and its derivatives. Return a +rank-2 array of spline function values (or spline derivative +values) at points given by the cross-product of the rank-1 +arrays x and y. In special cases, return an array or just a +float if either x or y or both are floats.

    +
    + +
    +
    +splineFuncX(x, y, list_of_points=False)
    +

    Calculates the displacement matrix using fitpack for the X +direction on the given grid.

    + +++ + + + + + + + +
    Parameters:
      +
    • x (ndarray) – points of the grid in the x direction
    • +
    • y (ndarray) – points of the grid in the y direction
    • +
    • list_of_points – if true, consider the zip(x,y) instead of the of the square array
    • +
    +
    Returns:

    displacement matrix for the X direction

    +
    Return type:

    ndarray

    +
    +
    + +
    +
    +splineFuncY(x, y, list_of_points=False)
    +

    calculates the displacement matrix using fitpack for the Y +direction

    + +++ + + + + + + + +
    Parameters:
      +
    • x (ndarray) – points in the x direction
    • +
    • y (ndarray) – points in the y direction
    • +
    • list_of_points – if true, consider the zip(x,y) instead of the of the square array
    • +
    +
    Returns:

    displacement matrix for the Y direction

    +
    Return type:

    ndarray

    +
    +
    + +
    +
    +tilt(center=(0.0, 0.0), tiltAngle=0.0, tiltPlanRot=0.0, distanceSampleDetector=1.0, timing=False)
    +

    The tilt method apply a virtual tilt on the detector, the +point of tilt is given by the center

    + +++ + + + + + + + +
    Parameters:
      +
    • center (2-tuple of floats) – position of the point of tilt, this point will not be moved.
    • +
    • tiltAngle (float in the range [-90:+90] degrees) – the value of the tilt in degrees
    • +
    • tiltPlanRot (Float in the range [-180:180]) – the rotation of the tilt plan with the Ox axis (0 deg for y axis invariant, 90 deg for x axis invariant)
    • +
    • distanceSampleDetector (float) – the distance from sample to detector in meter (along the beam, so distance from sample to center)
    • +
    +
    Returns:

    tilted Spline instance

    +
    Return type:

    Spline

    +
    +
    + +
    +
    +write(filename)
    +

    save the cubic spline in an ascii file usable with Fit2D or +SPD

    + +++ + + + +
    Parameters:filename (str) – name of the file containing the cubic spline distortion file
    +
    + +
    +
    +writeEDF(basename)
    +

    save the distortion matrices into a couple of files called +basename-x.edf and basename-y.edf

    + +++ + + + +
    Parameters:basename (str) – base of the name used to save the data
    +
    + +
    +
    +zeros(xmin=0.0, ymin=0.0, xmax=2048.0, ymax=2048.0, pixSize=None)
    +

    Defines a spline file with no ( zero ) displacement.

    + +++ + + + +
    Parameters:
      +
    • xmin (float) – minimum coordinate in x, usually zero
    • +
    • xmax (float) – maximum coordinate in x (+1) usually 2048
    • +
    • ymin (float) – minimum coordinate in y, usually zero
    • +
    • ymax (float) – maximum coordinate y (+1) usually 2048
    • +
    • pixSize (float) – size of the pixel
    • +
    +
    +
    + +
    +
    +zeros_like(other)
    +

    Defines a spline file with no ( zero ) displacement with the +same shape as the other one given.

    + +++ + + + +
    Parameters:other (Spline instance) – another Spline instance
    +
    + +
    + +
    +
    +pyFAI.spline.main()
    +

    Some tests ....

    +
    + +
    +
    +

    opencl Module

    +
    +
    +class pyFAI.opencl.Device(name='None', dtype=None, version=None, driver_version=None, extensions='', memory=None, available=None, cores=None, frequency=None, flop_core=None, idx=0, workgroup=1)
    +

    Bases: object

    +

    Simple class that contains the structure of an OpenCL device

    +
    +
    +__init__(name='None', dtype=None, version=None, driver_version=None, extensions='', memory=None, available=None, cores=None, frequency=None, flop_core=None, idx=0, workgroup=1)
    +

    Simple container with some important data for the OpenCL device description:

    + +++ + + + +
    Parameters:
      +
    • name – name of the device
    • +
    • dtype – device type: CPU/GPU/ACC...
    • +
    • version – driver version
    • +
    • driver_version
    • +
    • extensions – List of opencl extensions
    • +
    • memory – maximum memory available on the device
    • +
    • available – is the device desactivated or not
    • +
    • cores – number of SM/cores
    • +
    • frequency – frequency of the device
    • +
    • flop_cores – Flopating Point operation per core per cycle
    • +
    • idx – index of the device within the platform
    • +
    • workgroup – max workgroup size
    • +
    +
    +
    + +
    +
    +pretty_print()
    +

    Complete device description

    + +++ + + + +
    Returns:string
    +
    + +
    + +
    +
    +class pyFAI.opencl.OpenCL
    +

    Bases: object

    +

    Simple class that wraps the structure ocl_tools_extended.h

    +

    This is a static class. +ocl should be the only instance and shared among all python modules.

    +
    +
    +comput_cap = (5, 0)
    +
    + +
    +
    +context_cache = {}
    +
    + +
    +
    +create_context(devicetype='ALL', useFp64=False, platformid=None, deviceid=None, cached=True)
    +

    Choose a device and initiate a context.

    +

    Devicetypes can be GPU,gpu,CPU,cpu,DEF,ACC,ALL. +Suggested are GPU,CPU. +For each setting to work there must be such an OpenCL device and properly installed. +E.g.: If Nvidia driver is installed, GPU will succeed but CPU will fail. The AMD SDK kit is required for CPU via OpenCL. +:param devicetype: string in [“cpu”,”gpu”, “all”, “acc”] +:param useFp64: boolean specifying if double precision will be used +:param platformid: integer +:param devid: integer +:return: OpenCL context on the selected device

    +
    + +
    +
    +device_from_context(context)
    +

    Retrieves the Device from the context

    + +++ + + + + + +
    Parameters:context – OpenCL context
    Returns:instance of Device
    +
    + +
    +
    +flop_core = 4
    +
    + +
    +
    +get_platform(key)
    +

    Return a platform according

    + +++ + + + +
    Parameters:key (int or str) – identifier for a platform, either an Id (int) or it’s name
    +
    + +
    +
    +idd = 0
    +
    + +
    +
    +idx = 2
    +
    + +
    +
    +nb_devices = 4
    +
    + +
    +
    +platforms = [Portable Computing Language, NVIDIA CUDA, Intel(R) OpenCL]
    +
    + +
    +
    +select_device(dtype='ALL', memory=None, extensions=None, best=True, **kwargs)
    +

    Select a device based on few parameters (at the end, keep the one with most memory)

    + +++ + + + +
    Parameters:
      +
    • type – “gpu” or “cpu” or “all” ....
    • +
    • memory – minimum amount of memory (int)
    • +
    • extensions – list of extensions to be present
    • +
    • best – shall we look for the
    • +
    +
    +
    + +
    +
    +workgroup = 8192
    +
    + +
    + +
    +
    +class pyFAI.opencl.Platform(name='None', vendor='None', version=None, extensions=None, idx=0)
    +

    Bases: object

    +

    Simple class that contains the structure of an OpenCL platform

    +
    +
    +__init__(name='None', vendor='None', version=None, extensions=None, idx=0)
    +

    Class containing all descriptions of a platform and all devices description within that platform.

    + +++ + + + +
    Parameters:
      +
    • name – platform name
    • +
    • vendor – name of the brand/vendor
    • +
    • version
    • +
    • extension – list of the extension provided by the platform to all of its devices
    • +
    • idx – index of the platform
    • +
    +
    +
    + +
    +
    +add_device(device)
    +

    Add new device to the platform

    + +++ + + + +
    Parameters:device – Device instance
    +
    + +
    +
    +get_device(key)
    +

    Return a device according to key

    + +++ + + + +
    Parameters:key (int or str) – identifier for a device, either it’s id (int) or it’s name
    +
    + +
    + +
    +
    +pyFAI.opencl.allocate_cl_buffers(buffers, device=None, context=None)
    +
    +++ + + + + + + + +
    Parameters:buffers – the buffers info use to create the pyopencl.Buffer
    Returns:a dict containing the instanciated pyopencl.Buffer
    Return type:dict(str, pyopencl.Buffer)
    +

    This method instanciate the pyopencl.Buffer from the buffers +description.

    +
    + +
    +
    +pyFAI.opencl.release_cl_buffers(cl_buffers)
    +
    +++ + + + +
    Parameters:cl_buffer (dict(str, pyopencl.Buffer)) – the buffer you want to release
    +

    This method release the memory of the buffers store in the dict

    +
    + +
    +
    +

    ocl_azim Module

    +

    C++ less implementation of Dimitris’ code based on PyOpenCL

    +
    +
    TODO and trick from dimitris still missing:
    +
      +
    • dark-current subtraction is still missing
    • +
    • In fact you might want to consider doing the conversion on the GPU when +possible. Think about it, you have a uint16 to float which for large arrays +was slow.. You load on the graphic card a uint16 (2x transfer speed) and +you convert to float inside so it should be blazing fast.
    • +
    +
    +
    +
    +
    +class pyFAI.ocl_azim.Integrator1d(filename=None)
    +

    Bases: object

    +

    Attempt to implements ocl_azim using pyopencl

    +
    +
    +BLOCK_SIZE = 128
    +
    + +
    +
    +__init__(filename=None)
    +
    +++ + + + +
    Parameters:filename – file in which profiling information are saved
    +
    + +
    +
    +clean(preserve_context=False)
    +

    Free OpenCL related resources allocated by the library.

    +

    clean() is used to reinitiate the library back in a vanilla +state. It may be asked to preserve the context created by +init or completely clean up OpenCL. Guard/Status flags that +are set will be reset.

    + +++ + + + +
    Parameters:preserve_context (bool) – preserves or destroys all OpenCL resources
    +
    + +
    +
    +configure(kernel=None)
    +

    The method configure() allocates the OpenCL resources required +and compiled the OpenCL kernels. An active context must exist +before a call to configure() and getConfiguration() must have +been called at least once. Since the compiled OpenCL kernels +carry some information on the integration parameters, a change +to any of the parameters of getConfiguration() requires a +subsequent call to configure() for them to take effect.

    +

    If a configuration exists and configure() is called, the +configuration is cleaned up first to avoid OpenCL memory leaks

    + +++ + + + +
    Parameters:kernel_path – is the path to the actual kernel
    +
    + +
    +
    +execute(image)
    +

    Perform a 1D azimuthal integration

    +

    execute() may be called only after an OpenCL device is +configured and a Tth array has been loaded (at least once) It +takes the input image and based on the configuration provided +earlier it performs the 1D integration. Notice that if the +provided image is bigger than N then only N points will be +taked into account, while if the image is smaller than N the +result may be catastrophic. set/unset and loadTth methods +have a direct impact on the execute() method. All the rest of +the methods will require at least a new configuration via +configure().

    +

    Takes an image, integrate and return the histogram and weights

    + +++ + + + + + +
    Parameters:image – image to be processed as a numpy array
    Returns:tth_out, histogram, bins
    +

    TODO: to improve performances, the image should be casted to +float32 in an optimal way: currently using numpy machinery but +would be better if done in OpenCL

    +
    + +
    +
    +getConfiguration(Nimage, Nbins, useFp64=None)
    +

    getConfiguration gets the description of the integrations +to be performed and keeps an internal copy

    + +++ + + + +
    Parameters:
      +
    • Nimage – number of pixel in image
    • +
    • Nbins – number of bins in regrouped histogram
    • +
    • useFp64 – use double precision. By default the same as init!
    • +
    +
    +
    + +
    +
    +get_status()
    +

    return a dictionnary with the status of the integrator: for +compatibilty with former implementation

    +
    + +
    +
    +init(devicetype='GPU', useFp64=True, platformid=None, deviceid=None)
    +

    Initial configuration: Choose a device and initiate a +context. Devicetypes can be GPU, gpu, CPU, cpu, DEF, ACC, +ALL. Suggested are GPU,CPU. For each setting to work there +must be such an OpenCL device and properly installed. E.g.: If +Nvidia driver is installed, GPU will succeed but CPU will +fail. The AMD SDK kit (AMD APP) is required for CPU via +OpenCL.

    + +++ + + + +
    Parameters:
      +
    • devicetype – string in [“cpu”,”gpu”, “all”, “acc”]
    • +
    • useFp64 – boolean specifying if double precision will be used
    • +
    • platformid – integer
    • +
    • devid – integer
    • +
    +
    +
    + +
    +
    +loadTth(tth, dtth, tth_min=None, tth_max=None)
    +

    Load the 2th arrays along with the min and max value.

    +

    loadTth maybe be recalled at any time of the execution in +order to update the 2th arrays.

    +

    loadTth is required and must be called at least once after a +configure()

    +
    + +
    +
    +log(**kwarg)
    +

    log in a file all opencl events

    +
    + +
    +
    +setDummyValue(dummy, delta_dummy)
    +

    Enables dummy value functionality and uploads the value to the +OpenCL device.

    +

    Image values that are similar to the dummy value are set to 0.

    + +++ + + + +
    Parameters:
      +
    • dummy – value in image of missing values (masked pixels?)
    • +
    • delta_dummy – precision for dummy values
    • +
    +
    +
    + +
    +
    +setMask(mask)
    +

    Enables the use of a Mask during integration. The Mask can be +updated by recalling setMask at any point.

    +

    The Mask must be a PyFAI Mask. Pixels with 0 are masked +out. TODO: check and invert!

    + +++ + + + +
    Parameters:mask – numpy.ndarray of integer.
    +
    + +
    +
    +setRange(lowerBound, upperBound)
    +

    Instructs the program to use a user - defined range for 2th +values

    +

    setRange is optional. By default the integration will use the +tth_min and tth_max given by loadTth() as integration +range. When setRange is called it sets a new integration range +without affecting the 2th array. All values outside that range +will then be discarded when interpolating. Currently, if the +interval of 2th (2th + -d2th) is not all inside the range +specified, it is discarded. The bins of the histogram are +RESCALED to the defined range and not the original tth_max - +tth_min range.

    +

    setRange can be called at any point and as many times required +after a valid configuration is created.

    + +++ + + + +
    Parameters:
      +
    • lowerBound (float) – lower bound of the integration range
    • +
    • upperBound (float) – upper bound of the integration range
    • +
    +
    +
    + +
    +
    +setSolidAngle(solidAngle)
    +

    Enables SolidAngle correction and uploads the suitable array +to the OpenCL device.

    +

    By default the program will assume no solidangle correction +unless setSolidAngle() is called. From then on, all +integrations will be corrected via the SolidAngle array.

    +

    If the SolidAngle array needs to be changes, one may just call +setSolidAngle() again with that array

    + +++ + + + +
    Parameters:solidAngle (ndarray) – the solid angle of the given pixel
    +
    + +
    +
    +unsetDummyValue()
    +

    Disable a dummy value. +May be re-enabled at any time by setDummyValue

    +
    + +
    +
    +unsetMask()
    +

    Disables the use of a Mask from that point. +It may be re-enabled at any point via setMask

    +
    + +
    +
    +unsetRange()
    +

    Disable the use of a user-defined 2th range and revert to +tth_min,tth_max range

    +

    unsetRange instructs the program to revert to its default +integration range. If the method is called when no +user-defined range had been previously specified, no action +will be performed

    +
    + +
    +
    +unsetSolidAngle()
    +

    Instructs the program to not perform solidangle correction from now on.

    +

    SolidAngle correction may be turned back on at any point

    +
    + +
    + +
    +
    +

    ocl_azim_lut Module

    +
    +
    +class pyFAI.ocl_azim_lut.OCL_LUT_Integrator(lut, image_size, devicetype='all', platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    +

    Bases: object

    +
    +
    +BLOCK_SIZE = 16
    +
    + +
    +
    +__init__(lut, image_size, devicetype='all', platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    +
    +++ + + + +
    Parameters:
      +
    • lut – array of int32 - float32 with shape (nbins, lut_size) with indexes and coefficients
    • +
    • image_size – Expected image size: image.shape.prod()
    • +
    • devicetype – can be “cpu”,”gpu”,”acc” or “all”
    • +
    • platformid (int) – number of the platform as given by clinfo
    • +
    • deviceid (int) – number of the device as given by clinfo
    • +
    • checksum – pre - calculated checksum to prevent re - calculating it :)
    • +
    • profile – store profiling elements
    • +
    • empty – value to be assigned to bins without contribution from any pixel
    • +
    +
    +
    + +
    +
    +integrate(data, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None, dark_checksum=None, flat_checksum=None, solidAngle_checksum=None, polarization_checksum=None, preprocess_only=False, safe=True, normalization_factor=1.0)
    +

    Before performing azimuthal integration, the preprocessing is:

    +
    +

    data = (data - dark) / (flat * solidAngle * polarization)

    +

    Integration is performed using the CSR representation of the look-up table

    + +++ + + + + + +
    Parameters:
      +
    • dark – array of same shape as data for pre-processing
    • +
    • flat – array of same shape as data for pre-processing
    • +
    • solidAngle – array of same shape as data for pre-processing
    • +
    • polarization – array of same shape as data for pre-processing
    • +
    • dark_checksum – CRC32 checksum of the given array
    • +
    • flat_checksum – CRC32 checksum of the given array
    • +
    • solidAngle_checksum – CRC32 checksum of the given array
    • +
    • polarization_checksum – CRC32 checksum of the given array
    • +
    • safe – if True (default) compares arrays on GPU according to their checksum, unless, use the buffer location is used
    • +
    • normalization_factor – divide raw signal by this value
    • +
    • preprocess_only – return the dark subtracted; flat field & solidAngle & polarization corrected image, else
    • +
    +
    Returns:

    averaged data, weighted histogram, unweighted histogram

    +
    +
    + +
    +
    +log_profile()
    +

    If we are in profiling mode, prints out all timing for every single OpenCL call

    +
    + +
    + +
    +
    +

    ocl_azim_csr Module

    +
    +
    +class pyFAI.ocl_azim_csr.OCL_CSR_Integrator(lut, image_size, devicetype='all', block_size=32, platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    +

    Bases: object

    +
    +
    +__init__(lut, image_size, devicetype='all', block_size=32, platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    +
    +++ + + + +
    Parameters:
      +
    • lut – 3-tuple of arrays +data: coefficient of the matrix in a 1D vector of float32 - size of nnz +indices: Column index position for the data (same size as data) +indptr: row pointer indicates the start of a given row. len nbin+1
    • +
    • image_size – size of the image (for pre-processing)
    • +
    • devicetype – can be “cpu”,”gpu”,”acc” or “all”
    • +
    • block_size – the chosen size for WORKGROUP_SIZE
    • +
    • platformid (int) – number of the platform as given by clinfo
    • +
    • deviceid (int) – number of the device as given by clinfo
    • +
    • checksum – pre - calculated checksum to prevent re - calculating it :)
    • +
    • profile – store profiling elements
    • +
    • empty – value to be assigned to bins without contribution from any pixel
    • +
    +
    +
    + +
    +
    +integrate(data, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None, dark_checksum=None, flat_checksum=None, solidAngle_checksum=None, polarization_checksum=None, preprocess_only=False, safe=True, normalization_factor=1.0)
    +

    Before performing azimuthal integration, the preprocessing is:

    +
    +

    data = (data - dark) / (flat * solidAngle * polarization)

    +

    Integration is performed using the CSR representation of the look-up table

    + +++ + + + + + +
    Parameters:
      +
    • dark – array of same shape as data for pre-processing
    • +
    • flat – array of same shape as data for pre-processing
    • +
    • solidAngle – array of same shape as data for pre-processing
    • +
    • polarization – array of same shape as data for pre-processing
    • +
    • dark_checksum – CRC32 checksum of the given array
    • +
    • flat_checksum – CRC32 checksum of the given array
    • +
    • solidAngle_checksum – CRC32 checksum of the given array
    • +
    • polarization_checksum – CRC32 checksum of the given array
    • +
    • safe – if True (default) compares arrays on GPU according to their checksum, unless, use the buffer location is used
    • +
    • preprocess_only – return the dark subtracted; flat field & solidAngle & polarization corrected image, else
    • +
    • normalization_factor – divide result by this value
    • +
    +
    Returns:

    averaged data, weighted histogram, unweighted histogram

    +
    +
    + +
    +
    +log_profile()
    +

    If we are in profiling mode, prints out all timing for every single OpenCL call

    -
    -
    -force_pixel = True
    -
    -
    +
    +
    +

    ocl_azim_csr_dis Module

    -
    -class pyFAI.detectors.RayonixSx200(pixel1=4.8e-05, pixel2=4.8e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix sx200 2d CCD Detector.

    -

    Pixel size are personnal communication from M. Blum.

    -
    -
    -BINNED_PIXEL_SIZE = {8: 0.000384, 1: 4.8e-05, 2: 9.6e-05, 3: 0.000144, 4: 0.000192}
    -
    +
    +class pyFAI.ocl_azim_csr_dis.OCL_CSR_Integrator(lut, image_size, devicetype='all', block_size=32, platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    +

    Bases: object

    +
    +
    +__init__(lut, image_size, devicetype='all', block_size=32, platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    +
    +++ + + + +
    Parameters:
      +
    • lut – 3-tuple of arrays +data: coefficient of the matrix in a 1D vector of float32 - size of nnz +indices: Column index position for the data (same size as data) +indptr: row pointer indicates the start of a given row. len nbin+1
    • +
    • image_size
    • +
    • devicetype – can be “cpu”,”gpu”,”acc” or “all”
    • +
    • block_size – the chosen size for WORKGROUP_SIZE
    • +
    • platformid (int) – number of the platform as given by clinfo
    • +
    • deviceid (int) – number of the device as given by clinfo
    • +
    • checksum – pre - calculated checksum to prevent re - calculating it :)
    • +
    • profile – store profiling elements
    • +
    • empty – value to be assigned to bins without contribution from any pixel
    • +
    +
    +
    -
    -
    -MAX_SHAPE = (4096, 4096)
    +
    +
    +integrate(data, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None, dark_checksum=None, flat_checksum=None, solidAngle_checksum=None, polarization_checksum=None)
    -
    -
    -aliases = ['Rayonix sx200']
    -
    +
    +
    +log_profile()
    +

    If we are in profiling mode, prints out all timing for every +single OpenCL call

    +
    +
    +
    +

    io Module

    +

    Module for “high-performance” writing in either 1D with Ascii , +or 2D with FabIO or even nD with n varying from 2 to 4 using HDF5

    +

    Stand-alone module which tries to offer interface to HDF5 via H5Py and +capabilities to write EDF or other formats using fabio.

    +

    Can be imported without h5py but then limited to fabio & ascii formats.

    +

    TODO:

    +
      +
    • Add monitor to HDF5
    • +
    -
    -class pyFAI.detectors.RayonixSx30hs(pixel1=1.5625e-05, pixel2=1.5625e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix sx30hs 2D CCD camera (1 CCD chip)

    -

    Pixel size from a personnal communication from M. Blum

    -
    -
    -BINNED_PIXEL_SIZE = {1: 1.5625e-05, 2: 3.125e-05, 3: 4.6875e-05, 4: 6.25e-05, 5: 7.8125e-05, 6: 9.375e-05, 8: 0.000125, 10: 0.00015625}
    +
    +class pyFAI.io.AsciiWriter(filename=None, prefix='fai_', extension='.dat')
    +

    Bases: pyFAI.io.Writer

    +

    Ascii file writer (.xy or .dat)

    +
    +
    +__init__(filename=None, prefix='fai_', extension='.dat')
    -
    -
    -MAX_SHAPE = (1920, 1920)
    -
    +
    +
    +init(fai_cfg=None, lima_cfg=None)
    +

    Creates the directory that will host the output file(s)

    +
    -
    -
    -aliases = ['Rayonix Sx30hs']
    +
    +
    +write(data, index=0)
    -
    -class pyFAI.detectors.RayonixSx85hs(pixel1=4.42708e-05, pixel2=4.42708e-05)
    -

    Bases: pyFAI.detectors.Rayonix

    -

    Rayonix sx85hs 2D CCD camera (1 CCD chip)

    -

    Pixel size from a personnal communication from M. Blum

    -
    -
    -BINNED_PIXEL_SIZE = {1: 4.42708e-05, 2: 8.85417e-05, 3: 0.0001328125, 4: 0.0001770833, 5: 0.0002213542, 6: 0.000265625, 8: 0.0003541667, 10: 0.0004427083}
    -
    +
    +class pyFAI.io.DefaultAiWriter(filename, ai)
    +

    Bases: pyFAI.io.Writer

    +
    +
    +__init__(filename, ai)
    +

    Constructor of the historical writer of azimuthalIntegrator.

    +
    -
    -
    -MAX_SHAPE = (1920, 1920)
    +
    +
    +close()
    -
    -
    -aliases = ['Rayonix Sx85hs']
    +
    +
    +flush()
    +
    +
    +make_headers(hdr='#', has_dark=False, has_flat=False, polarization_factor=None, normalization_factor=None)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • hdr (str) – string used as comment in the header
    • +
    • has_dark (bool) – save the darks filenames (default: no)
    • +
    • has_flat (bool) – save the flat filenames (default: no)
    • +
    • polarization_factor (float) – the polarization factor
    • +
    +
    Returns:

    the header

    +
    Return type:

    str

    +
    -
    -
    -class pyFAI.detectors.Titan(pixel1=6e-05, pixel2=6e-05)
    -

    Bases: pyFAI.detectors.Detector

    -

    Titan CCD detector from Agilent. Mask not handled

    -
    -
    -MAX_SHAPE = (2048, 2048)
    -
    +
    +
    +save1D(filename, dim1, I, error=None, dim1_unit='2th_deg', has_dark=False, has_flat=False, polarization_factor=None, normalization_factor=None)
    +
    +++ + + + +
    Parameters:
      +
    • filename (str) – the filename used to save the 1D integration
    • +
    • dim1 (numpy.ndarray) – the x coordinates of the integrated curve
    • +
    • I (numpy.mdarray) – The integrated intensity
    • +
    • error (numpy.ndarray or None) – the error bar for each intensity
    • +
    • dim1_unit (pyFAI.units.Unit) – the unit of the dim1 array
    • +
    • has_dark (bool) – save the darks filenames (default: no)
    • +
    • has_flat (bool) – save the flat filenames (default: no)
    • +
    • polarization_factor (float, None) – the polarization factor
    • +
    • normalization_factor (float, None) – the monitor value
    • +
    +
    +

    This method save the result of a 1D integration.

    +
    -
    -
    -aliases = ['Titan 2k x 2k', 'OXD Titan', 'Agilent Titan']
    -
    +
    +
    +save2D(filename, I, dim1, dim2, error=None, dim1_unit='2th_deg', has_dark=False, has_flat=False, polarization_factor=None, normalization_factor=None)
    +
    +++ + + + +
    Parameters:
      +
    • filename (str) – the filename used to save the 2D histogram
    • +
    • dim1 (numpy.ndarray) – the 1st coordinates of the histogram
    • +
    • dim1 – the 2nd coordinates of the histogram
    • +
    • I (numpy.mdarray) – The integrated intensity
    • +
    • error (numpy.ndarray or None) – the error bar for each intensity
    • +
    • dim1_unit (pyFAI.units.Unit) – the unit of the dim1 array
    • +
    • has_dark (bool) – save the darks filenames (default: no)
    • +
    • has_flat (bool) – save the flat filenames (default: no)
    • +
    • polarization_factor (float, None) – the polarization factor
    • +
    • normalization_factor (float, None) – the monitor value
    • +
    +
    +

    This method save the result of a 2D integration.

    +
    -
    -
    -force_pixel = True
    -
    +
    +
    +set_filename(filename)
    +

    Define the filename while will be used

    +
    -
    -
    -uniform_pixel = True
    -
    +
    +
    +write(data)
    +

    Minimalistic method to limit the overhead.

    + +++ + + + +
    Parameters:data – array with intensities or tuple (2th,I) or (I,2th,chi) :type data: Integrate1dResult, Integrate2dResult
    +
    -
    -class pyFAI.detectors.Xpad_flat(pixel1=0.00013, pixel2=0.00013, max_shape=None, module_size=None)
    -

    Bases: pyFAI.detectors.ImXPadS10

    -

    Xpad detector: generic description for -ImXPad detector with 8x7modules

    -
    -
    -BORDER_PIXEL_SIZE_RELATIVE = 2.5
    +
    +class pyFAI.io.FabioWriter(filename=None)
    +

    Bases: pyFAI.io.Writer

    +

    Image file writer based on FabIO

    +

    TODO !!!

    +
    +
    +__init__(filename=None)
    -
    -
    -IS_CONTIGUOUS = False
    -
    +
    +
    +init(fai_cfg=None, lima_cfg=None)
    +

    Creates the directory that will host the output file(s)

    +
    -
    -
    -MAX_SHAPE = (960, 560)
    +
    +
    +write(data, index=0)
    -
    -
    -MODULE_GAP = (0.00357, 0)
    -
    +
    +
    +
    +class pyFAI.io.HDF5Writer(filename, hpath='data', fast_scan_width=None)
    +

    Bases: pyFAI.io.Writer

    +

    Class allowing to write HDF5 Files.

    -
    -MODULE_SIZE = (120, 80)
    +
    +CONFIG = 'pyFAI'
    -
    -PIXEL_SIZE = (0.00013, 0.00013)
    +
    +DATASET_NAME = 'data'
    -
    -
    -aliases = ['Xpad S540 flat', 'd5']
    +
    +
    +__init__(filename, hpath='data', fast_scan_width=None)
    +

    Constructor of an HDF5 writer:

    + +++ + + + +
    Parameters:
      +
    • filename – name of the file
    • +
    • hpath – name of the group: it will contain data (2-4D dataset), [tth|q|r] and pyFAI, group containing the configuration
    • +
    • fast_scan_width – set it to define the width of
    • +
    +
    +
    + +
    +
    +close()
    -
    -calc_cartesian_positions(d1=None, d2=None, center=True, use_cython=True)
    -

    Calculate the position of each pixel center in cartesian coordinate -and in meter of a couple of coordinates. -The half pixel offset is taken into account here !!! -Adapted to Nexus detector definition

    +
    +flush(radial=None, azimuthal=None)
    +

    Update some data like axis units and so on.

    Parameters:
      -
    • d1 (ndarray (1D or 2D)) – the Y pixel positions (slow dimension)
    • -
    • d2 (ndarray (1D or 2D)) – the X pixel positions (fast dimension)
    • -
    • center – retrieve the coordinate of the center of the pixel
    • +
    • radial – position in radial direction
    • +
    • azimuthal – position in azimuthal direction
    -

    @parm use_cython: set to False to test Numpy implementation -:return: position in meter of the center of each pixels. -:rtype: ndarray

    -

    d1 and d2 must have the same shape, returned array will have -the same shape.

    -
    -calc_mask()
    -

    Returns a generic mask for Xpad detectors... -discards the first line and raw form all modules: -those are 2.5x bigger and often mis - behaving

    +
    +init(fai_cfg=None, lima_cfg=None)
    +

    Initializes the HDF5 file for writing +:param fai_cfg: the configuration of the worker as a dictionary

    -
    -calc_pixels_edges()
    -

    Calculate the position of the pixel edges, specific to the S540, d5 detector

    +
    +write(data, index=0)
    +

    Minimalistic method to limit the overhead. +:param data: array with intensities or tuple (2th,I) or (I,2th,chi)

    -
    -
    -force_pixel = True
    -
    +
    +
    +
    +class pyFAI.io.Nexus(filename, mode='r')
    +

    Bases: object

    +

    Writer class to handle Nexus/HDF5 data

    +

    Manages:

    +
      +
    • entry

      +
      +
        +
      • pyFAI-subentry

        +
        +
          +
        • detector
        • +
        +
        +
      • +
      +
      +
    • +
    +

    TODO: make it thread-safe !!!

    -
    -get_pixel_corners()
    -

    Calculate the position of the corner of the pixels

    +
    +__init__(filename, mode='r')
    +

    Constructor

    - +
    Returns:4D array containing: -pixel index (slow dimension) -pixel index (fast dimension) -corner index (A, B, C or D), triangles or hexagons can be handled the same way -vertex position (z,y,x)
    Parameters:
      +
    • filename – name of the hdf5 file containing the nexus
    • +
    • mode – can be r or a
    • +
    +
    -
    -
    -uniform_pixel = False
    -
    - +
    +
    +close()
    +

    close the filename and update all entries

    -
    -
    -

    spline Module

    -

    This is piece of software aims at manipulating spline files -describing for geometric corrections of the 2D detectors using cubic-spline.

    -

    Mainly used at ESRF with FReLoN CCD camera.

    -
    -
    -class pyFAI.spline.Spline(filename=None)
    -

    Bases: object

    -

    This class is a python representation of the spline file

    -

    Those file represent cubic splines for 2D detector distortions and -makes heavy use of fitpack (dierckx in netlib) — A Python-C -wrapper to FITPACK (by P. Dierckx). FITPACK is a collection of -FORTRAN programs for curve and surface fitting with splines and -tensor product splines. See -_http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html -or _http://www.netlib.org/dierckx/index.html

    -
    -array2spline(smoothing=1000, timing=False)
    -

    Calculates the spline coefficients from the displacements -matrix using fitpack.

    +
    +deep_copy(name, obj, where='/', toplevel=None, excluded=None, overwrite=False)
    +

    perform a deep copy: +create a “name” entry in self containing a copy of the object

    @@ -4643,39 +7454,36 @@

    Navigation

    -
    -bin(binning=None)
    -

    Performs the binning of a spline (same camera with different binning)

    +
    +find_detector(all=False)
    +

    Tries to find a detector within a NeXus file, takes the first compatible detector

    Parameters:
      -
    • smoothing (float) – the greater the smoothing, the fewer the number of knots remaining
    • -
    • timing (bool) – print the profiling of the calculation
    • +
    • where – path to the toplevel object (i.e. root)
    • +
    • toplevel – firectly the top level Group
    • +
    • excluded – list of keys to be excluded
    • +
    • overwrite – replace content if already existing
    - - - +
    Parameters:binning – binning factor as integer or 2-tuple of integers
    Type:int or (int, int)
    Parameters:all – return all detectors found as a list
    -
    -
    -comparison(ref, verbose=False)
    -

    Compares the current spline distortion with a reference

    +
    +
    +classmethod get_attr(dset, name, default=None)
    +

    Return the attribute of the dataset

    +

    Handles the ascii -> unicode issue in python3 #275

    - - - @@ -4683,147 +7491,117 @@

    Navigation

    -
    -correct(pos)
    -
    - -
    -
    -fliplr()
    -

    Flip the spline -:return: new spline object

    -
    - -
    -
    -fliplrud()
    -

    Flip the spline left-right and up-down -:return: new spline object

    -
    - -
    -
    -flipud()
    -

    Flip the spline up-down -:return: new spline object

    -
    - -
    -
    -getPixelSize()
    -

    Return the size of the pixel from as a 2-tuple of floats expressed -in meters.

    +
    +get_class(grp, class_type='NXcollection')
    +

    return all sub-groups of the given type within a group

    Parameters:
      -
    • ref (Spline instance) – another spline file
    • -
    • verbose (bool) – print or not pylab plots
    • +
    • dset – a HDF5 dataset (or a group)
    • +
    • name – name of the attribute
    • +
    • default – default value to be returned
    Returns:

    True or False depending if the splines are the same or not

    -
    Return type:

    bool

    +
    Returns:

    attribute value decoded in python3 or default

    - - - +
    Returns:the size of the pixel from a 2D detector
    Return type:2-tuple of floats expressed in meter.
    Parameters:
      +
    • grp – HDF5 group
    • +
    • class_type – name of the NeXus class
    • +
    +
    -
    -read(filename)
    -

    read an ascii spline file from file

    +
    +get_data(grp, class_type='NXdata')
    +

    return all dataset of the the NeXus class NXdata

    - +
    Parameters:filename (str) – file containing the cubic spline distortion file
    Parameters:
      +
    • grp – HDF5 group
    • +
    • class_type – name of the NeXus class
    • +
    +
    -
    -setPixelSize(pixelSize)
    -

    Sets the size of the pixel from a 2-tuple of floats expressed -in meters.

    +
    +get_entries()
    +

    retrieves all entry sorted the latest first.

    - +
    Param:pixel size in meter
    Returns:list of HDF5 groups
    -
    -spline2array(timing=False)
    -

    Calculates the displacement matrix using fitpack -bisplev(x, y, tck, dx = 0, dy = 0)

    +
    +get_entry(name)
    +

    Retrieves an entry from its name

    - - - + - +
    Parameters:timing (bool) – profile the calculation or not
    Returns:Nothing !
    Parameters:name – name of the entry to retrieve
    Return type:float or ndarray
    Returns:HDF5 group of NXclass == NXentry
    -

    Evaluate a bivariate B-spline and its derivatives. Return a -rank-2 array of spline function values (or spline derivative -values) at points given by the cross-product of the rank-1 -arrays x and y. In special cases, return an array or just a -float if either x or y or both are floats.

    -
    -splineFuncX(x, y, list_of_points=False)
    -

    Calculates the displacement matrix using fitpack for the X -direction on the given grid.

    +
    +new_class(grp, name, class_type='NXcollection')
    +

    create a new sub-group with type class_type +:param grp: parent group +:param name: name of the sub-group +:param class_type: NeXus class name +:return: subgroup created

    +
    + +
    +
    +new_detector(name='detector', entry='entry', subentry='pyFAI')
    +

    Create a new entry/pyFAI/Detector

    - - - - -
    Parameters:
      -
    • x (ndarray) – points of the grid in the x direction
    • -
    • y (ndarray) – points of the grid in the y direction
    • -
    • list_of_points – if true, consider the zip(x,y) instead of the of the square array
    • +
    Parameters:
      +
    • detector – name of the detector
    • +
    • entry – name of the entry
    • +
    • subentry – all pyFAI description of detectors should be in a pyFAI sub-entry
    Returns:

    displacement matrix for the X direction

    -
    Return type:

    ndarray

    -
    -
    -splineFuncY(x, y, list_of_points=False)
    -

    calculates the displacement matrix using fitpack for the Y -direction

    +
    +new_entry(entry='entry', program_name='pyFAI', title='description of experiment', force_time=None)
    +

    Create a new entry

    - - - @@ -4831,76 +7609,153 @@

    Navigation

    -
    -tilt(center=(0.0, 0.0), tiltAngle=0.0, tiltPlanRot=0.0, distanceSampleDetector=1.0, timing=False)
    -

    The tilt method apply a virtual tilt on the detector, the -point of tilt is given by the center

    -
    Parameters:
      -
    • x (ndarray) – points in the x direction
    • -
    • y (ndarray) – points in the y direction
    • -
    • list_of_points – if true, consider the zip(x,y) instead of the of the square array
    • +
    • entry – name of the entry
    • +
    • program_name – value of the field as string
    • +
    • title – value of the field as string
    • +
    • force_time – enforce the start_time (as string!)
    Returns:

    displacement matrix for the Y direction

    -
    Return type:

    ndarray

    +
    Returns:

    the corresponding HDF5 group

    +
    +new_instrument(entry='entry', instrument_name='id00')
    +

    Create an instrument in an entry or create both the entry and the instrument if

    +
    + + + +
    +
    +class pyFAI.io.Writer(filename=None, extension=None)
    +

    Bases: object

    +

    Abstract class for writers.

    +
    +
    +CONFIG_ITEMS = ['filename', 'dirname', 'extension', 'subdir', 'hpath']
    +
    + +
    +
    +__init__(filename=None, extension=None)
    +

    Constructor of the class

    +
    + +
    +
    +flush(*arg, **kwarg)
    +

    To be implemented

    +
    + +
    +
    +init(fai_cfg=None, lima_cfg=None)
    +

    Creates the directory that will host the output file(s) +:param fai_cfg: configuration for worker +:param lima_cfg: configuration for acquisition

    +
    + +
    +
    +setJsonConfig(json_config=None)
    +

    Sets the JSON configuration

    +
    + +
    +
    +write(data)
    +

    To be implemented

    +
    + +
    + +
    +
    +pyFAI.io.from_isotime(text, use_tz=False)
    +
    - - - - - +
    Parameters:
      -
    • center (2-tuple of floats) – position of the point of tilt, this point will not be moved.
    • -
    • tiltAngle (float in the range [-90:+90] degrees) – the value of the tilt in degrees
    • -
    • tiltPlanRot (Float in the range [-180:180]) – the rotation of the tilt plan with the Ox axis (0 deg for y axis invariant, 90 deg for x axis invariant)
    • -
    • distanceSampleDetector (float) – the distance from sample to detector in meter (along the beam, so distance from sample to center)
    • -
    -
    Returns:

    tilted Spline instance

    -
    Return type:

    Spline

    -
    Parameters:text – string representing the time is iso format
    -
    -
    -write(filename)
    -

    save the cubic spline in an ascii file usable with Fit2D or -SPD

    - +
    +
    +pyFAI.io.get_isotime(forceTime=None)
    +
    - + + + + +
    Parameters:filename (str) – name of the file containing the cubic spline distortion file
    Parameters:forceTime (float) – enforce a given time (current by default)
    Returns:the current time as an ISO8601 string
    Return type:string
    -
    -
    -writeEDF(basename)
    -

    save the distortion matrices into a couple of files called -basename-x.edf and basename-y.edf

    +
    +
    +pyFAI.io.is_hdf5(filename)
    +

    Check if a file is actually a HDF5 file

    - +
    Parameters:basename (str) – base of the name used to save the data
    Parameters:filename – this file has better to exist
    +
    +
    +

    calibration Module

    +

    pyFAI-calib

    +

    A tool for determining the geometry of a detector using a reference sample.

    +
    +
    +class pyFAI.calibration.AbstractCalibration(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    +

    Bases: object

    +

    Everything that is common to Calibration and Recalibration

    +
    +
    +HELP = {'reset': 'Reset the geometry to the initial guess (rotation to zero, distance to 0.1m, poni at the center of the image)', 'delete': 'delete a group of points, provide the letter.', 'set': "set the value of a parameter to the given value, i.e 'set wavelength 0.1 nm', units are optional", 'chiplot': 'plot control point radial error as function of azimuthal angle, optional parameters: the rings for which this need to be plotted', 'help': "Try to get the help of a given action, like 'refine?'. Use done when finished. Most command are composed of 'action parameter value' like 'set wavelength 1 A'.", 'weight': 'toggle from weighted to unweighted mode...', 'get': 'print he value of a parameter', 'fix': "fixes the value of a parameter so that its value will not be optimized, i.e. 'fix wavelength'", 'validate2': 'measures the offset of the center as function of azimuthal angle by cross-correlation of 2 plots, 180 deg appart. Option: number of azimuthal sliced, default: 36', 'show': "Just print out the current parameter set. Optional parameters are units for length, rotation and wavelength, i.e. 'show mm deg A'", 'bound': "sets the upper and lower bound of a parameter: 'bound dist 0.1 0.2'", 'free': "frees the parameter so that the value can be optimized, i.e. 'free wavelength'", 'bounds': 'sets the upper and lower bound of all parameters', 'abort': 'quit immediately, discarding any unsaved changes', 'done': 'finishes the processing, performs an integration and quits', 'refine': 'performs a new cycle of refinement', 'integrate': 'perform the azimuthal integration and display results', 'validate': 'plot the offset between the calibrated image and the back-projected image', 'recalib': 'extract a new set of rings and re-perform the calibration. One can specify how many rings to extract and the algorithm to use (blob, massif, watershed) and the nb_pts_per_deg in azimuth', 'assign': 'Change the assignment of a group of points to a rings', 'define': 'Re-define the value for a constant internal parameter of the program like max_iter, nPt_1D, nPt_2D_azim, nPt_2D_rad, integrator_method, error_model. Warning: attribute change may be harmful !'}
    +
    + +
    +
    +PARAMETERS = ['dist', 'poni1', 'poni2', 'rot1', 'rot2', 'rot3', 'wavelength']
    +
    + +
    +
    +PTS_PER_DEG = 0.3
    +
    + +
    +
    +UNITS = {'poni1': 'meter', 'poni2': 'meter', 'rot1': 'radian', 'rot3': 'radian', 'rot2': 'radian', 'wavelength': 'meter', 'dist': 'meter'}
    +
    + +
    +
    +VALID_URL = ['', 'file', 'hdf5', 'nxs', 'h5']
    +
    +
    -
    -zeros(xmin=0.0, ymin=0.0, xmax=2048.0, ymax=2048.0, pixSize=None)
    -

    Defines a spline file with no ( zero ) displacement.

    +
    +__init__(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    +

    Constructor of AbstractCalibration

    @@ -4909,152 +7764,130 @@

    Navigation

    -
    -zeros_like(other)
    -

    Defines a spline file with no ( zero ) displacement with the -same shape as the other one given.

    +
    +analyse_options(options=None, args=None)
    +

    Analyzes options and arguments

    Parameters:
      -
    • xmin (float) – minimum coordinate in x, usually zero
    • -
    • xmax (float) – maximum coordinate in x (+1) usually 2048
    • -
    • ymin (float) – minimum coordinate in y, usually zero
    • -
    • ymax (float) – maximum coordinate y (+1) usually 2048
    • -
    • pixSize (float) – size of the pixel
    • +
    • dataFiles – list of filenames containing data images
    • +
    • darkFiles – list of filenames containing dark current images
    • +
    • flatFiles – list of filenames containing flat images
    • +
    • pixelSize – size of the pixel in meter as 2 tuple
    • +
    • splineFile – file containing the distortion of the taper
    • +
    • detector – Detector name or instance
    • +
    • wavelength – radiation wavelength in meter
    • +
    • calibrant – pyFAI.calibrant.Calibrant instance
    - +
    Parameters:other (Spline instance) – another Spline instance
    Returns:option,arguments
    -
    - -
    -
    -pyFAI.spline.main()
    -

    Some tests ....

    -
    - -
    -
    -

    opencl Module

    -
    -
    -class pyFAI.opencl.Device(name='None', dtype=None, version=None, driver_version=None, extensions='', memory=None, available=None, cores=None, frequency=None, flop_core=None, idx=0, workgroup=1)
    -

    Bases: object

    -

    Simple class that contains the structure of an OpenCL device

    -
    -pretty_print()
    -

    Complete device description

    +
    +chiplot(rings=None)
    +

    plot delta_2theta/2theta = f(chi) and fit the curve.

    - +
    Returns:string
    Parameters:rings – list of rings to consider
    -
    - -
    -
    -class pyFAI.opencl.OpenCL
    -

    Bases: object

    -

    Simple class that wraps the structure ocl_tools_extended.h

    -

    This is a static class. -ocl should be the only instance and shared among all python modules.

    -
    -
    -comput_cap = (5, 0)
    -
    - -
    -
    -context_cache = {}
    -
    -
    -
    -create_context(devicetype='ALL', useFp64=False, platformid=None, deviceid=None, cached=True)
    -

    Choose a device and initiate a context.

    -

    Devicetypes can be GPU,gpu,CPU,cpu,DEF,ACC,ALL. -Suggested are GPU,CPU. -For each setting to work there must be such an OpenCL device and properly installed. -E.g.: If Nvidia driver is installed, GPU will succeed but CPU will fail. The AMD SDK kit is required for CPU via OpenCL. -:param devicetype: string in [“cpu”,”gpu”, “all”, “acc”] -:param useFp64: boolean specifying if double precision will be used -:param platformid: integer -:param devid: integer -:return: OpenCL context on the selected device

    +
    +configure_parser(version='calibration from pyFAI version 0.13.0: 02/12/2016', usage='pyFAI-calib [options] input_image.edf', description=None, epilog=None)
    +

    Common configuration for parsers

    -
    -device_from_context(context)
    -

    Retrieves the Device from the context

    +
    +extract_cpt(method='massif', pts_per_deg=1.0)
    +

    Performs an automatic keypoint extraction: +Can be used in recalib or in calib after a first calibration has been performed.

    - - - +
    Parameters:context – OpenCL context
    Returns:instance of Device
    Parameters:
      +
    • method – method for keypoint extraction
    • +
    • pts_per_deg – number of control points per azimuthal degree (increase for better precision)
    • +
    +
    -
    -
    -flop_core = 4
    -
    +
    +
    +get_pixelSize(ans)
    +

    convert a comma separated sting into pixel size

    +
    + +
    +
    +postProcess()
    +

    Common part: shows the result of the azimuthal integration in 1D and 2D

    +
    + +
    +
    +preprocess()
    +

    Common part: +do dark, flat correction thresholding, ... +and read missing data from keyboard if needed

    +
    -
    -get_platform(key)
    -

    Return a platform according

    +
    +prompt()
    +

    prompt for commands to guide the calibration process

    - +
    Parameters:key (int or str) – identifier for a platform, either an Id (int) or it’s name
    Returns:True when the user is happy with what he has, False to request another refinement
    -
    -
    -idd = 0
    -
    +
    +
    +read_dSpacingFile(verbose=True)
    +

    Read the name of the calibrant / file with d-spacing

    +
    -
    -
    -idx = 3
    -
    +
    +
    +read_pixelsSize()
    +

    Read the pixel size from prompt if not available

    +
    -
    -
    -nb_devices = 5
    -
    +
    +
    +read_wavelength()
    +

    Read the wavelength

    +
    -
    -
    -platforms = [NVIDIA CUDA, FreeOCL, Intel(R) OpenCL, AMD Accelerated Parallel Processing]
    -
    +
    +
    +refine()
    +

    Contains the common geometry refinement part

    +
    -
    -select_device(dtype='ALL', memory=None, extensions=[], best=True, **kwargs)
    -

    Select a device based on few parameters (at the end, keep the one with most memory)

    +
    +reset_geometry(how='center', refine=False)
    +

    Reset the geometry: no tilt in all cases

    @@ -5062,222 +7895,228 @@

    Navigation

    Parameters:
      -
    • type – “gpu” or “cpu” or “all” ....
    • -
    • memory – minimum amount of memory (int)
    • -
    • extensions – list of extensions to be present
    • -
    • best – shall we look for the
    • +
    • how – multiple options +* center: set the PONI at the center of the detector +* ring: center the poni at the middle of the inner-most ring +* best: try both option and keeps the best (this option is not available)
    • +
    • refine – launch the refinement (argument not used)
    -
    -
    -workgroup = 1024
    -
    +
    +
    +set_data(data)
    +

    call-back function for the peak-picker

    +
    +
    +
    +validate_calibration()
    +

    Validate the calibration and calculate the offset in the diffraction image

    -
    -
    -class pyFAI.opencl.Platform(name='None', vendor='None', version=None, extensions=None, idx=0)
    -

    Bases: object

    -

    Simple class that contains the structure of an OpenCL platform

    -
    -add_device(device)
    -

    Add new device to the platform

    +
    +validate_center(slices=36)
    +

    Validate the position of the center by cross-correlating two spectra 180 deg appart. +Output values are in micron.

    +

    Designed for orthogonal setup with centered beam...

    - +
    Parameters:device – Device instance
    Parameters:slices – number of slices on which perform
    +
    +
    +win_error = 'We are under windows with a 32 bit version of python, matplotlib is not able to display too many images without crashing, this is why the window showing the diffraction image is closed'
    +
    + +
    + +
    +
    +class pyFAI.calibration.Calibration(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, gaussianWidth=None, wavelength=None, calibrant=None)
    +

    Bases: pyFAI.calibration.AbstractCalibration

    +

    class doing the calibration of frames

    -
    -get_device(key)
    -

    Return a device according to key

    +
    +__init__(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, gaussianWidth=None, wavelength=None, calibrant=None)
    +

    Constructor for calibration:

    - +
    Parameters:key (int or str) – identifier for a device, either it’s id (int) or it’s name
    Parameters:
      +
    • dataFiles – list of filenames containing data images
    • +
    • darkFiles – list of filenames containing dark current images
    • +
    • flatFiles – list of filenames containing flat images
    • +
    • pixelSize – size of the pixel in meter as 2 tuple
    • +
    • splineFile – file containing the distortion of the taper
    • +
    • detector – Detector name or instance
    • +
    • wavelength – radiation wavelength in meter
    • +
    • calibrant – pyFAI.calibrant.Calibrant instance
    • +
    +
    +
    +
    +gui_peakPicker()
    +
    + +
    +
    +initgeoRef()
    +

    Tries to initialise the GeometryRefinement (dist, poni, rot) +Returns a dictionary of key value pairs

    -
    -
    -pyFAI.opencl.allocate_cl_buffers(buffers, device=None, context=None)
    -
    --- - - - - - - - -
    Parameters:buffers – the buffers info use to create the pyopencl.Buffer
    Returns:a dict containing the instanciated pyopencl.Buffer
    Return type:dict(str, pyopencl.Buffer)
    -

    This method instanciate the pyopencl.Buffer from the buffers -description.

    +
    +
    +parse()
    +

    parse options from command line

    +
    + +
    +
    +preprocess()
    +

    do dark, flat correction thresholding, ...

    +
    + +
    +
    +refine()
    +

    Contains the geometry refinement part specific to Calibration +Sets up the initial guess when starting pyFAI-calib

    -
    -
    -pyFAI.opencl.release_cl_buffers(cl_buffers)
    -
    --- - - - -
    Parameters:cl_buffer (dict(str, pyopencl.Buffer)) – the buffer you want to release
    -

    This method release the memory of the buffers store in the dict

    -
    -
    -

    ocl_azim Module

    -

    C++ less implementation of Dimitris’ code based on PyOpenCL

    -
    -
    TODO and trick from dimitris still missing:
    -
      -
    • dark-current subtraction is still missing
    • -
    • In fact you might want to consider doing the conversion on the GPU when -possible. Think about it, you have a uint16 to float which for large arrays -was slow.. You load on the graphic card a uint16 (2x transfer speed) and -you convert to float inside so it should be blazing fast.
    • -
    -
    -
    -
    -class pyFAI.ocl_azim.Integrator1d(filename=None)
    +
    +class pyFAI.calibration.CheckCalib(poni=None, img=None, unit='2th_deg')

    Bases: object

    -

    Attempt to implements ocl_azim using pyopencl

    +
    +
    +__init__(poni=None, img=None, unit='2th_deg')
    +
    + +
    +
    +get_1dsize()
    +
    + +
    +
    +integrate()
    +
    + +
    +
    +parse()
    +
    + +
    +
    +rebuild()
    +

    Rebuild the diffraction image and measures the offset with the reference +:return: offset

    +
    + +
    +
    +show()
    +

    Show the image with the the errors

    +
    +
    -
    -BLOCK_SIZE = 128
    +
    +size1d
    -
    -clean(preserve_context=False)
    -

    Free OpenCL related resources allocated by the library.

    -

    clean() is used to reinitiate the library back in a vanilla -state. It may be asked to preserve the context created by -init or completely clean up OpenCL. Guard/Status flags that -are set will be reset.

    - --- - - - -
    Parameters:preserve_context (bool) – preserves or destroys all OpenCL resources
    +
    +smooth_mask(hwhm=5)
    +

    smooth out around the mask to avoid aligning on the mask

    +
    + +
    + +
    +
    +class pyFAI.calibration.MultiCalib(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None)
    +

    Bases: object

    +
    +
    +__init__(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None)
    +
    + +
    +
    +get_pixelSize(ans)
    +

    convert a comma separated sting into pixel size

    -
    -configure(kernel=None)
    -

    The method configure() allocates the OpenCL resources required -and compiled the OpenCL kernels. An active context must exist -before a call to configure() and getConfiguration() must have -been called at least once. Since the compiled OpenCL kernels -carry some information on the integration parameters, a change -to any of the parameters of getConfiguration() requires a -subsequent call to configure() for them to take effect.

    -

    If a configuration exists and configure() is called, the -configuration is cleaned up first to avoid OpenCL memory leaks

    - --- - - - -
    Parameters:kernel_path – is the path to the actual kernel
    +
    +parse(exe=None, description=None, epilog=None)
    +

    parse options from command line +:param exe: name of the program (MX-calibrate) +:param description: Description of the program

    -
    -execute(image)
    -

    Perform a 1D azimuthal integration

    -

    execute() may be called only after an OpenCL device is -configured and a Tth array has been loaded (at least once) It -takes the input image and based on the configuration provided -earlier it performs the 1D integration. Notice that if the -provided image is bigger than N then only N points will be -taked into account, while if the image is smaller than N the -result may be catastrophic. set/unset and loadTth methods -have a direct impact on the execute() method. All the rest of -the methods will require at least a new configuration via -configure().

    -

    Takes an image, integrate and return the histogram and weights

    - --- - - - - - -
    Parameters:image – image to be processed as a numpy array
    Returns:tth_out, histogram, bins
    -

    TODO: to improve performances, the image should be casted to -float32 in an optimal way: currently using numpy machinery but -would be better if done in OpenCL

    +
    +process()
    +
    + +
    +
    +read_dSpacingFile()
    +

    Read the name of the calibrant or the file with d-spacing

    -
    -getConfiguration(Nimage, Nbins, useFp64=None)
    -

    getConfiguration gets the description of the integrations -to be performed and keeps an internal copy

    - --- - - - -
    Parameters:
      -
    • Nimage – number of pixel in image
    • -
    • Nbins – number of bins in regrouped histogram
    • -
    • useFp64 – use double precision. By default the same as init!
    • -
    -
    +
    +read_pixelsSize()
    +

    Read the pixel size from prompt if not available

    -
    -get_status()
    -

    return a dictionnary with the status of the integrator: for -compatibilty with former implementation

    +
    +read_wavelength()
    +

    Read the wavelength

    -
    -init(devicetype='GPU', useFp64=True, platformid=None, deviceid=None)
    -

    Initial configuration: Choose a device and initiate a -context. Devicetypes can be GPU, gpu, CPU, cpu, DEF, ACC, -ALL. Suggested are GPU,CPU. For each setting to work there -must be such an OpenCL device and properly installed. E.g.: If -Nvidia driver is installed, GPU will succeed but CPU will -fail. The AMD SDK kit (AMD APP) is required for CPU via -OpenCL.

    +
    +regression()
    +
    + +
    + +
    +
    +class pyFAI.calibration.Recalibration(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    +

    Bases: pyFAI.calibration.AbstractCalibration

    +

    class doing the re-calibration of frames

    +
    +
    +__init__(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    +

    Constructor for Recalibration:

    @@ -5286,685 +8125,671 @@

    Navigation

    -
    -loadTth(tth, dtth, tth_min=None, tth_max=None)
    -

    Load the 2th arrays along with the min and max value.

    -

    loadTth maybe be recalled at any time of the execution in -order to update the 2th arrays.

    -

    loadTth is required and must be called at least once after a -configure()

    +
    +parse()
    +

    parse options from command line

    -
    -log(**kwarg)
    -

    log in a file all opencl events

    +
    +preprocess()
    +

    do dark, flat correction thresholding, ...

    -
    -setDummyValue(dummy, delta_dummy)
    -

    Enables dummy value functionality and uploads the value to the -OpenCL device.

    -

    Image values that are similar to the dummy value are set to 0.

    -
    Parameters:
      -
    • devicetype – string in [“cpu”,”gpu”, “all”, “acc”]
    • -
    • useFp64 – boolean specifying if double precision will be used
    • -
    • platformid – integer
    • -
    • devid – integer
    • +
    • dataFiles – list of filenames containing data images
    • +
    • darkFiles – list of filenames containing dark current images
    • +
    • flatFiles – list of filenames containing flat images
    • +
    • pixelSize – size of the pixel in meter as 2 tuple
    • +
    • splineFile – file containing the distortion of the taper
    • +
    • detector – Detector name or instance
    • +
    • wavelength – radiation wavelength in meter
    • +
    • calibrant – pyFAI.calibrant.Calibrant instance
    --- - - - -
    Parameters:
      -
    • dummy – value in image of missing values (masked pixels?)
    • -
    • delta_dummy – precision for dummy values
    • -
    -
    +
    +read_dSpacingFile()
    +

    Read the name of the file with d-spacing

    -
    -setMask(mask)
    -

    Enables the use of a Mask during integration. The Mask can be -updated by recalling setMask at any point.

    -

    The Mask must be a PyFAI Mask. Pixels with 0 are masked -out. TODO: check and invert!

    - --- - - - -
    Parameters:mask – numpy.ndarray of integer.
    +
    +refine()
    +

    Contains the geometry refinement part specific to Recalibration

    -
    -
    -setRange(lowerBound, upperBound)
    -

    Instructs the program to use a user - defined range for 2th -values

    -

    setRange is optional. By default the integration will use the -tth_min and tth_max given by loadTth() as integration -range. When setRange is called it sets a new integration range -without affecting the 2th array. All values outside that range -will then be discarded when interpolating. Currently, if the -interval of 2th (2th + -d2th) is not all inside the range -specified, it is discarded. The bins of the histogram are -RESCALED to the defined range and not the original tth_max - -tth_min range.

    -

    setRange can be called at any point and as many times required -after a valid configuration is created.

    +
    + +
    +
    +pyFAI.calibration.calib(img, calibrant, detector, basename='from_ipython', reconstruct=False, dist=0.1, gaussian=None, interactive=True)
    +

    Procedural interfact for calibration

    - + +
    Parameters:
      -
    • lowerBound (float) – lower bound of the integration range
    • -
    • upperBound (float) – upper bound of the integration range
    • +
    Parameters:
      +
    • img – 2d array representing the calibration image
    • +
    • calibrant – Instance of Calibrant, set-up with wavelength
    • +
    • detector – Detector instance containing the mask
    • +
    • basename – output file base
    • +
    • recontruct – perform image reconstruction of masked pixel ?
    • +
    • dist – initial distance
    • +
    • gaussian – width of the gaussian used for difference of gaussian in the “massif” peak-picking algorithm
    • +
    • interactive – set to False for testing
    Returns:

    AzimuthalIntegrator instance

    +
    -
    -
    -setSolidAngle(solidAngle)
    -

    Enables SolidAngle correction and uploads the suitable array -to the OpenCL device.

    -

    By default the program will assume no solidangle correction -unless setSolidAngle() is called. From then on, all -integrations will be corrected via the SolidAngle array.

    -

    If the SolidAngle array needs to be changes, one may just call -setSolidAngle() again with that array

    +
    +
    +pyFAI.calibration.get_detector(detector, datafiles=None)
    +

    Detector factory taking into account the binning knowing the datafiles

    - +
    Parameters:solidAngle (ndarray) – the solid angle of the given pixel
    Parameters:
      +
    • detector – string or detector or other junk
    • +
    • datafiles – can be a list of images to be opened and their shape used.
    • +
    +
    -
    - -
    -
    -unsetDummyValue()
    -

    Disable a dummy value. -May be re-enabled at any time by setDummyValue

    -
    - -
    -
    -unsetMask()
    -

    Disables the use of a Mask from that point. -It may be re-enabled at any point via setMask

    -
    - -
    -
    -unsetRange()
    -

    Disable the use of a user-defined 2th range and revert to -tth_min,tth_max range

    -

    unsetRange instructs the program to revert to its default -integration range. If the method is called when no -user-defined range had been previously specified, no action -will be performed

    -
    - -
    -
    -unsetSolidAngle()
    -

    Instructs the program to not perform solidangle correction from now on.

    -

    SolidAngle correction may be turned back on at any point

    -
    - +

    :return pyFAI.detector.Detector instance +:raise RuntimeError: If no detector found

    -
    -

    ocl_azim_lut Module

    +
    +

    peak_picker Module

    -
    -class pyFAI.ocl_azim_lut.OCL_LUT_Integrator(lut, image_size, devicetype='all', platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    +
    +class pyFAI.peak_picker.ControlPoints(filename=None, calibrant=None, wavelength=None)

    Bases: object

    -
    -
    -BLOCK_SIZE = 16
    +

    This class contains a set of control points with (optionally) their ring number hence d-spacing and diffraction 2Theta angle ...

    +
    +
    +__init__(filename=None, calibrant=None, wavelength=None)
    -
    -integrate(data, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None, dark_checksum=None, flat_checksum=None, solidAngle_checksum=None, polarization_checksum=None, preprocess_only=False, safe=True, normalization_factor=1.0)
    -

    Before performing azimuthal integration, the preprocessing is :

    -

    data = (data - dark) / (flat*solidAngle*polarization)

    -

    Integration is performed using the CSR representation of the look-up table

    - +
    +append(points, ring=None, annotate=None, plot=None)
    +
    - + +
    Parameters:
      -
    • dark – array of same shape as data for pre-processing
    • -
    • flat – array of same shape as data for pre-processing
    • -
    • solidAngle – array of same shape as data for pre-processing
    • -
    • polarization – array of same shape as data for pre-processing
    • -
    • dark_checksum – CRC32 checksum of the given array
    • -
    • flat_checksum – CRC32 checksum of the given array
    • -
    • solidAngle_checksum – CRC32 checksum of the given array
    • -
    • polarization_checksum – CRC32 checksum of the given array
    • -
    • safe – if True (default) compares arrays on GPU according to their checksum, unless, use the buffer location is used
    • -
    • normalization_factor – divide raw signal by this value
    • -
    • preprocess_only – return the dark subtracted; flat field & solidAngle & polarization corrected image, else
    • +
    Parameters:
      +
    • point – list of points
    • +
    • ring – ring number
    • +
    • annotate – matplotlib.annotate reference
    • +
    • plot – matplotlib.plot reference
    Returns:

    PointGroup instance

    +
    -

    :return averaged data, weighted histogram, unweighted histogram

    -
    -log_profile()
    -

    If we are in profiling mode, prints out all timing for every single OpenCL call

    +
    +append_2theta_deg(points, angle=None, ring=None)
    +
    +++ + + + +
    Parameters:
      +
    • point – list of points
    • +
    • angle – 2-theta angle in degrees
    • +
    +
    +
    +
    +check()
    +

    check internal consistency of the class

    -
    -
    -

    ocl_azim_csr Module

    -
    -
    -class pyFAI.ocl_azim_csr.OCL_CSR_Integrator(lut, image_size, devicetype='all', block_size=32, platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    -

    Bases: object

    +
    +
    +dSpacing
    +
    +
    -
    -integrate(data, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None, dark_checksum=None, flat_checksum=None, solidAngle_checksum=None, polarization_checksum=None, preprocess_only=False, safe=True, normalization_factor=1.0)
    -

    Before performing azimuthal integration, the preprocessing is :

    -

    data = (data - dark) / (flat*solidAngle*polarization)

    -

    Integration is performed using the CSR representation of the look-up table

    +
    +get(ring=None)
    +

    retireves the last set of points for a given ring (by default the last)

    - +
    Parameters:
      -
    • dark – array of same shape as data for pre-processing
    • -
    • flat – array of same shape as data for pre-processing
    • -
    • solidAngle – array of same shape as data for pre-processing
    • -
    • polarization – array of same shape as data for pre-processing
    • -
    • dark_checksum – CRC32 checksum of the given array
    • -
    • flat_checksum – CRC32 checksum of the given array
    • -
    • solidAngle_checksum – CRC32 checksum of the given array
    • -
    • polarization_checksum – CRC32 checksum of the given array
    • -
    • safe – if True (default) compares arrays on GPU according to their checksum, unless, use the buffer location is used
    • -
    • preprocess_only – return the dark subtracted; flat field & solidAngle & polarization corrected image, else
    • -
    • normalization_factor – divide result by this value
    • -
    -
    Parameters:ring – index of ring to search for
    -

    :return averaged data, weighted histogram, unweighted histogram

    -
    -log_profile()
    -

    If we are in profiling mode, prints out all timing for every single OpenCL call

    +
    +getList()
    +

    Retrieve the list of control points suitable for geometry refinement with ring number

    +
    +
    +getList2theta()
    +

    Retrieve the list of control points suitable for geometry refinement

    -
    -
    -

    ocl_azim_csr_dis Module

    -
    -
    -class pyFAI.ocl_azim_csr_dis.OCL_CSR_Integrator(lut, image_size, devicetype='all', block_size=32, platformid=None, deviceid=None, checksum=None, profile=False, empty=None)
    -

    Bases: object

    -
    -integrate(data, dummy=None, delta_dummy=None, dark=None, flat=None, solidAngle=None, polarization=None, dark_checksum=None, flat_checksum=None, solidAngle_checksum=None, polarization_checksum=None)
    -
    +
    +getListRing()
    +

    Retrieve the list of control points suitable for geometry refinement with ring number

    +
    -
    -log_profile()
    -

    If we are in profiling mode, prints out all timing for every -single OpenCL call

    +
    +getWeightedList(image)
    +

    Retrieve the list of control points suitable for geometry refinement with ring number and intensities +:param image: +:return: a (x,4) array with pos0, pos1, ring nr and intensity

    +

    #TODO: refine the value of the intensity using 2nd order polynomia

    - +
    +
    +get_dSpacing()
    +
    -
    -
    -

    worker Module

    -

    This module contains the Worker class:

    -

    A tool able to perform azimuthal integration with: -additional saving capabilities like -- save as 2/3D structure in a HDF5 File -- read from HDF5 files

    -

    Aims at being integrated into a plugin like LImA or as model for the GUI

    -

    The configuration of this class is mainly done via a dictionary transmitted as a JSON string: -Here are the valid keys:

    -
    -

    “dist”, -“poni1”, -“poni2”, -“rot1” -“rot3” -“rot2” -“pixel1” -“pixel2”

    -

    “splineFile” -“wavelength”

    -

    “poni” #path of the file

    -

    “chi_discontinuity_at_0” -“do_mask” -“do_dark” -“do_azimuthal_range” -“do_flat” -“do_2D” -“azimuth_range_min” -“azimuth_range_max”

    -

    “polarization_factor” -“nbpt_rad” -“do_solid_angle” -“do_radial_range” -“do_poisson” -“delta_dummy” -“nbpt_azim” -“flat_field” -“radial_range_min” -“dark_current” -“do_polarization” -“mask_file” -“detector” -“unit” -“radial_range_max” -“val_dummy” -“do_dummy” -“method”

    -
    -

    }

    -
    -
    -class pyFAI.worker.DistortionWorker(detector=None, dark=None, flat=None, solidangle=None, polarization=None, mask=None, dummy=None, delta_dummy=None, device=None)
    -

    Bases: object

    -

    Simple worker doing dark, flat, solid angle and polarization correction

    -
    -process(data, normalization=None)
    -

    Process the data and apply a normalization factor -:param data: input data -:param normalization: normalization factor -:return processed data

    -
    +
    +get_wavelength()
    +
    +
    +
    +load(filename)
    +

    load all control points from a file

    -
    -
    -class pyFAI.worker.PixelwiseWorker(dark=None, flat=None, solidangle=None, polarization=None, mask=None, dummy=None, delta_dummy=None, device=None)
    -

    Bases: object

    -

    Simple worker doing dark, flat, solid angle and polarization correction

    -
    -process(data, normalization=None)
    -

    Process the data and apply a normalization factor -:param data: input data -:param normalization: normalization factor -:return processed data

    +
    +pop(ring=None, lbl=None)
    +

    Remove the set of points, either from its code or from a given ring (by default the last)

    + +++ + + + +
    Parameters:
      +
    • ring – index of ring of which remove the last group
    • +
    • lbl – code of the ring to remove
    • +
    +
    +
    +
    +readRingNrFromKeyboard()
    +

    Ask the ring number values for the given points

    -
    -
    -class pyFAI.worker.Worker(azimuthalIntgrator=None, shapeIn=(2048, 2048), shapeOut=(360, 500), unit='r_mm', dummy=None, delta_dummy=None)
    -

    Bases: object

    -
    -do_2D()
    -
    - -
    -
    -error_model
    -
    +
    +reset()
    +

    remove all stored values and resets them to default

    +
    -
    -get_config()
    -

    return configuration as a dictionary

    +
    +save(filename)
    +

    Save a set of control points to a file +:param filename: name of the file +:return: None

    -
    -get_error_model()
    +
    +setWavelength_change2th(value=None)
    -
    -get_json_config()
    -

    return configuration as a JSON string

    +
    +setWavelength_changeDs(value=None)
    +

    This is probably not a good idea, but who knows !

    -
    -get_normalization_factor()
    +
    +set_dSpacing(lst)
    -
    -get_unit()
    +
    +set_wavelength(value=None)
    -
    -normalization_factor
    +
    +wavelength
    +
    + +
    + +
    +
    +class pyFAI.peak_picker.PeakPicker(data, reconst=False, mask=None, pointfile=None, calibrant=None, wavelength=None, detector=None, method='massif')
    +

    Bases: object

    +

    This class is in charge of peak picking, i.e. find bragg spots in the image +Two methods can be used : massif or blob

    +
    +
    +VALID_METHODS = ['massif', 'blob', 'watershed']
    +
    + +
    +
    +__init__(data, reconst=False, mask=None, pointfile=None, calibrant=None, wavelength=None, detector=None, method='massif')
    +
    +++ + + + +
    Parameters:
      +
    • data – input image as numpy array
    • +
    • reconst – shall masked part or negative values be reconstructed (wipe out problems with pilatus gaps)
    • +
    • mask – area in which keypoints will not be considered as valid
    • +
    • pointfile
    • +
    +
    +
    + +
    +
    +closeGUI()
    -
    -process(data)
    -

    Process a frame -#TODO: -dark, flat, sa are missing

    +
    +contour(data, cmap='autumn', linewidths=2, linestyles='dashed')
    +

    Overlay a contour-plot

    - +
    Param:data: numpy array containing the input image
    Parameters:data – 2darray with the 2theta values in radians...
    -
    -reconfig(shape=(2048, 2048), sync=False)
    -

    This is just to force the integrator to initialize with a given input image shape

    +
    +display_points(minIndex=0, reset=False)
    +

    display all points and their ring annotations +:param minIndex: ring index to start with +:param reset: remove all point before re-displaying them

    +
    + +
    +
    +finish(filename=None, callback=None)
    +

    Ask the ring number for the given points

    - +
    Parameters:
      -
    • shape – shape of the input image
    • -
    • sync – return only when synchronized
    • -
    -
    Parameters:filename – file with the point coordinates saved
    -
    -reset()
    -

    this is just to force the integrator to initialize

    +
    +gui(log=False, maximize=False, pick=True)
    +
    +++ + + + +
    Parameters:log – show z in log scale
    -
    -
    -save_config(filename=None)
    +
    +
    +help = ['Please select rings on the diffraction image. In parenthesis, some modified shortcuts for single button mouse (Apple):', ' * Right-click (click+n): try an auto find for a ring', ' * Right-click + Ctrl (click+b): create new group with one point', ' * Right-click + Shift (click+v): add one point to current group', ' * Right-click + m (click+m): find more points for current group', ' * Center-click or (click+d): erase current group', ' * Center-click + 1 or (click+1): erase closest point from current group']
    -
    -setDarkcurrentFile(imagefile)
    -
    +
    +init(method, sync=True)
    +

    Unified initializer

    +
    -
    -setExtension(ext)
    -

    enforce the extension of the processed data file written

    +
    +load(filename)
    +

    load a filename and plot data on the screen (if GUI)

    -
    -setFlatfieldFile(imagefile)
    -
    +
    +massif_contour(data)
    +

    Overlays a mask over a diffraction image

    + +++ + + + +
    Parameters:data – mask to be overlaid
    +
    -
    -setJsonConfig(jsonconfig)
    -
    +
    +on_minus_pts_clicked(*args)
    +

    callback function

    +
    -
    -setSubdir(path)
    -

    Set the relative or absolute path for processed data

    +
    +on_option_clicked(*args)
    +

    callback function

    -
    -set_error_model(value)
    -
    +
    +on_plus_pts_clicked(*args)
    +

    callback function

    +
    -
    -set_normalization_factor(value)
    -
    +
    +on_refine_clicked(*args)
    +

    callback function

    +
    -
    -set_unit(value)
    -
    +
    +onclick(event)
    +

    Called when a mouse is clicked

    +
    -
    -
    -unit
    -
    +
    +
    +peaks_from_area(**kwargs)
    +

    Return the list of peaks within an area

    + +++ + + + + + +
    Parameters:
      +
    • mask – 2d array with mask.
    • +
    • Imin – minimum of intensity above the background to keep the point
    • +
    • keep – maximum number of points to keep
    • +
    • method – enforce the use of detection using “massif” or “blob” or “watershed”
    • +
    • ring – ring number to which assign the points
    • +
    • dmin – minimum distance between two peaks (in pixels)
    • +
    • seed – good starting points.
    • +
    +
    Returns:

    list of peaks [y,x], [y,x], ...]

    +
    +
    -
    -warmup(sync=False)
    -

    Process a dummy image to ensure everything is initialized

    +
    +remove_grp(lbl)
    +

    remove a group of points

    - +
    Parameters:sync – wait for processing to be finished
    Parameters:lbl – label of the group of points
    +
    +
    +reset()
    +

    Reset control point and graph (if needed)

    -
    -
    -pyFAI.worker.make_ai(config)
    -

    Create an Azimuthal integrator from the configuration -Static method !

    +
    +
    +sync_init()
    +
    + +
    + +
    +
    +class pyFAI.peak_picker.PointGroup(points=None, ring=None, annotate=None, plot=None, force_label=None)
    +

    Bases: object

    +

    Class contains a group of points ... +They all belong to the same Debye-Scherrer ring

    +
    +
    +__init__(points=None, ring=None, annotate=None, plot=None, force_label=None)
    +

    Constructor

    - - - +
    Parameters:config – dict with all parameters
    Returns:configured (but uninitialized) AzimuthalIntgrator
    Parameters:
      +
    • points – list of points
    • +
    • ring – ring number
    • +
    • annotate – reference to the matplotlib annotate output
    • +
    • plot – reference to the matplotlib plot
    • +
    • force_label – allows to enforce the label
    • +
    +
    -
    -
    -

    io Module

    -

    Module for “high-performance” writing in either 1D with Ascii , -or 2D with FabIO or even nD with n varying from 2 to 4 using HDF5

    -

    Stand-alone module which tries to offer interface to HDF5 via H5Py and -capabilities to write EDF or other formats using fabio.

    -

    Can be imported without h5py but then limited to fabio & ascii formats.

    -

    TODO: -* add monitor to HDF5

    -
    -
    -class pyFAI.io.AsciiWriter(filename=None, prefix='fai_', extension='.dat')
    -

    Bases: pyFAI.io.Writer

    -

    Ascii file writer (.xy or .dat)

    -
    -
    -init(fai_cfg=None, lima_cfg=None)
    -

    Creates the directory that will host the output file(s)

    +
    +
    +code
    +

    Numerical value for the label: mainly for sorting

    +
    + +
    +
    +classmethod get_label()
    +

    return the next label

    -
    -write(data, index=0)
    +
    +get_ring()
    +
    + +
    +
    +label
    +
    + +
    +
    +last_label = 0
    +
    + +
    +
    +classmethod reset_label()
    +

    reset intenal counter

    +
    + +
    +
    +ring
    +
    +
    +classmethod set_label(label)
    +

    update the internal counter if needed

    -
    -
    -class pyFAI.io.FabioWriter(filename=None)
    -

    Bases: pyFAI.io.Writer

    -

    Image file writer based on FabIO

    -

    TODO !!!

    -
    -init(fai_cfg=None, lima_cfg=None)
    -

    Creates the directory that will host the output file(s)

    +
    +set_ring(value)
    +
    +
    +
    +
    +

    massif Module

    +
    +
    +class pyFAI.massif.Massif(data=None)
    +

    Bases: object

    +

    A massif is defined as an area around a peak, it is used to find neighboring peaks

    +
    +
    +TARGET_SIZE = 1024
    +
    +
    -
    -write(data, index=0)
    +
    +__init__(data=None)
    +
    +
    +calculate_massif(x)
    +

    defines a map of the massif around x and returns the mask

    -
    -
    -class pyFAI.io.HDF5Writer(filename, hpath='data', fast_scan_width=None)
    -

    Bases: pyFAI.io.Writer

    -

    Class allowing to write HDF5 Files.

    -
    -
    -CONFIG = 'pyFAI'
    +
    +
    +delValleySize()
    -
    -
    -DATASET_NAME = 'data'
    -
    +
    +
    +find_peaks(x, nmax=200, annotate=None, massif_contour=None, stdout=<open file '<stdout>', mode 'w' at 0x7f23416fe150>)
    +

    All in one function that finds a maximum from the given seed (x) +then calculates the region extension and extract position of the neighboring peaks. +:param x: seed for the calculation, input coordinates +:param nmax: maximum number of peak per region +:param annotate: call back method taking number of points + coordinate as input. +:param massif_contour: callback to show the contour of a massif with the given index. +:param stdout: this is the file where output is written by default. +:return: list of peaks

    +
    -
    -close()
    -
    +
    +getBinnedData()
    +

    :return binned data

    +
    -
    -flush(radial=None, azimuthal=None)
    -

    Update some data like axis units and so on.

    - +
    +getBluredData()
    +
    - +
    Parameters:
      -
    • radial – position in radial direction
    • -
    • azimuthal – position in azimuthal direction
    • -
    -
    Returns:a blurred image
    -
    -init(fai_cfg=None, lima_cfg=None)
    -

    Initializes the HDF5 file for writing -:param fai_cfg: the configuration of the worker as a dictionary

    -
    - -
    -
    -write(data, index=0)
    -

    Minimalistic method to limit the overhead. -:param data: array with intensities or tuple (2th,I) or (I,2th,chi)

    -
    - -
    - -
    -
    -class pyFAI.io.Nexus(filename, mode='r')
    -

    Bases: object

    -

    Writer class to handle Nexus/HDF5 data -Manages: -entry

    -
    -
    -
    pyFAI-subentry
    -
    detector
    -
    -
    -

    #TODO: make it thread-safe !!!

    -
    -
    -close()
    -

    close the filename and update all entries

    +
    +getLabeledMassif(pattern=None)
    +
    +++ + + + +
    Returns:an image composed of int with a different value for each massif
    -
    -deep_copy(name, obj, where='/', toplevel=None, excluded=None, overwrite=False)
    -

    perform a deep copy: -create a “name” entry in self containing a copy of the object

    - +
    +getMedianData()
    +
    - +
    Parameters:
      -
    • where – path to the toplevel object (i.e. root)
    • -
    • toplevel – firectly the top level Group
    • -
    • excluded – list of keys to be excluded
    • -
    • overwrite – replace content if already existing
    • -
    -
    Returns:a spacial median filtered image
    -
    -find_detector(all=False)
    -

    Tries to find a detector within a NeXus file, takes the first compatible detector

    - +
    +getValleySize()
    +
    + +
    +
    +initValleySize()
    +
    + +
    +
    +nearest_peak(x)
    +
    - + + +
    Parameters:all – return all detectors found as a list
    Parameters:x – coordinates of the peak
    Returns:the coordinates of the nearest peak
    -
    -
    -classmethod get_attr(dset, name, default=None)
    -

    Return the attribute of the dataset

    -

    Handles the ascii -> unicode issue in python3 #275

    +
    +
    +peaks_from_area(mask, Imin=None, keep=1000, dmin=0.0, seed=None, **kwarg)
    +

    Return the list of peaks within an area

    - @@ -5972,16 +8797,45 @@

    Navigation

    -
    -get_class(grp, class_type='NXcollection')
    -

    return all sub-groups of the given type within a group

    +
    +setValleySize(size)
    +
    + +
    +
    +valley_size
    +

    Defines the minimum distance between two massifs

    +
    + + + + +
    +

    blob_detection Module

    +
    +
    +class pyFAI.blob_detection.BlobDetection(img, cur_sigma=0.25, init_sigma=0.5, dest_sigma=1, scale_per_octave=2, mask=None)
    +

    Bases: object

    +

    Performs a blob detection: +http://en.wikipedia.org/wiki/Blob_detection +using a Difference of Gaussian + Pyramid of Gaussians

    +
    +
    +__init__(img, cur_sigma=0.25, init_sigma=0.5, dest_sigma=1, scale_per_octave=2, mask=None)
    +

    Performs a blob detection: +http://en.wikipedia.org/wiki/Blob_detection +using a Difference of Gaussian + Pyramid of Gaussians

    Parameters:
      -
    • dset – a HDF5 dataset (or a group)
    • -
    • name – name of the attribute
    • -
    • default – default value to be returned
    • +
    • mask – 2d array with mask.
    • +
    • Imin – minimum of intensity above the background to keep the point
    • +
    • keep – maximum number of points to keep
    • +
    • kwarg – ignored parameters
    • +
    • dmin – minimum distance to another peak
    • +
    • seed – list of good guesses to start with
    Returns:

    attribute value decoded in python3 or default

    +
    Returns:

    list of peaks [y,x], [y,x], ...]

    @@ -5990,16 +8844,25 @@

    Navigation

    -
    -get_data(grp, class_type='NXdata')
    -

    return all dataset of the the NeXus class NXdata

    +
    +direction()
    +

    Perform and plot the two main directions of the peaks, considering their previously +calculated scale ,by calculating the Hessian at different sizes as the combination of +gaussians and their first and second derivatives

    +
    + +
    +
    +nearest_peak(p, refine=True, Imin=None)
    +

    Return the nearest peak from a position

    Parameters:
      -
    • grp – HDF5 group
    • -
    • class_type – name of the NeXus class
    • +
    • img – input image
    • +
    • cur_sigma – estimated smoothing of the input image. 0.25 correspond to no interaction between pixels.
    • +
    • init_sigma – start searching at this scale (sigma=0.5: 10% interaction with first neighbor)
    • +
    • dest_sigma – sigma at which the resolution is lowered (change of octave)
    • +
    • scale_per_octave – Number of scale to be performed per octave
    • +
    • mask – mask where pixel are not valid
    @@ -6008,57 +8871,108 @@

    Navigation

    -
    -get_entries()
    -

    retrieves all entry sorted the latest first.

    +
    +peaks_from_area(mask, keep=None, refine=True, Imin=None, dmin=0.0, **kwargs)
    +

    Return the list of peaks within an area

    Parameters:
      -
    • grp – HDF5 group
    • -
    • class_type – name of the NeXus class
    • +
    • p – input position (y,x) 2-tuple of float
    • +
    • refine – shall the position be refined on the raw data
    • +
    • Imin – minimum of intensity above the background
    - + + +
    Returns:list of HDF5 groups
    Parameters:
      +
    • mask – 2d array with mask.
    • +
    • refine – shall the position be refined on the raw data
    • +
    • Imin – minimum of intensity above the background
    • +
    • kwarg – ignored parameters
    • +
    +
    Returns:

    list of peaks [y,x], [y,x], ...]

    +
    -
    -get_entry(name)
    -

    Retrieves an entry from its name

    +
    +process(max_octave=None)
    +

    Perform the keypoint extraction for max_octave cycles or until all octaves have been processed. +:param max_octave: number of octave to process

    +
    + +
    +
    +refine_Hessian(kpx, kpy, kps)
    +

    Refine the keypoint location based on a 3 point derivative, and delete +non-coherent keypoints.

    - + - +
    Parameters:name – name of the entry to retrieve
    Parameters:
      +
    • kpx – x_pos of keypoint
    • +
    • kpy – y_pos of keypoint
    • +
    • kps – s_pos of keypoint
    • +
    +
    Returns:HDF5 group of NXclass == NXentry
    Returns:

    arrays of corrected coordinates of keypoints, values and +locations of keypoints

    +
    -
    -new_class(grp, name, class_type='NXcollection')
    -

    create a new sub-group with type class_type -:param grp: parent group -:param name: name of the sub-group -:param class_type: NeXus class name -:return: subgroup created

    +
    +refine_Hessian_SG(kpx, kpy, kps)
    +

    Savitzky Golay algorithm to check if a point is really the maximum +:param kpx: x_pos of keypoint +:param kpy: y_pos of keypoint +:param kps: s_pos of keypoint +:return array of corrected keypoints

    +
    + +
    +
    +refinement()
    +
    + +
    +
    +show_neighboor()
    +
    + +
    +
    +show_stats()
    +

    Shows a window with the repartition of keypoint in function of scale/intensity

    -
    -
    -new_detector(name='detector', entry='entry', subentry='pyFAI')
    -

    Create a new entry/pyFAI/Detector

    - +
    +
    +tresh = 0.6
    +
    + + + +
    +
    +pyFAI.blob_detection.image_test()
    +
    + +
    +
    +pyFAI.blob_detection.local_max(dogs, mask=None, n_5=True)
    +
    @@ -6066,198 +8980,254 @@

    Navigation

    Parameters:
      -
    • detector – name of the detector
    • -
    • entry – name of the entry
    • -
    • subentry – all pyFAI description of detectors should be in a pyFAI sub-entry
    • +
    • dogs – 3d array with (sigma,y,x) containing difference of gaussians
    • +
    • mask – mask out keypoint next to the mask (or inside the mask)
    • +
    • n_5 – look for a larger neighborhood
    +
    +
    +pyFAI.blob_detection.make_gaussian(im, sigma, xc, yc)
    +
    + +
    +
    +

    calibrant Module

    +

    Calibrant

    +

    A module containing classical calibrant and also tools to generate d-spacing.

    +

    Interesting formula: +http://geoweb3.princeton.edu/research/MineralPhy/xtalgeometry.pdf

    +
    +
    +class pyFAI.calibrant.Calibrant(filename=None, dSpacing=None, wavelength=None)
    +

    Bases: object

    +

    A calibrant is a reference compound where the d-spacing (interplanar distances) +are known. They are expressed in Angstrom (in the file)

    +
    +
    +__init__(filename=None, dSpacing=None, wavelength=None)
    +
    +
    -
    -new_entry(entry='entry', program_name='pyFAI', title='description of experiment', force_time=None)
    -

    Create a new entry

    +
    +append_2th(value)
    +
    + +
    +
    +append_dSpacing(value)
    +
    + +
    +
    +dSpacing
    +
    + +
    +
    +fake_calibration_image(ai, shape=None, Imax=1.0, U=0, V=0, W=0.0001)
    +

    Generates a fake calibration image from an azimuthal integrator

    Parameters:
      -
    • entry – name of the entry
    • -
    • program_name – value of the field as string
    • -
    • title – value of the field as string
    • +
    • ai – azimuthal integrator
    • +
    • Imax – maximum intensity of rings
    • +
    • V, W (U,) – width of the peak from Caglioti’s law (FWHM^2 = Utan(th)^2 + Vtan(th) + W)
    -

    @force_time: enforce the start_time (as string!) -:return: the corresponding HDF5 group

    -
    -new_instrument(entry='entry', instrument_name='id00')
    -

    Create an instrument in an entry or create both the entry and the instrument if

    -
    +
    +get_2th()
    +
    +
    +
    +get_2th_index(angle)
    +

    return the index in the 2theta angle index

    -
    -
    -class pyFAI.io.Writer(filename=None, extension=None)
    -

    Bases: object

    -

    Abstract class for writers.

    -
    -
    -CONFIG_ITEMS = ['filename', 'dirname', 'extension', 'subdir', 'hpath']
    +
    +
    +get_dSpacing()
    -
    -flush(*arg, **kwarg)
    -

    To be implemented

    -
    +
    +get_wavelength()
    +
    -
    -init(fai_cfg=None, lima_cfg=None)
    -

    Creates the directory that will host the output file(s) -:param fai_cfg: configuration for worker -:param lima_cfg: configuration for acquisition

    -
    +
    +load_file(filename=None)
    +
    -
    -setJsonConfig(json_config=None)
    -

    Sets the JSON configuration

    +
    +save_dSpacing(filename=None)
    +

    save the d-spacing to a file

    -
    -write(data)
    -

    To be implemented

    +
    +setWavelength_change2th(value=None)
    +
    + +
    +
    +setWavelength_changeDs(value=None)
    +

    This is probably not a good idea, but who knows !

    +
    +
    +set_dSpacing(lst)
    +
    + +
    +
    +set_wavelength(value=None)
    +
    + +
    +
    +wavelength
    +
    + -
    -
    -pyFAI.io.from_isotime(text, use_tz=False)
    -
    +
    +
    +class pyFAI.calibrant.Cell(a=1, b=1, c=1, alpha=90, beta=90, gamma=90, lattice='triclinic', lattice_type='P')
    +

    Bases: object

    +

    This is a cell object, able to calculate the volume and d-spacing according to formula from:

    +

    http://geoweb3.princeton.edu/research/MineralPhy/xtalgeometry.pdf

    +
    +
    +__init__(a=1, b=1, c=1, alpha=90, beta=90, gamma=90, lattice='triclinic', lattice_type='P')
    +

    Constructor of the Cell class:

    +

    Crystalographic units are Angstrom for distances and degrees for angles !

    +
    - +
    Parameters:text – string representing the time is iso format
    Parameters:
      +
    • a,b,c – unit cell length in Angstrom
    • +
    • beta, gamma (alpha,) – unit cell angle in degrees
    • +
    • lattice – “cubic”, “tetragonal”, “hexagonal”, “rhombohedral”, “orthorhombic”, “monoclinic”, “triclinic”
    • +
    • lattice_type – P, I, F, C or R
    • +
    +
    -
    -
    -pyFAI.io.get_isotime(forceTime=None)
    -
    +
    +
    +classmethod cubic(a, lattice_type='P')
    +

    Factory for cubic lattices

    +
    - + - + +
    Parameters:forceTime (float) – enforce a given time (current by default)
    Parameters:a – unit cell length
    Returns:the current time as an ISO8601 string
    +
    + +
    +
    +d(hkl)
    +

    Calculate the actual d-spacing for a 3-tuple of integer representing a +family of Miller plans

    + +++ + - +
    Parameters:hkl – 3-tuple of integers
    Return type:string
    Returns:the inter-planar distance
    -
    -
    -pyFAI.io.is_hdf5(filename)
    -

    Check if a file is actually a HDF5 file

    +
    +
    +d_spacing(dmin=1.0)
    +

    Calculate all d-spacing down to dmin

    +

    applies selection rules

    - + + +
    Parameters:filename – this file has better to exist
    Parameters:dmin – minimum value of spacing requested
    Returns:dict d-spacing as string, list of tuple with Miller indices +preceded with the numerical value
    -
    -
    -

    calibration Module

    -

    pyFAI-calib

    -

    A tool for determining the geometry of a detector using a reference sample.

    -
    -
    -class pyFAI.calibration.AbstractCalibration(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    -

    Bases: object

    -

    Everything that is common to Calibration and Recalibration

    -
    -
    -HELP = {'reset': 'Reset the geometry to the initial guess (rotation to zero, distance to 0.1m, poni at the center of the image)', 'delete': 'delete a group of points, provide the letter.', 'set': "set the value of a parameter to the given value, i.e 'set wavelength 0.1 nm', units are optional", 'chiplot': 'plot control point radial error as function of azimuthal angle, optional parameters: the rings for which this need to be plotted', 'help': "Try to get the help of a given action, like 'refine?'. Use done when finished. Most command are composed of 'action parameter value' like 'set wavelength 1 A'.", 'weight': 'toggle from weighted to unweighted mode...', 'get': 'print he value of a parameter', 'fix': "fixes the value of a parameter so that its value will not be optimized, i.e. 'fix wavelength'", 'validate2': 'measures the offset of the center as function of azimuthal angle by cross-correlation of 2 plots, 180 deg appart. Option: number of azimuthal sliced, default: 36', 'show': "Just print out the current parameter set. Optional parameters are units for length, rotation and wavelength, i.e. 'show mm deg A'", 'bound': "sets the upper and lower bound of a parameter: 'bound dist 0.1 0.2'", 'free': "frees the parameter so that the value can be optimized, i.e. 'free wavelength'", 'bounds': 'sets the upper and lower bound of all parameters', 'abort': 'quit immediately, discarding any unsaved changes', 'done': 'finishes the processing, performs an integration and quits', 'refine': 'performs a new cycle of refinement', 'integrate': 'perform the azimuthal integration and display results', 'validate': 'plot the offset between the calibrated image and the back-projected image', 'recalib': 'extract a new set of rings and re-perform the calibration. One can specify how many rings to extract and the algorithm to use (blob, massif, watershed) and the nb_pts_per_deg in azimuth', 'assign': 'Change the assignment of a group of points to a rings', 'define': 'Re-define the value for a constant internal parameter of the program like max_iter, nPt_1D, nPt_2D_azim, nPt_2D_rad, integrator_method, error_model. Warning: attribute change may be harmful !'}
    -
    - -
    -
    -PARAMETERS = ['dist', 'poni1', 'poni2', 'rot1', 'rot2', 'rot3', 'wavelength']
    -
    - -
    -
    -PTS_PER_DEG = 0.3
    -
    - -
    -
    -UNITS = {'poni1': 'meter', 'poni2': 'meter', 'rot1': 'radian', 'rot3': 'radian', 'rot2': 'radian', 'wavelength': 'meter', 'dist': 'meter'}
    -
    - -
    -
    -VALID_URL = ['', 'file', 'hdf5', 'nxs', 'h5']
    -
    - -
    -
    -analyse_options(options=None, args=None)
    -

    Analyzes options and arguments

    +
    +
    +classmethod diamond(a)
    +

    Factory for Diamond type FCC like Si and Ge

    - +
    Returns:option,arguments
    Parameters:a – unit cell length
    -
    -chiplot(rings=None)
    -

    plot delta_2theta/2theta = f(chi) and fit the curve.

    +
    +get_type()
    +
    + +
    +
    +classmethod hexagonal(a, c, lattice_type='P')
    +

    Factory for hexagonal lattices

    - +
    Parameters:rings – list of rings to consider
    Parameters:
      +
    • a – unit cell length
    • +
    • c – unit cell length
    • +
    +
    -
    -
    -configure_parser(version='calibration from pyFAI version 0.12.0: 06/06/2016', usage='pyFAI-calib [options] input_image.edf', description=None, epilog=None)
    -

    Common configuration for parsers

    -
    +
    +
    +lattices = ['cubic', 'tetragonal', 'hexagonal', 'rhombohedral', 'orthorhombic', 'monoclinic', 'triclinic']
    +
    -
    -
    -extract_cpt(method='massif', pts_per_deg=1.0)
    -

    Performs an automatic keypoint extraction: -Can be used in recalib or in calib after a first calibration has been performed.

    +
    +
    +classmethod monoclinic(a, b, c, beta, lattice_type='P')
    +

    Factory for hexagonal lattices

    @@ -6265,339 +9235,257 @@

    Navigation

    Parameters:
      -
    • method – method for keypoint extraction
    • -
    • pts_per_deg – number of control points per azimuthal degree (increase for better precision)
    • +
    • a – unit cell length
    • +
    • b – unit cell length
    • +
    • c – unit cell length
    • +
    • beta – unit cell angle
    -
    -
    -get_pixelSize(ans)
    -

    convert a comma separated sting into pixel size

    -
    - -
    -
    -postProcess()
    -

    Common part: shows the result of the azimuthal integration in 1D and 2D

    -
    - -
    -
    -preprocess()
    -

    Common part: -do dark, flat correction thresholding, ... -and read missing data from keyboard if needed

    -
    - -
    -
    -prompt()
    -

    prompt for commands to guide the calibration process

    +
    +
    +classmethod orthorhombic(a, b, c, lattice_type='P')
    +

    Factory for orthorhombic lattices

    - +
    Returns:True when the user is happy with what he has, False to request another refinement
    Parameters:
      +
    • a – unit cell length
    • +
    • b – unit cell length
    • +
    • c – unit cell length
    • +
    +
    -
    -
    -read_dSpacingFile(verbose=True)
    -

    Read the name of the calibrant / file with d-spacing

    -
    - -
    -
    -read_pixelsSize()
    -

    Read the pixel size from prompt if not available

    -
    - -
    -
    -read_wavelength()
    -

    Read the wavelength

    -
    - -
    -
    -refine()
    -

    Contains the common geometry refinement part

    -
    - -
    -
    -reset_geometry(how='center', refine=False)
    -

    Reset the geometry: no tilt in all cases

    +
    +
    +classmethod rhombohedral(a, alpha, lattice_type='P')
    +

    Factory for hexagonal lattices

    - +
    Parameters:how – multiple options -* center: set the PONI at the center of the detector -* ring: center the poni at the middle of the inner-most ring -//* best: try both option and keeps the best
    Parameters:
      +
    • a – unit cell length
    • +
    • alpha – unit cell angle
    • +
    +
    -

    //:param refine: launch the refinement

    -
    - -
    -
    -set_data(data)
    -

    call-back function for the peak-picker

    -
    -validate_calibration()
    -

    Validate the calibration and calculate the offset in the diffraction image

    -
    - -
    -
    -validate_center(slices=36)
    -

    Validate the position of the center by cross-correlating two spectra 180 deg appart. -Output values are in micron.

    -

    Designed for orthogonal setup with centered beam...

    +
    +save(name, long_name=None, doi=None, dmin=1.0, dest_dir=None)
    +

    Save informations about the cell in a d-spacing file, usable as Calibrant

    - +
    Parameters:slices – number of slices on which perform
    Parameters:
      +
    • name – name of the calibrant
    • +
    • doi – reference of the publication used to parametrize the cell
    • +
    • dmin – minimal d-spacing
    • +
    • dest_dir – name of the directory where to save the result
    • +
    +
    -
    -win_error = 'We are under windows with a 32 bit version of python, matplotlib is not able to display too many images without crashing, this is why the window showing the diffraction image is closed'
    -
    - +
    +selection_rules = None
    +

    contains a list of functions returning True(allowed)/False(forbiden)/None(unknown)

    -
    -
    -class pyFAI.calibration.Calibration(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, gaussianWidth=None, wavelength=None, calibrant=None)
    -

    Bases: pyFAI.calibration.AbstractCalibration

    -

    class doing the calibration of frames

    -
    -gui_peakPicker()
    +
    +set_type(lattice_type)
    -
    -
    -initgeoRef()
    -

    Tries to initialise the GeometryRefinement (dist, poni, rot) -Returns a dictionary of key value pairs

    -
    - -
    -
    -parse()
    -

    parse options from command line

    -
    - -
    -
    -preprocess()
    -

    do dark, flat correction thresholding, ...

    -
    - -
    -
    -refine()
    -

    Contains the geometry refinement part specific to Calibration -Sets up the initial guess when starting pyFAI-calib

    -
    - +
    +
    +classmethod tetragonal(a, c, lattice_type='P')
    +

    Factory for tetragonal lattices

    + +++ + + + +
    Parameters:
      +
    • a – unit cell length
    • +
    • c – unit cell length
    • +
    +
    -
    -
    -class pyFAI.calibration.CheckCalib(poni=None, img=None, unit='2th_deg')
    -

    Bases: object

    -
    -
    -get_1dsize()
    -
    - -
    -
    -integrate()
    -
    - -
    -
    -parse()
    +
    +
    +type
    -
    -
    -rebuild()
    -

    Rebuild the diffraction image and measures the offset with the reference -:return: offset

    -
    - -
    -
    -show()
    -

    Show the image with the the errors

    -
    -
    -
    -size1d
    +
    +types = {'I': 'Body centered', 'P': 'Primitive', 'C': 'Side centered', 'R': 'Rhombohedral', 'F': 'Face centered'}
    +
    + +
    +
    +volume
    -
    -
    -smooth_mask(hwhm=5)
    -

    smooth out around the mask to avoid aligning on the mask

    -
    - -
    - -
    -
    -class pyFAI.calibration.MultiCalib(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None)
    -

    Bases: object

    -
    -
    -get_pixelSize(ans)
    -

    convert a comma separated sting into pixel size

    +
    +
    +class pyFAI.calibrant.calibrant_factory(basedir=None)
    +

    Bases: object

    +

    Behaves like a dict but is actually a factory:

    +

    Each time one retrieves an object it is a new geniune new calibrant (unmodified)

    -
    -parse(exe=None, description=None, epilog=None)
    -

    parse options from command line -:param exe: name of the program (MX-calibrate) -:param description: Description of the program

    +
    +__init__(basedir=None)
    +

    Constructor

    + +++ + + + +
    Parameters:basedir – directory name where to search for the calibrants
    -
    -process()
    +
    +get(what, notfound=None)
    -
    -read_dSpacingFile()
    -

    Read the name of the calibrant or the file with d-spacing

    -
    +
    +has_key(k)
    +
    -
    -read_pixelsSize()
    -

    Read the pixel size from prompt if not available

    -
    +
    +items()
    +
    -
    -read_wavelength()
    -

    Read the wavelength

    -
    +
    +keys()
    +
    -
    -regression()
    +
    +values()
    +
    +
    +

    distortion Module

    -
    -class pyFAI.calibration.Recalibration(dataFiles=None, darkFiles=None, flatFiles=None, pixelSize=None, splineFile=None, detector=None, wavelength=None, calibrant=None)
    -

    Bases: pyFAI.calibration.AbstractCalibration

    -

    class doing the re-calibration of frames

    +
    +class pyFAI.distortion.Distortion(detector='detector', shape=None, resize=False, empty=0, mask=None, method='CSR', device=None, workgroup=8)
    +

    Bases: object

    +

    This class applies a distortion correction on an image.

    +

    New version compatible both with CSR and LUT...

    -
    -parse()
    -

    parse options from command line

    +
    +__init__(detector='detector', shape=None, resize=False, empty=0, mask=None, method='CSR', device=None, workgroup=8)
    +
    +++ + + + +
    Parameters:
      +
    • detector – detector instance or detector name
    • +
    • shape – shape of the output image
    • +
    • resize – allow the output shape to be different from the input shape
    • +
    • empty – value to be given for empty bins
    • +
    • method – “lut” or “csr”, the former is faster
    • +
    • device – Name of the device: None for OpenMP, “cpu” or “gpu” or the id of the OpenCL device a 2-tuple of integer
    • +
    • workgroup – workgroup size for CSR on OpenCL
    • +
    +
    -
    -preprocess()
    -

    do dark, flat correction thresholding, ...

    +
    +calc_LUT(use_common=True)
    +

    Calculate the Look-up table

    + +++ + + + +
    Returns:look up table either in CSR or LUT format depending on serl.method
    -
    -read_dSpacingFile()
    -

    Read the name of the file with d-spacing

    +
    +calc_init()
    +

    Initialize all arrays

    -
    -refine()
    -

    Contains the geometry refinement part specific to Recalibration

    -
    - -
    - -
    -
    -pyFAI.calibration.calib(img, calibrant, detector, basename='from_ipython', reconstruct=False, dist=0.1, gaussian=None, interactive=True)
    -

    Procedural interfact for calibration

    +
    +calc_pos(use_cython=True)
    +

    Calculate the pixel boundary position on the regular grid

    - + - +
    Parameters:
      -
    • img – 2d array representing the calibration image
    • -
    • calibrant – Instance of Calibrant, set-up with wavelength
    • -
    • detector – Detector instance containing the mask
    • -
    • basename – output file base
    • -
    • recontruct – perform image reconstruction of masked pixel ?
    • -
    • dist – initial distance
    • -
    • gaussian – width of the gaussian used for difference of gaussian in the “massif” peak-picking algorithm
    • -
    • interactive – set to False for testing
    • -
    -
    Returns:pixel corner positions (in pixel units) on the regular grid
    Returns:

    AzimuthalIntegrator instance

    -
    Return type:ndarray of shape (nrow, ncol, 4, 2)
    -
    -
    -pyFAI.calibration.get_detector(detector, datafiles=None)
    -

    Detector factory taking into account the binning knowing the datafiles -:param detector: string or detector or other junk -:param datafiles: can be a list of images to be opened and their shape used. -:return pyFAI.detector.Detector instance

    +
    +
    +calc_size(use_cython=True)
    +

    Calculate the number of pixels falling into every single bin and

    + +++ + + + +
    Returns:max of pixel falling into a single bin
    +

    Considering the “half-CCD” spline from ID11 which describes a (1025,2048) detector, +the physical location of pixels should go from: +[-17.48634 : 1027.0543, -22.768829 : 2028.3689] +We chose to discard pixels falling outside the [0:1025,0:2048] range with a lose of intensity

    -
    -
    -

    peak_picker Module

    -
    -
    -class pyFAI.peak_picker.ControlPoints(filename=None, calibrant=None, wavelength=None)
    -

    Bases: object

    -

    This class contains a set of control points with (optionally) their ring number hence d-spacing and diffraction 2Theta angle ...

    -
    -append(points, ring=None, annotate=None, plot=None)
    -
    +
    +correct(image, dummy=None, delta_dummy=None)
    +

    Correct an image based on the look-up table calculated ...

    +
    - @@ -6605,15 +9493,18 @@

    Navigation

    -
    -append_2theta_deg(points, angle=None, ring=None)
    -
    Parameters:
      -
    • point – list of points
    • -
    • ring – ring number
    • -
    • annotate – matplotlib.annotate reference
    • -
    • plot – matplotlib.plot reference
    • +
    • image – 2D-array with the image
    • +
    • dummy – value suggested for bad pixels
    • +
    • delta_dummy – precision of the dummy value
    Returns:

    PointGroup instance

    +
    Returns:

    corrected 2D image

    +
    +reset(method=None, device=None, workgroup=None, prepare=True)
    +

    reset the distortion correction and re-calculate the look-up table

    +
    @@ -6621,550 +9512,516 @@

    Navigation

    Parameters:
      -
    • point – list of points
    • -
    • angle – 2-theta angle in degrees
    • +
    • method – can be “lut” or “csr”, “lut” looks faster
    • +
    • device – can be None, “cpu” or “gpu” or the id as a 2-tuple of integer
    • +
    • worgroup – enforce the workgroup size for CSR.
    • +
    • prepare – set to false to only reset and not re-initialize
    -
    -
    -check()
    -

    check internal consistency of the class

    -
    -
    -
    -dSpacing
    -
    +
    +shape_out
    +

    Calculate/cache the output shape

    +

    :return output shape

    +
    -
    -get(ring=None)
    -

    retireves the last set of points for a given ring (by default the last)

    +
    +uncorrect(image, use_cython=False)
    +

    Take an image which has been corrected and transform it into it’s raw (with loss of information)

    - + + +
    Parameters:ring – index of ring to search for
    Parameters:image – 2D-array with the image
    Returns:uncorrected 2D image
    +

    Nota: to retrieve the input mask on can do:

    +
    >>> msk =  dis.uncorrect(numpy.ones(dis._shape_out)) <= 0
    +
    +
    -
    -
    -getList()
    -

    Retrieve the list of control points suitable for geometry refinement with ring number

    +
    +
    +class pyFAI.distortion.Quad(buffer)
    +

    Bases: object

    +

    Quad modelisation.

    +Modelization of the quad
    +
    +__init__(buffer)
    +
    +
    -
    -getList2theta()
    -

    Retrieve the list of control points suitable for geometry refinement

    -
    +
    +calc_area()
    +
    -
    -getListRing()
    -

    Retrieve the list of control points suitable for geometry refinement with ring number

    -
    +
    +calc_area_AB(I1, I2)
    +
    -
    -getWeightedList(image)
    -

    Retrieve the list of control points suitable for geometry refinement with ring number and intensities -:param image: -:return: a (x,4) array with pos0, pos1, ring nr and intensity

    -

    #TODO: refine the value of the intensity using 2nd order polynomia

    -
    +
    +calc_area_BC(J1, J2)
    +
    -
    -get_dSpacing()
    +
    +calc_area_CD(K1, K2)
    -
    -get_wavelength()
    +
    +calc_area_DA(L1, L2)
    +
    + +
    +
    +calc_area_old()
    +
    + +
    +
    +calc_area_vectorial()
    +
    + +
    +
    +get_box(i, j)
    -
    -load(filename)
    -

    load all control points from a file

    -
    - -
    -
    -pop(ring=None, lbl=None)
    -

    Remove the set of points, either from its code or from a given ring (by default the last)

    - --- - - - -
    Parameters:
      -
    • ring – index of ring of which remove the last group
    • -
    • lbl – code of the ring to remove
    • -
    -
    -
    +
    +get_box_size0()
    +
    -
    -readRingNrFromKeyboard()
    -

    Ask the ring number values for the given points

    -
    +
    +get_box_size1()
    +
    -
    -reset()
    -

    remove all stored values and resets them to default

    -
    +
    +get_idx(i, j)
    +
    -
    -save(filename)
    -

    Save a set of control points to a file -:param filename: name of the file -:return: None

    -
    +
    +get_offset0()
    +
    -
    -setWavelength_change2th(value=None)
    +
    +get_offset1()
    -
    -setWavelength_changeDs(value=None)
    -

    This is probably not a good idea, but who knows !

    -
    +
    +init_slope()
    +
    -
    -set_dSpacing(lst)
    +
    +integrateAB(start, stop, calc_area)
    -
    -set_wavelength(value=None)
    +
    +populate_box()
    -
    -
    -wavelength
    +
    +
    +reinit(A0, A1, B0, B1, C0, C1, D0, D1)
    +
    +
    +pyFAI.distortion.test()
    +
    + +
    +
    +

    worker Module

    +

    This module contains the Worker class:

    +

    A tool able to perform azimuthal integration with: +additional saving capabilities like

    +
      +
    • save as 2/3D structure in a HDF5 File
    • +
    • read from HDF5 files
    • +
    +

    Aims at being integrated into a plugin like LImA or as model for the GUI

    +

    The configuration of this class is mainly done via a dictionary transmitted as a JSON string: +Here are the valid keys:

    +
      +
    • “dist”
    • +
    • “poni1”
    • +
    • “poni2”
    • +
    • “rot1”
    • +
    • “rot3”
    • +
    • “rot2”
    • +
    • “pixel1”
    • +
    • “pixel2”
    • +
    • “splineFile”
    • +
    • “wavelength”
    • +
    • “poni” #path of the file
    • +
    • “chi_discontinuity_at_0”
    • +
    • “do_mask”
    • +
    • “do_dark”
    • +
    • “do_azimuthal_range”
    • +
    • “do_flat”
    • +
    • “do_2D”
    • +
    • “azimuth_range_min”
    • +
    • “azimuth_range_max”
    • +
    • “polarization_factor”
    • +
    • “nbpt_rad”
    • +
    • “do_solid_angle”
    • +
    • “do_radial_range”
    • +
    • “do_poisson”
    • +
    • “delta_dummy”
    • +
    • “nbpt_azim”
    • +
    • “flat_field”
    • +
    • “radial_range_min”
    • +
    • “dark_current”
    • +
    • “do_polarization”
    • +
    • “mask_file”
    • +
    • “detector”
    • +
    • “unit”
    • +
    • “radial_range_max”
    • +
    • “val_dummy”
    • +
    • “do_dummy”
    • +
    • “method”
    • +
    -
    -class pyFAI.peak_picker.PeakPicker(data, reconst=False, mask=None, pointfile=None, calibrant=None, wavelength=None, detector=None, method='massif')
    +
    +class pyFAI.worker.DistortionWorker(detector=None, dark=None, flat=None, solidangle=None, polarization=None, mask=None, dummy=None, delta_dummy=None, device=None)

    Bases: object

    -

    This class is in charge of peak picking, i.e. find bragg spots in the image -Two methods can be used : massif or blob

    -
    -
    -VALID_METHODS = ['massif', 'blob', 'watershed']
    -
    +

    Simple worker doing dark, flat, solid angle and polarization correction

    +
    +
    +__init__(detector=None, dark=None, flat=None, solidangle=None, polarization=None, mask=None, dummy=None, delta_dummy=None, device=None)
    +

    Constructor of the worker +:param dark: array +:param flat: array +:param solidangle: solid-angle array +:param polarization: numpy array with 2D polarization corrections +:param device: Used to influance OpenCL behavour: can be “cpu”, “GPU”, “Acc” or even an OpenCL context

    +
    -
    -closeGUI()
    -
    +
    +process(data, normalization_factor=1.0)
    +

    Process the data and apply a normalization factor +:param data: input data +:param normalization: normalization factor +:return processed data

    +
    + + +
    +
    +class pyFAI.worker.PixelwiseWorker(dark=None, flat=None, solidangle=None, polarization=None, mask=None, dummy=None, delta_dummy=None, device=None)
    +

    Bases: object

    +

    Simple worker doing dark, flat, solid angle and polarization correction

    -
    -contour(data, cmap='autumn', linewidths=2, linestyles='dashed')
    -

    Overlay a contour-plot

    +
    +__init__(dark=None, flat=None, solidangle=None, polarization=None, mask=None, dummy=None, delta_dummy=None, device=None)
    +

    Constructor of the worker

    - +
    Parameters:data – 2darray with the 2theta values in radians...
    Parameters:
      +
    • dark – array
    • +
    • flat – array
    • +
    • solidangle – solid-angle array
    • +
    • polarization – numpy array with 2D polarization corrections
    • +
    • device – Used to influance OpenCL behavour: can be “cpu”, “GPU”, “Acc” or even an OpenCL context
    • +
    +
    -
    -display_points(minIndex=0, reset=False)
    -

    display all points and their ring annotations -:param minIndex: ring index to start with -:param reset: remove all point before re-displaying them

    +
    +process(data, normalization_factor=None)
    +

    Process the data and apply a normalization factor +:param data: input data +:param normalization: normalization factor +:return processed data

    -
    -
    -finish(filename=None, callback=None)
    -

    Ask the ring number for the given points

    - --- - - - -
    Parameters:filename – file with the point coordinates saved
    +
    +
    +class pyFAI.worker.Worker(azimuthalIntegrator=None, shapeIn=(2048, 2048), shapeOut=(360, 500), unit='r_mm', dummy=None, delta_dummy=None, azimuthalIntgrator=None)
    +

    Bases: object

    -
    -gui(log=False, maximize=False, pick=True)
    +
    +__init__(azimuthalIntegrator=None, shapeIn=(2048, 2048), shapeOut=(360, 500), unit='r_mm', dummy=None, delta_dummy=None, azimuthalIntgrator=None)
    - +
    Parameters:log – show z in log scale
    Parameters:
      +
    • AzimuthalIntegrator (azimuthalIntgrator) – pyFAI.AzimuthalIntegrator instance
    • +
    • AzimuthalIntegrator – pyFAI.AzimuthalIntegrator instance (deprecated)
    • +
    • shapeIn – image size in input
    • +
    • shapeOut – Integrated size: can be (1,2000) for 1D integration
    • +
    • unit – can be “2th_deg, r_mm or q_nm^-1 ...
    • +
    +
    -
    -
    -help = ['Please select rings on the diffraction image. In parenthesis, some modified shortcuts for single button mouse (Apple):', ' * Right-click (click+n): try an auto find for a ring', ' * Right-click + Ctrl (click+b): create new group with one point', ' * Right-click + Shift (click+v): add one point to current group', ' * Right-click + m (click+m): find more points for current group', ' * Center-click or (click+d): erase current group', ' * Center-click + 1 or (click+1): erase closest point from current group']
    -
    -
    -
    -init(method, sync=True)
    -

    Unified initializer

    -
    +
    +do_2D()
    +
    -
    -
    -load(filename)
    -

    load a filename and plot data on the screen (if GUI)

    -
    +
    +
    +error_model
    +
    -
    -massif_contour(data)
    -

    Overlays a mask over a diffraction image

    - --- - - - -
    Parameters:data – mask to be overlaid
    +
    +get_config()
    +

    return configuration as a dictionary

    -
    -on_minus_pts_clicked(*args)
    -

    callback function

    -
    +
    +get_error_model()
    +
    -
    -on_option_clicked(*args)
    -

    callback function

    +
    +get_json_config()
    +

    return configuration as a JSON string

    -
    -on_plus_pts_clicked(*args)
    -

    callback function

    -
    +
    +get_normalization_factor()
    +
    -
    -on_refine_clicked(*args)
    -

    callback function

    -
    +
    +get_unit()
    +
    -
    -
    -onclick(event)
    -

    Called when a mouse is clicked

    -
    +
    +
    +normalization_factor
    +
    -
    -peaks_from_area(**kwargs)
    -

    Return the list of peaks within an area

    +
    +process(data, normalization_factor=1.0, writer=None)
    +

    Process a frame +#TODO: +dark, flat, sa are missing

    - - -
    Parameters:
      -
    • mask – 2d array with mask.
    • -
    • Imin – minimum of intensity above the background to keep the point
    • -
    • keep – maximum number of points to keep
    • -
    • method – enforce the use of detection using “massif” or “blob” or “watershed”
    • -
    • ring – ring number to which assign the points
    • -
    • dmin – minimum distance between two peaks (in pixels)
    • -
    • seed – good starting points.
    • +
    Parameters:
      +
    • data – numpy array containing the input image
    • +
    • writer – An open writer in which ‘write’ will be called with the result of the integration
    Returns:

    list of peaks [y,x], [y,x], ...]

    -
    -
    -remove_grp(lbl)
    -

    remove a group of points

    +
    +reconfig(shape=(2048, 2048), sync=False)
    +

    This is just to force the integrator to initialize with a given input image shape

    - +
    Parameters:lbl – label of the group of points
    Parameters:
      +
    • shape – shape of the input image
    • +
    • sync – return only when synchronized
    • +
    +
    -
    -reset()
    -

    Reset control point and graph (if needed)

    +
    +reset()
    +

    this is just to force the integrator to initialize

    -
    -sync_init()
    +
    +save_config(filename=None)
    - - -
    -
    -class pyFAI.peak_picker.PointGroup(points=None, ring=None, annotate=None, plot=None, force_label=None)
    -

    Bases: object

    -

    Class contains a group of points ... -They all belong to the same Debye-Scherrer ring

    -
    -
    -code
    -

    Numerical value for the label: mainly for sorting

    -
    - -
    -
    -classmethod get_label()
    -

    return the next label

    -
    -
    -
    -get_ring()
    -
    - -
    -
    -label
    -
    - -
    -
    -last_label = 0
    -
    - -
    -
    -classmethod reset_label()
    -

    reset intenal counter

    -
    - -
    -
    -ring
    +
    +setDarkcurrentFile(imagefile)
    -
    -
    -classmethod set_label(label)
    -

    update the internal counter if needed

    +
    +
    +setExtension(ext)
    +

    enforce the extension of the processed data file written

    -
    -set_ring(value)
    +
    +setFlatfieldFile(imagefile)
    -
    - -
    -
    -

    massif Module

    -
    -
    -class pyFAI.massif.Massif(data=None)
    -

    Bases: object

    -

    A massif is defined as an area around a peak, it is used to find neighboring peaks

    -
    -
    -TARGET_SIZE = 1024
    +
    +
    +setJsonConfig(jsonconfig)
    -
    -calculate_massif(x)
    -

    defines a map of the massif around x and returns the mask

    +
    +setSubdir(path)
    +

    Set the relative or absolute path for processed data

    -
    -delValleySize()
    +
    +set_error_model(value)
    -
    -find_peaks(x, nmax=200, annotate=None, massif_contour=None, stdout=<open file '<stdout>', mode 'w' at 0x7fceb9e2e150>)
    -

    All in one function that finds a maximum from the given seed (x) -then calculates the region extension and extract position of the neighboring peaks. -:param x: seed for the calculation, input coordinates -:param nmax: maximum number of peak per region -:param annotate: call back method taking number of points + coordinate as input. -:param massif_contour: callback to show the contour of a massif with the given index. -:param stdout: this is the file where output is written by default. -:return: list of peaks

    -
    +
    +set_normalization_factor(value)
    +
    -
    -getBinnedData()
    -

    :return binned data

    -
    +
    +set_unit(value)
    +
    + +
    +
    +unit
    +
    -
    -getBluredData()
    -
    +
    +warmup(sync=False)
    +

    Process a dummy image to ensure everything is initialized

    +
    - +
    Returns:a blurred image
    Parameters:sync – wait for processing to be finished
    -
    -
    -getLabeledMassif(pattern=None)
    -
    --- - - - -
    Returns:an image composed of int with a different value for each massif
    -
    -
    -getMedianData()
    -
    +
    +
    +pyFAI.worker.make_ai(config)
    +

    Create an Azimuthal integrator from the configuration +stand alone function !

    +
    - + + +
    Returns:a spacial median filtered image
    Parameters:config – dict with all parameters
    Returns:configured (but uninitialized) AzimuthalIntgrator
    +
    +
    +

    units Module

    +

    Manages the different units

    +

    Nota for developers: this module is used a singleton to store all units in a +unique manner. This explains the number of top-level variables on the one +hand and their CAPITALIZATION on the other.

    +
    +
    +class pyFAI.units.Unit(name, scale=1, label=None, equation=None, center=None, corner=None, delta=None)
    +

    Bases: object

    +

    Represents a unit.

    +

    It has at least a name and a scale (in SI-unit)

    -
    -getValleySize()
    -
    - -
    -
    -initValleySize()
    -
    - -
    -
    -nearest_peak(x)
    -
    +
    +__init__(name, scale=1, label=None, equation=None, center=None, corner=None, delta=None)
    +

    Constructor of a unit.

    +
    - +
    Parameters:x – coordinates of the peak
    Parameters:
      +
    • name ((str)) – name of the unit
    • +
    • scale ((float)) – scale of th unit to go to SI
    • +
    • label ((string)) – label for nice representation in matplotlib, +can use latex representation
    • +
    • equation ((funct)) – equation to calculate the value from coordinates +(x,y,z) in detector space. +Parameters of the function are x, y, z, lambda
    • +
    • center ((str)) – name of the fast-path function
    • +
    +
    -

    :returns the coordinates of the nearest peak

    -
    -peaks_from_area(mask, Imin=None, keep=1000, dmin=0.0, seed=None, **kwarg)
    -

    Return the list of peaks within an area

    +
    +get(key)
    +

    Mimic the dictionary interface

    - + - +
    Parameters:
      -
    • mask – 2d array with mask.
    • -
    • Imin – minimum of intensity above the background to keep the point
    • -
    • keep – maximum number of points to keep
    • -
    • kwarg – ignored parameters
    • -
    • dmin – minimum distance to another peak
    • -
    • seed – list of good guesses to start with
    • -
    -
    Parameters:key ((str)) – key wanted
    Returns:

    list of peaks [y,x], [y,x], ...]

    -
    Returns:self.key
    -
    -
    -setValleySize(size)
    -
    - -
    -
    -valley_size
    -

    Defines the minimum distance between two massifs

    -
    - -
    - -
    -
    -

    blob_detection Module

    -
    -
    -class pyFAI.blob_detection.BlobDetection(img, cur_sigma=0.25, init_sigma=0.5, dest_sigma=1, scale_per_octave=2, mask=None)
    -

    Bases: object

    -

    Performs a blob detection: -http://en.wikipedia.org/wiki/Blob_detection -using a Difference of Gaussian + Pyramid of Gaussians

    -
    -
    -direction()
    -

    Perform and plot the two main directions of the peaks, considering their previously -calculated scale ,by calculating the Hessian at different sizes as the combination of -gaussians and their first and second derivatives

    -
    -
    -nearest_peak(p, refine=True, Imin=None)
    -

    Return the nearest peak from a position

    +
    +
    +pyFAI.units.eq_2th(x, y, z, wavelength=None)
    +

    Calculates the 2theta aperture of the cone

    @@ -7172,331 +10029,296 @@

    Navigation

    Parameters:
      -
    • p – input position (y,x) 2-tuple of float
    • -
    • refine – shall the position be refined on the raw data
    • -
    • Imin – minimum of intensity above the background
    • +
    • x – horizontal position, towards the center of the ring, from sample position
    • +
    • y – Vertical position, to the roof, from sample position
    • +
    • z – distance from sample along the beam
    • +
    • wavelength – in meter
    -
    -
    -peaks_from_area(mask, keep=None, refine=True, Imin=None, dmin=0.0, **kwargs)
    -

    Return the list of peaks within an area

    +
    +
    +pyFAI.units.eq_q(x, y, z, wavelength)
    +

    Calculates the modulus of the scattering vector

    - - -
    Parameters:
      -
    • mask – 2d array with mask.
    • -
    • refine – shall the position be refined on the raw data
    • -
    • Imin – minimum of intensity above the background
    • -
    • kwarg – ignored parameters
    • +
    Parameters:
      +
    • x – horizontal position, towards the center of the ring, from sample position
    • +
    • y – Vertical position, to the roof, from sample position
    • +
    • z – distance from sample along the beam
    • +
    • wavelength – in meter
    Returns:

    list of peaks [y,x], [y,x], ...]

    -
    -
    -
    -process(max_octave=None)
    -

    Perform the keypoint extraction for max_octave cycles or until all octaves have been processed. -:param max_octave: number of octave to process

    -
    - -
    -
    -refine_Hessian(kpx, kpy, kps)
    -

    Refine the keypoint location based on a 3 point derivative, and delete uncoherent keypoints

    +
    +
    +pyFAI.units.eq_r(x, y, z=None, wavelength=None)
    +

    Calculates the radius

    Parameters:
      -
    • kpx – x_pos of keypoint
    • -
    • kpy – y_pos of keypoint
    • -
    • kps – s_pos of keypoint
    • +
    • x – horizontal position, towards the center of the ring, from sample position
    • +
    • y – Vertical position, to the roof, from sample position
    • +
    • z – distance from sample along the beam
    • +
    • wavelength – in meter
    -

    :return arrays of corrected coordinates of keypoints, values and locations of keypoints

    -
    - -
    -
    -refine_Hessian_SG(kpx, kpy, kps)
    -

    Savitzky Golay algorithm to check if a point is really the maximum -:param kpx: x_pos of keypoint -:param kpy: y_pos of keypoint -:param kps: s_pos of keypoint -:return array of corrected keypoints

    -
    -
    -refinement()
    +
    +
    +pyFAI.units.register_radial_unit(name, scale=1, label=None, equation=None, center=None, corner=None, delta=None)
    -
    -
    -show_neighboor()
    +
    +
    +pyFAI.units.to_unit(obj, type_=None)
    +
    +
    +

    utils Module

    +

    Utilities, mainly for image treatment

    +
    +
    +class pyFAI.utils.FixedParameters
    +

    Bases: set

    +

    Like a set, made for FixedParameters in geometry refinement

    -
    -show_stats()
    -

    Shows a window with the repartition of keypoint in function of scale/intensity

    +
    +add_or_discard(key, value=True)
    +

    Add a value to a set if value, else discard it +:param key: element to added or discared from set +:type value: boolean. If None do nothing ! +:return: None

    -
    -
    -tresh = 0.6
    -
    -
    -
    -pyFAI.blob_detection.image_test()
    -
    - -
    -
    -pyFAI.blob_detection.local_max(dogs, mask=None, n_5=True)
    +
    +pyFAI.utils.binning(input_img, binsize, norm=True)
    - + + +
    Parameters:dogs – 3d array with (sigma,y,x) containing difference of gaussians
    Parameters:
      +
    • input_img – input ndarray
    • +
    • binsize – int or 2-tuple representing the size of the binning
    • +
    • norm – if False, do average instead of sum
    • +
    +
    Returns:

    binned input ndarray

    +
    -

    @parm mask: mask out keypoint next to the mask (or inside the mask) -:param n_5: look for a larger neighborhood

    -
    -pyFAI.blob_detection.make_gaussian(im, sigma, xc, yc)
    -
    - -
    -
    -

    calibrant Module

    -

    Calibrant

    -

    A module containing classical calibrant and also tools to generate d-spacing.

    -

    Interesting formula: -http://geoweb3.princeton.edu/research/MineralPhy/xtalgeometry.pdf

    -
    -
    -class pyFAI.calibrant.Calibrant(filename=None, dSpacing=None, wavelength=None)
    -

    Bases: object

    -

    A calibrant is a reference compound where the d-spacing (interplanar distances) -are known. They are expressed in Angstrom (in the file)

    -
    -
    -append_2th(value)
    -
    - -
    -
    -append_dSpacing(value)
    -
    +
    +pyFAI.utils.calc_checksum(ary, safe=True)
    +

    Calculate the checksum by default (or returns its buffer location if unsafe)

    +
    -
    -
    -dSpacing
    -
    +
    +
    +pyFAI.utils.center_of_mass(img)
    +

    Calculate the center of mass of of the array. +Like scipy.ndimage.measurements.center_of_mass +:param img: 2-D array +:return: 2-tuple of float with the center of mass

    +
    -
    -
    -fake_calibration_image(ai, shape=None, Imax=1.0, U=0, V=0, W=0.0001)
    -

    Generates a fake calibration image from an azimuthal integrator

    - +
    +
    +pyFAI.utils.concatenate_cl_kernel(filenames)
    +
    - +
    Parameters:
      -
    • ai – azimuthal integrator
    • -
    • Imax – maximum intensity of rings
    • -
    • V, W (U,) – width of the peak from Caglioti’s law (FWHM^2 = Utan(th)^2 + Vtan(th) + W)
    • -
    -
    Parameters:filenames (list of str which can be filename of kernel as a string.) – filenames containing the kernels
    +

    this method concatenates all the kernel from the list

    -
    -
    -get_2th()
    -
    - -
    -
    -get_2th_index(angle)
    -

    return the index in the 2theta angle index

    -
    - -
    -
    -get_dSpacing()
    -
    - -
    -
    -get_wavelength()
    -
    - -
    -
    -load_file(filename=None)
    -
    - -
    -
    -save_dSpacing(filename=None)
    -

    save the d-spacing to a file

    +
    +
    +pyFAI.utils.convert_CamelCase(name)
    +

    convert a function name in CamelCase into camel_case

    -
    -
    -setWavelength_change2th(value=None)
    -
    - -
    -
    -setWavelength_changeDs(value=None)
    -

    This is probably not a good idea, but who knows !

    +
    +
    +pyFAI.utils.deg2rad(dd)
    +

    Convert degrees to radian in the range -pi->pi

    + +++ + + + +
    Parameters:dd – angle in degrees
    +

    Nota: depending on the platform it could be 0<2pi +A branch is cheaper than a trigo operation

    -
    -
    -set_dSpacing(lst)
    -
    - -
    -
    -set_wavelength(value=None)
    -
    - -
    -
    -wavelength
    -
    - +
    +
    +pyFAI.utils.dog(s1, s2, shape=None)
    +

    2D difference of gaussian +typically 1 to 10 parameters

    -
    -
    -class pyFAI.calibrant.Cell(a=1, b=1, c=1, alpha=90, beta=90, gamma=90, lattice='triclinic', lattice_type='P')
    -

    Bases: object

    -

    This is a cell object, able to calculate the volume and d-spacing according to formula from:

    -

    http://geoweb3.princeton.edu/research/MineralPhy/xtalgeometry.pdf

    -
    -
    -classmethod cubic(a, lattice_type='P')
    -

    Factory for cubic lattices

    +
    +
    +pyFAI.utils.dog_filter(input_img, sigma1, sigma2, mode='reflect', cval=0.0)
    +

    2-dimensional Difference of Gaussian filter implemented with FFT

    - +
    Parameters:a – unit cell length
    Parameters:
      +
    • input_img (array-like) – input_img array to filter
    • +
    • sigma (scalar or sequence of scalars) – standard deviation for Gaussian kernel. +The standard deviations of the Gaussian filter are given for each axis as a sequence, +or as a single number, in which case it is equal for all axes.
    • +
    • mode – {‘reflect’,’constant’,’nearest’,’mirror’, ‘wrap’}, optional +The mode parameter determines how the array borders are +handled, where cval is the value when mode is equal to +‘constant’. Default is ‘reflect’
    • +
    • cval – scalar, optional +Value to fill past edges of input if mode is ‘constant’. Default is 0.0
    • +
    +
    -
    -
    -d(hkl)
    -

    Calculate the actual d-spacing for a 3-tuple of integer representing a -family of Miller plans

    +
    +
    +pyFAI.utils.expand(input_img, sigma, mode='constant', cval=0.0)
    +

    Expand array a with its reflection on boundaries

    - - - - + +
    Parameters:hkl – 3-tuple of integers
    Returns:the inter-planar distance
    Parameters:
      +
    • a – 2D array
    • +
    • sigma – float or 2-tuple of floats.
    • +
    • mode – “constant”, “nearest”, “reflect” or “mirror”
    • +
    • cval – filling value used for constant, 0.0 by default
    • +
    +
    +

    Nota: sigma is the half-width of the kernel. For gaussian convolution it is adviced that it is 4*sigma_of_gaussian

    -
    -
    -d_spacing(dmin=1.0)
    -

    Calculate all d-spacing down to dmin

    -

    applies selection rules

    +
    +
    +pyFAI.utils.expand2d(vect, size2, vertical=True)
    +

    This expands a vector to a 2d-array.

    +

    The result is the same as:

    +
    if vertical:
    +    numpy.outer(numpy.ones(size2), vect)
    +else:
    +    numpy.outer(vect, numpy.ones(size2))
    +
    +
    +

    This is a ninja optimization: replace *1 with a memcopy, saves 50% of +time at the ms level.

    - - - +
    Parameters:dmin – minimum value of spacing requested
    Returns:dict d-spacing as string, list of tuple with Miller indices -preceded with the numerical value
    Parameters:
      +
    • vect – 1d vector
    • +
    • size2 – size of the expanded dimension
    • +
    • vertical – if False the vector is expanded to the first dimension. +If True, it is expanded to the second dimension.
    • +
    +
    -
    -
    -classmethod diamond(a)
    -

    Factory for Diamond type FCC like Si and Ge

    +
    +
    +pyFAI.utils.expand_args(args)
    +

    Takes an argv and expand it (under Windows, cmd does not convert *.tif +into a list of files. +Keeps only valid files (thanks to glob)

    - + + +
    Parameters:a – unit cell length
    Parameters:args – list of files or wilcards
    Returns:list of actual args
    -
    -
    -get_type()
    -
    +
    +
    +pyFAI.utils.float_(val)
    +

    Convert anything to a float ... or None if not applicable

    +
    -
    -
    -classmethod hexagonal(a, c, lattice_type='P')
    -

    Factory for hexagonal lattices

    +
    +
    +pyFAI.utils.gaussian(M, std)
    +

    Return a Gaussian window of length M with standard-deviation std.

    +

    This differs from the scipy.signal.gaussian implementation as: +- The default for sym=False (needed for gaussian filtering without shift) +- This implementation is normalized

    Parameters:
      -
    • a – unit cell length
    • -
    • c – unit cell length
    • +
    • M – length of the windows (int)
    • +
    • std – standatd deviation sigma
    +

    The FWHM is 2*numpy.sqrt(2 * numpy.pi)*std

    -
    -
    -lattices = ['cubic', 'tetragonal', 'hexagonal', 'rhombohedral', 'orthorhombic', 'monoclinic', 'triclinic']
    -
    - -
    -
    -classmethod monoclinic(a, b, c, beta, lattice_type='P')
    -

    Factory for hexagonal lattices

    +
    +
    +pyFAI.utils.gaussian_filter(input_img, sigma, mode='reflect', cval=0.0, use_scipy=True)
    +

    2-dimensional Gaussian filter implemented with FFT

    @@ -7504,776 +10326,512 @@

    Navigation

    Parameters:
      -
    • a – unit cell length
    • -
    • b – unit cell length
    • -
    • c – unit cell length
    • -
    • beta – unit cell angle
    • +
    • input_img (array-like) – input array to filter
    • +
    • sigma (scalar or sequence of scalars) – standard deviation for Gaussian kernel. +The standard deviations of the Gaussian filter are given for each axis as a sequence, +or as a single number, in which case it is equal for all axes.
    • +
    • mode – {‘reflect’,’constant’,’nearest’,’mirror’, ‘wrap’}, optional +The mode parameter determines how the array borders are +handled, where cval is the value when mode is equal to +‘constant’. Default is ‘reflect’
    • +
    • cval – scalar, optional +Value to fill past edges of input if mode is ‘constant’. Default is 0.0
    -
    -
    -classmethod orthorhombic(a, b, c, lattice_type='P')
    -

    Factory for orthorhombic lattices

    +
    +
    +pyFAI.utils.get_calibration_dir()
    +

    get the full path of a calibration directory

    - +
    Parameters:
      -
    • a – unit cell length
    • -
    • b – unit cell length
    • -
    • c – unit cell length
    • -
    -
    Returns:the full path of the calibrant file
    -
    -
    -classmethod rhombohedral(a, alpha, lattice_type='P')
    -

    Factory for hexagonal lattices

    +
    +
    +pyFAI.utils.get_cl_file(filename)
    +

    get the full path of a openCL file

    - +
    Parameters:
      -
    • a – unit cell length
    • -
    • alpha – unit cell angle
    • -
    -
    Returns:the full path of the openCL source file
    -
    -
    -save(name, long_name=None, doi=None, dmin=1.0, dest_dir=None)
    -

    Save informations about the cell in a d-spacing file, usable as Calibrant

    +
    +
    +pyFAI.utils.get_ui_file(filename)
    +

    get the full path of a user-interface file

    - +
    Parameters:
      -
    • name – name of the calibrant
    • -
    • doi – reference of the publication used to parametrize the cell
    • -
    • dmin – minimal d-spacing
    • -
    • dest_dir – name of the directory where to save the result
    • -
    -
    Returns:the full path of the ui
    -
    -
    -selection_rules = None
    -

    contains a list of functions returning True(allowed)/False(forbiden)/None(unknown)

    +
    +
    +pyFAI.utils.int_(val)
    +

    Convert anything to an int ... or None if not applicable

    -
    -
    -set_type(lattice_type)
    -
    - -
    -
    -classmethod tetragonal(a, c, lattice_type='P')
    -

    Factory for tetragonal lattices

    +
    +
    +pyFAI.utils.is_far_from_group(pt, lst_pts, d2)
    +

    Tells if a point is far from a group of points, distance greater than d2 (distance squared)

    - + +
    Parameters:
      -
    • a – unit cell length
    • -
    • c – unit cell length
    • +
    Parameters:
      +
    • pt – point of interest
    • +
    • lst_pts – list of points
    • +
    • d2 – minimum distance squarred
    Returns:

    True If the point is far from all others.

    +
    -
    -
    -type
    -
    - -
    -
    -types = {'I': 'Body centered', 'P': 'Primitive', 'C': 'Side centered', 'R': 'Rhombohedral', 'F': 'Face centered'}
    -
    - -
    -
    -volume
    -
    - -
    -
    -
    -class pyFAI.calibrant.calibrant_factory(basedir=None)
    +
    +class pyFAI.utils.lazy_property(fget)

    Bases: object

    -

    Behaves like a dict but is actually a factory: -Each time one retrieves an object it is a new geniune new calibrant (unmodified)

    -
    -
    -get(what, notfound=None)
    -
    - -
    -
    -has_key(k)
    -
    - -
    -
    -items()
    -
    - -
    -
    -keys()
    -
    - +

    meant to be used for lazy evaluation of an object attribute. +property should represent non-mutable data, as it replaces itself.

    -
    -values()
    +
    +__init__(fget)
    -
    -
    -

    distortion Module

    -
    -
    -class pyFAI.distortion.Distortion(detector='detector', shape=None, resize=False, empty=0, mask=None, method='LUT', device=None, workgroup=8)
    -

    Bases: object

    -

    This class applies a distortion correction on an image.

    -

    New version compatible both with CSR and LUT...

    -
    -
    -calc_LUT(use_common=True)
    -

    Calculate the Look-up table

    +
    +
    +pyFAI.utils.maximum_position(img)
    +

    Same as scipy.ndimage.measurements.maximum_position: +Find the position of the maximum of the values of the array.

    - + + +
    Returns:look up table either in CSR or LUT format depending on serl.method
    Parameters:img – 2-D image
    Returns:2-tuple of int with the position of the maximum
    -
    -
    -calc_init()
    -

    Initialize all arrays

    -
    - -
    -
    -calc_pos(use_cython=True)
    -

    Calculate the pixel boundary position on the regular grid

    - --- - - - -
    Returns:pixel corner positions (in pixel units) on the regular grid
    -

    @rtyep: ndarray of shape (nrow, ncol, 4, 2)

    +
    +
    +pyFAI.utils.measure_offset(img1, img2, method='numpy', withLog=False, withCorr=False)
    +

    Measure the actual offset between 2 images +:param img1: ndarray, first image +:param img2: ndarray, second image, same shape as img1 +:param withLog: shall we return logs as well ? boolean +:return: tuple of floats with the offsets

    -
    -
    -calc_size(use_cython=True)
    -

    Calculate the number of pixels falling into every single bin and

    +
    +
    +pyFAI.utils.readFloatFromKeyboard(text, dictVar)
    +

    Read float from the keyboard ....

    - +
    Returns:max of pixel falling into a single bin
    Parameters:
      +
    • text – string to be displayed
    • +
    • dictVar – dict of this type: {1: [set_dist_min],3: [set_dist_min, set_dist_guess, set_dist_max]}
    • +
    +
    -

    Considering the “half-CCD” spline from ID11 which describes a (1025,2048) detector, -the physical location of pixels should go from: -[-17.48634 : 1027.0543, -22.768829 : 2028.3689] -We chose to discard pixels falling outside the [0:1025,0:2048] range with a lose of intensity

    -
    -
    -correct(image, dummy=None, delta_dummy=None)
    -

    Correct an image based on the look-up table calculated ...

    - +
    +
    +pyFAI.utils.read_cl_file(filename)
    +
    - + - +
    Parameters:
      -
    • image – 2D-array with the image
    • -
    • dummy – value suggested for bad pixels
    • -
    • delta_dummy – precision of the dummy value
    • -
    -
    Parameters:filename – read an OpenCL file and apply a preprocessor
    Returns:

    corrected 2D image

    -
    Returns:preprocessed source code
    -

    #TODO: #225

    -
    -
    -reset(method=None, device=None, workgroup=None, prepare=True)
    -

    reset the distortion correction and re-calculate the look-up table

    +
    +
    +pyFAI.utils.relabel(label, data, blured, max_size=None)
    +

    Relabel limits the number of region in the label array. +They are ranked relatively to their max(I0)-max(blur(I0)

    - + +
    Parameters:
      -
    • method – can be “lut” or “csr”, “lut” looks faster
    • -
    • device – can be None, “cpu” or “gpu” or the id as a 2-tuple of integer
    • -
    • worgroup – enforce the workgroup size for CSR.
    • -
    • prepare – set to false to only reset and not re-initialize
    • +
    Parameters:
      +
    • label – a label array coming out of scipy.ndimage.measurement.label
    • +
    • data – an array containing the raw data
    • +
    • blured – an array containing the blurred data
    • +
    • max_size – the max number of label wanted
    Returns:

    array like label

    +
    -
    -
    -shape_out
    -

    Calculate/cache the output shape

    -

    :return output shape

    -
    - -
    -
    -uncorrect(image)
    -

    Take an image which has been corrected and transform it into it’s raw (with loss of information)

    +
    +
    +pyFAI.utils.roundfft(N)
    +

    This function returns the integer >=N for which size the Fourier analysis is faster (fron the FFT point of view) +Credit: Alessandro Mirone, ESRF, 2012

    - + - +
    Parameters:image – 2D-array with the image
    Parameters:N – interger on which one would like to do a Fourier transform
    Returns:uncorrected 2D image and a mask (pixels in raw image
    Returns:integer with a better choice
    -
    - -
    -
    -class pyFAI.distortion.Quad(buffer)
    -

    Bases: object

    -
    -
    -
    -
    -

    -

    -
    -
    -
    xxxxxA
    -
    -
    xxxxxxxI’xxxxxxxx x
    -
    -
    -
    -

    xxxxxxxxIxxxxxx | x

    -
    -

    Bxxxxxxxxxxxx | | x -x | | x -x | | x

    -
    -

    x | | x -x | | x -x | | x -x | | x -x | | x

    -
    -
    x | | x -x | | x -x | | x -x O| P A’ x
    -
    -
    -
    -
    —————–J——————+——————————–L———————–
    -

    x | x -x | x -x | x

    -
    -

    x | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxD -CxxxxxxxxxxxxxxxxxKxxxxx

    -
    -
    -

    -

    -

    -

    -
    -
    -
    -
    -
    -
    -
    -calc_area()
    -
    - -
    -
    -calc_area_AB(I1, I2)
    -
    - -
    -
    -calc_area_BC(J1, J2)
    -
    - -
    -
    -calc_area_CD(K1, K2)
    -
    - -
    -
    -calc_area_DA(L1, L2)
    -
    - -
    -
    -calc_area_old()
    -
    - -
    -
    -calc_area_vectorial()
    -
    - -
    -
    -get_box(i, j)
    -
    - -
    -
    -get_box_size0()
    -
    - -
    -
    -get_box_size1()
    -
    - -
    -
    -get_idx(i, j)
    -
    - -
    -
    -get_offset0()
    -
    - -
    -
    -get_offset1()
    -
    - -
    -
    -init_slope()
    -
    - -
    -
    -integrateAB(start, stop, calc_area)
    -
    - -
    -
    -populate_box()
    -
    - -
    -
    -reinit(A0, A1, B0, B1, C0, C1, D0, D1)
    -
    - -
    -
    -
    -pyFAI.distortion.test()
    -
    - -
    -
    -

    worker Module

    -

    This module contains the Worker class:

    -

    A tool able to perform azimuthal integration with: -additional saving capabilities like -- save as 2/3D structure in a HDF5 File -- read from HDF5 files

    -

    Aims at being integrated into a plugin like LImA or as model for the GUI

    -

    The configuration of this class is mainly done via a dictionary transmitted as a JSON string: -Here are the valid keys:

    -
    -

    “dist”, -“poni1”, -“poni2”, -“rot1” -“rot3” -“rot2” -“pixel1” -“pixel2”

    -

    “splineFile” -“wavelength”

    -

    “poni” #path of the file

    -

    “chi_discontinuity_at_0” -“do_mask” -“do_dark” -“do_azimuthal_range” -“do_flat” -“do_2D” -“azimuth_range_min” -“azimuth_range_max”

    -

    “polarization_factor” -“nbpt_rad” -“do_solid_angle” -“do_radial_range” -“do_poisson” -“delta_dummy” -“nbpt_azim” -“flat_field” -“radial_range_min” -“dark_current” -“do_polarization” -“mask_file” -“detector” -“unit” -“radial_range_max” -“val_dummy” -“do_dummy” -“method”

    -
    -

    }

    -
    -
    -class pyFAI.worker.DistortionWorker(detector=None, dark=None, flat=None, solidangle=None, polarization=None, mask=None, dummy=None, delta_dummy=None, device=None)
    -

    Bases: object

    -

    Simple worker doing dark, flat, solid angle and polarization correction

    -
    -
    -process(data, normalization=None)
    -

    Process the data and apply a normalization factor -:param data: input data -:param normalization: normalization factor -:return processed data

    -
    - -
    - -
    -
    -class pyFAI.worker.PixelwiseWorker(dark=None, flat=None, solidangle=None, polarization=None, mask=None, dummy=None, delta_dummy=None, device=None)
    -

    Bases: object

    -

    Simple worker doing dark, flat, solid angle and polarization correction

    -
    -
    -process(data, normalization=None)
    -

    Process the data and apply a normalization factor -:param data: input data -:param normalization: normalization factor -:return processed data

    -
    - -
    - -
    -
    -class pyFAI.worker.Worker(azimuthalIntgrator=None, shapeIn=(2048, 2048), shapeOut=(360, 500), unit='r_mm', dummy=None, delta_dummy=None)
    -

    Bases: object

    -
    -
    -do_2D()
    -
    - -
    -
    -error_model
    -
    - -
    -
    -get_config()
    -

    return configuration as a dictionary

    +
    +pyFAI.utils.shift(input_img, shift_val)
    +

    Shift an array like scipy.ndimage.interpolation.shift(input_img, shift_val, mode=”wrap”, order=0) but faster +:param input_img: 2d numpy array +:param shift_val: 2-tuple of integers +:return: shifted image

    -
    -
    -get_error_model()
    -
    - -
    -
    -get_json_config()
    -

    return configuration as a JSON string

    +
    +
    +pyFAI.utils.shiftFFT(input_img, shift_val, method='fft')
    +

    Do shift using FFTs

    +

    Shift an array like scipy.ndimage.interpolation.shift(input, shift, mode=”wrap”, order=”infinity”) but faster +:param input_img: 2d numpy array +:param shift_val: 2-tuple of float +:return: shifted image

    -
    -
    -get_normalization_factor()
    -
    - -
    -
    -get_unit()
    -
    - -
    -
    -normalization_factor
    -
    +
    +
    +pyFAI.utils.str_(val)
    +

    Convert anything to a string ... but None -> “”

    +
    -
    -
    -process(data)
    -

    Process a frame -#TODO: -dark, flat, sa are missing

    - +
    +
    +pyFAI.utils.unBinning(binnedArray, binsize, norm=True)
    +
    - + + +
    Param:data: numpy array containing the input image
    Parameters:
      +
    • binnedArray – input ndarray
    • +
    • binsize – 2-tuple representing the size of the binning
    • +
    • norm – if True (default) decrease the intensity by binning factor. If False, it is non-conservative
    • +
    +
    Returns:

    unBinned input ndarray

    +
    +
    +
    +

    gui.gui_utils Module

    +

    Module providing gui util tools

    +
    +
    +class pyFAI.gui.utils.Event(width, height)
    +

    Bases: object

    +

    Dummy class for dummy things

    -
    -reconfig(shape=(2048, 2048), sync=False)
    -

    This is just to force the integrator to initialize with a given input image shape

    +
    +__init__(width, height)
    +
    + +
    + +
    +
    +pyFAI.gui.utils.maximize_fig(fig=None)
    +

    Try to set the figure fullscreen

    +
    + +
    +
    +pyFAI.gui.utils.update_fig(fig=None)
    +

    Update a matplotlib figure with a Qt4 backend

    - +
    Parameters:
      -
    • shape – shape of the input image
    • -
    • sync – return only when synchronized
    • -
    -
    Parameters:fig – pylab figure
    +
    +
    +

    ext.bilinear Module

    +

    This extension makes a discrete 2D-array appear like a continuous function thanks +to bilinear interpolations.

    +
    +
    +class pyFAI.ext.bilinear.Bilinear
    +

    Bases: object

    +

    Bilinear interpolator for finding max.

    +

    Instance attribute defined in pxd file

    -
    -reset()
    -

    this is just to force the integrator to initialize

    -
    - -
    -
    -save_config(filename=None)
    +
    +cp_local_maxi(self, size_t x) → size_t
    -
    -
    -setDarkcurrentFile(imagefile)
    +
    +
    +data
    -
    -setExtension(ext)
    -

    enforce the extension of the processed data file written

    +
    +f_cy(self, x)
    +

    Function f((y,x)) where f is a continuous function (y,x) are pixel coordinates +@param x: 2-tuple of float +@return: Interpolated signal from the image (negative for minimizer)

    -
    -
    -setFlatfieldFile(imagefile)
    -
    - -
    -
    -setJsonConfig(jsonconfig)
    +
    +
    +height
    -
    -setSubdir(path)
    -

    Set the relative or absolute path for processed data

    +
    +local_maxi(self, x)
    +

    Return the local maximum ... with sub-pixel refinement

    +

    @param x: 2-tuple of integers +@param w: half with of the window: 1 or 2 are advised +@return: 2-tuple of float with the nearest local maximum

    +

    Sub-pixel refinement: +Second order Taylor expansion of the function; first derivative is null +delta = x-i = -Inverse[Hessian].gradient

    +

    if Hessian is singular or |delta|>1: use a center of mass.

    -
    -
    -set_error_model(value)
    -
    - -
    -
    -set_normalization_factor(value)
    +
    +
    +maxi
    -
    -
    -set_unit(value)
    +
    +
    +mini
    -
    -unit
    +
    +width
    -
    -
    -warmup(sync=False)
    -

    Process a dummy image to ensure everything is initialized

    +
    + +
    +
    +pyFAI.ext.bilinear.calc_cartesian_positions
    +

    calc_cartesian_positions(signatures, args, kwargs, defaults)

    +

    Calculate the Cartesian position for array of position (d1, d2) +with pixel coordinated stored in array pos +This is bilinear interpolation

    - +
    Parameters:sync – wait for processing to be finished
    Parameters:
      +
    • d1 – position in dim1
    • +
    • d2 – position in dim2
    • +
    • pos – array with position of pixels corners
    • +
    +
    +

    :return 3-tuple of position.

    -
    - -
    -
    -pyFAI.worker.make_ai(config)
    -

    Create an Azimuthal integrator from the configuration -Static method !

    +
    +
    +pyFAI.ext.bilinear.convert_corner_2D_to_4D
    +

    convert_corner_2D_to_4D(signatures, args, kwargs, defaults)

    +

    Convert 2 (or 3) arrays of corner position into a 4D array of pixel corner coordinates

    - + - +
    Parameters:config – dict with all parameters
    Parameters:
      +
    • ndim – 2d or 3D output
    • +
    • d1 – 2D position in dim1 (shape +1)
    • +
    • d2 – 2D position in dim2 (shape +1)
    • +
    • d3 – 2D position in dim3 (z) (shape +1)
    • +
    +
    Returns:configured (but uninitialized) AzimuthalIntgrator
    Returns:

    pos 4D array with position of pixels corners

    +
    -
    -

    units Module

    -
    -
    -class pyFAI.units.Enum
    -

    Bases: dict

    -

    Simple class half way between a dict and a class, behaving as an enum

    -
    - +
    +

    ext._bispev Module

    +

    This extension is a re-implementation of bi-cubic spline evaluation from scipy

    +

    Spline evaluation function

    +

    Created on Nov 4, 2013

    +

    @author: zubair, Jerome Kieffer

    -
    -pyFAI.units.eq_2th(x, y, z, wavelength=None)
    -

    Calculates the 2theta aperture of the cone

    - --+
    +pyFAI.ext._bispev.bisplev(x, y, tck, dx=0, dy=0)
    +

    Evaluate a bivariate B-spline and its derivatives.

    +

    Return a rank-2 array of spline function values (or spline derivative +values) at points given by the cross-product of the rank-1 arrays x and +y. In special cases, return an array or just a float if either x or y or +both are floats. Based on BISPEV from FITPACK.

    +
    +
    x, y : ndarray
    +
    Rank-1 arrays specifying the domain over which to evaluate the +spline or its derivative.
    +
    tck : tuple
    +
    A sequence of length 5 returned by bisplrep containing the knot +locations, the coefficients, and the degree of the spline: +[tx, ty, c, kx, ky].
    +
    dx, dy : int, optional
    +
    The orders of the partial derivatives in x and y respectively. +This version does bot implement derivatives.
    +
    +
    +
    vals : ndarray
    +
    The B-spline or its derivative evaluated over the set formed by +the cross-product of x and y.
    +
    +

    splprep, splrep, splint, sproot, splev +UnivariateSpline, BivariateSpline

    +
    +
    See bisplrep to generate the tck representation.
    +
    + - - +
    Parameters:
      -
    • x – horizontal position, towards the center of the ring, from sample position
    • -
    • y – Vertical position, to the roof, from sample position
    • -
    • z – distance from sample along the beam
    • -
    • wavelength – in meter
    • -
    -
    [1]Dierckx P. : An algorithm for surface fitting +with spline functions +Ima J. Numer. Anal. 1 (1981) 267-283.
    -
    - -
    -
    -pyFAI.units.eq_logq(x, y, z, wavelength)
    -

    Calculates the log (decimal) of the scattering vector

    - --+
    + - - + + +
    Parameters:
      -
    • x – horizontal position, towards the center of the ring, from sample position
    • -
    • y – Vertical position, to the roof, from sample position
    • -
    • z – distance from sample along the beam
    • -
    • wavelength – in meter
    • -
    -
    [2]Dierckx P. : An algorithm for surface fitting +with spline functions +report tw50, Dept. Computer Science,K.U.Leuven, 1980.
    + + + +
    [3]Dierckx P. : Curve and surface fitting with splines, +Monographs on Numerical Analysis, Oxford University Press, 1993.
    +
    +
    +

    ext._blob Module

    +

    Blob detection is used to find peaks in images by performing subsequent blurs

    +

    Some Cythonized function for blob detection function

    -
    -pyFAI.units.eq_q(x, y, z, wavelength)
    -

    Calculates the modulus of the scattering vector

    +
    +pyFAI.ext._blob.local_max(__Pyx_memviewslice dogs, mask=None, bool n_5=False)
    +

    Calculate if a point is a maximum in a 3D space: (scale, y, x)

    - + +
    Parameters:
      -
    • x – horizontal position, towards the center of the ring, from sample position
    • -
    • y – Vertical position, to the roof, from sample position
    • -
    • z – distance from sample along the beam
    • -
    • wavelength – in meter
    • +
    Parameters:
      +
    • dogs – 3D array of difference of gaussian
    • +
    • mask – mask with invalid pixels
    • +
    • N_5 – take a neighborhood of 5x5 pixel in plane
    Returns:

    3d_array with 1 where is_max

    +
    +
    +
    +

    ext.container Module

    +

    Container are a new uniform storage, optimized for the creation of both LUT and CSR. +It has nothing to do with Docker.

    +
    +
    +

    ext._convolution Module

    +

    Convolutions in real space are used to blurs images, used in blob-detection algorithm

    +

    Implementation of a separable 2D convolution

    -
    -pyFAI.units.eq_r(x, y, z=None, wavelength=None)
    -

    Calculates the radius

    +
    +pyFAI.ext._convolution.gaussian(sigma, width=None)
    +

    Return a Gaussian window of length “width” with standard-deviation “sigma”.

    Parameters:
      -
    • x – horizontal position, towards the center of the ring, from sample position
    • -
    • y – Vertical position, to the roof, from sample position
    • -
    • z – distance from sample along the beam
    • -
    • wavelength – in meter
    • +
    • sigma – standard deviation sigma
    • +
    • width – length of the windows (int) By default 8*sigma+1,
    +

    Width should be odd.

    +

    The FWHM is 2*sqrt(2 * pi)*sigma

    -
    -pyFAI.units.eq_rd2(x, y, z, wavelength)
    -

    Calculates the reciprocal spacing squared

    +
    +pyFAI.ext._convolution.gaussian_filter(img, sigma)
    +

    Performs a gaussian bluring using a gaussian kernel.

    @@ -8282,49 +10840,21 @@

    worker<
    -
    -pyFAI.units.to_unit(obj, type_=(2th_deg, 2th_rad, q_nm^-1, q_A^-1, r_mm, r_m, d*2_A^-2, d*2_nm^-2, log(q)_m))
    -
    - - -
    -

    utils Module

    -

    Utilities, mainly for image treatment

    -
    -
    -class pyFAI.utils.FixedParameters
    -

    Bases: set

    -

    Like a set, made for FixedParameters in geometry refinement

    -
    -
    -add_or_discard(key, value=True)
    -

    Add a value to a set if value, else discard it -:param key: element to added or discared from set -:type value: boolean. If None do nothing ! -:return: None

    -
    - -
    - -
    -
    -pyFAI.utils.averageDark(lstimg, center_method='mean', cutoff=None, quantiles=(0.5, 0.5))
    -

    Averages a serie of dark (or flat) images. -Centers the result on the mean or the median ... -but averages all frames within cutoff*std

    +
    +pyFAI.ext._convolution.horizontal_convolution(__Pyx_memviewslice img, __Pyx_memviewslice filter)
    +

    Implements a 1D horizontal convolution with a filter. +The only implemented mode is “reflect” (default in scipy.ndimage.filter)

    Parameters:
      -
    • x – horizontal position, towards the center of the ring, from sample position
    • -
    • y – Vertical position, to the roof, from sample position
    • -
    • z – distance from sample along the beam
    • -
    • wavelength – in meter
    • +
    • img – input image
    • +
    • sigma – width parameter of the gaussian
    - @@ -8332,554 +10862,1121 @@

    worker<
    -
    -pyFAI.utils.averageImages(listImages, output=None, threshold=0.1, minimum=None, maximum=None, darks=None, flats=None, filter_='mean', correct_flat_from_dark=False, cutoff=None, quantiles=None, fformat='edf')
    -

    Takes a list of filenames and create an average frame discarding all saturated pixels.

    +
    +pyFAI.ext._convolution.vertical_convolution(__Pyx_memviewslice img, __Pyx_memviewslice filter)
    +

    Implements a 1D vertical convolution with a filter. +The only implemented mode is “reflect” (default in scipy.ndimage.filter)

    Parameters:
      -
    • lstimg – list of 2D images or a 3D stack
    • -
    • center_method – is the center calculated by a “mean” or a “median”, or “quantile”
    • -
    • cutoff – keep all data where (I-center)/std < cutoff
    • -
    • quantiles – 2-tuple of floats average out data between the two quantiles
    • +
    • img – input image
    • +
    • filter – 1D array with the coefficients of the array
    Returns:

    2D image averaged

    +
    Returns:

    array of the same shape as image with

    -
    Parameters:
      -
    • listImages – list of string representing the filenames
    • -
    • output – name of the optional output file
    • -
    • threshold – what is the upper limit? all pixel > max*(1-threshold) are discareded.
    • -
    • minimum – minimum valid value or True
    • -
    • maximum – maximum valid value
    • -
    • darks – list of dark current images for subtraction
    • -
    • flats – list of flat field images for division
    • -
    • filter – can be “min”, “max”, “median”, “mean”, “sum”, “quantiles” (default=’mean’)
    • -
    • correct_flat_from_dark – shall the flat be re-corrected ?
    • -
    • cutoff – keep all data where (I-center)/std < cutoff
    • -
    • quantiles – 2-tuple containing the lower and upper quantile (0<q<1) to average out.
    • -
    • fformat – file format of the output image, default: edf
    • +
    • img – input image
    • +
    • filter – 1D array with the coefficients of the array
    Returns:

    filename with the data or the data ndarray in case format=None

    +
    Returns:

    array of the same shape as image with

    -
    -
    -pyFAI.utils.binning(input_img, binsize, norm=True)
    +
    +
    +

    ext._distortion Module

    +

    Distortion correction are correction are applied by Look-up table (or CSR)

    +

    Common Look-Up table datatypes

    +
    +
    +class pyFAI.ext._distortion.Distortion(self, detector='detector', shape=None)
    +

    Bases: object

    +

    This class applies a distortion correction on an image.

    +

    It is also able to apply an inversion of the correction.

    +
    +
    +__init__(self, detector='detector', shape=None)
    - - - +
    Parameters:
      -
    • input_img – input ndarray
    • -
    • binsize – int or 2-tuple representing the size of the binning
    • -
    • norm – if False, do average instead of sum
    • -
    -
    Returns:

    binned input ndarray

    -
    Parameters:detector – detector instance or detector name
    -
    -
    -pyFAI.utils.boundingBox(img)
    -

    Tries to guess the bounding box around a valid massif

    +
    +
    +calc_LUT(self)
    +
    + +
    +
    +calc_LUT_size(self)
    +

    Considering the “half-CCD” spline from ID11 which describes a (1025,2048) detector, +the physical location of pixels should go from: +[-17.48634 : 1027.0543, -22.768829 : 2028.3689] +We chose to discard pixels falling outside the [0:1025,0:2048] range with a lose of intensity

    +

    We keep self.pos: pos_corners will not be compatible with systems showing non adjacent pixels (like some xpads)

    +
    + +
    +
    +calc_pos(self)
    +
    + +
    +
    +correct(self, image)
    +

    Correct an image based on the look-up table calculated ...

    - + - +
    Parameters:img – 2D array like
    Parameters:image – 2D-array with the image
    Returns:4-typle (d0_min, d1_min, d0_max, d1_max)
    Returns:corrected 2D image
    -
    -
    -pyFAI.utils.calc_checksum(ary, safe=True)
    -

    Calculate the checksum by default (or returns its buffer location if unsafe)

    -
    - -
    -
    -pyFAI.utils.center_of_mass(img)
    -

    Calculate the center of mass of of the array. -Like scipy.ndimage.measurements.center_of_mass -:param img: 2-D array -:return: 2-tuple of float with the center of mass

    -
    - -
    -
    -pyFAI.utils.concatenate_cl_kernel(filenames)
    -
    +
    +
    +uncorrect(self, image)
    +

    Take an image which has been corrected and transform it into it’s raw (with loss of information)

    +
    - + + +
    Parameters:filenames – filenames containing the kernels
    Parameters:image – 2D-array with the image
    Returns:uncorrected 2D image and a mask (pixels in raw image
    -

    this method concatenates all the kernel from the list

    -
    -
    -pyFAI.utils.convert_CamelCase(name)
    -

    convert a function name in CamelCase into camel_case

    -
    -pyFAI.utils.deg2rad(dd)
    -

    Convert degrees to radian in the range -pi->pi

    +
    +pyFAI.ext._distortion.calc_CSR(__Pyx_memviewslice pos, shape, bin_size, max_pixel_size, __Pyx_memviewslice mask=None)
    +

    Calculate the Look-up table as CSR format

    - + + +
    Parameters:dd – angle in degrees
    Parameters:
      +
    • pos – 4D position array
    • +
    • shape – output shape
    • +
    • bin_size – number of input element per output element (as numpy array)
    • +
    • max_pixel_size – (2-tuple of int) size of a buffer covering the largest pixel
    • +
    +
    Returns:

    look-up table in CSR format: 3-tuple of array

    +
    -

    Nota: depending on the platform it could be 0<2pi -A branch is cheaper than a trigo operation

    -
    - -
    -
    -pyFAI.utils.dog(s1, s2, shape=None)
    -

    2D difference of gaussian -typically 1 to 10 parameters

    -
    -pyFAI.utils.dog_filter(input_img, sigma1, sigma2, mode='reflect', cval=0.0)
    -

    2-dimensional Difference of Gaussian filter implemented with FFTw

    - +
    +pyFAI.ext._distortion.calc_LUT(__Pyx_memviewslice pos, shape, bin_size, max_pixel_size, __Pyx_memviewslice mask=None)
    +
    - + +
    Parameters:
      -
    • input_img (array-like) – input_img array to filter
    • -
    • sigma (scalar or sequence of scalars) – standard deviation for Gaussian kernel. -The standard deviations of the Gaussian filter are given for each axis as a sequence, -or as a single number, in which case it is equal for all axes.
    • -
    • mode – {‘reflect’,’constant’,’nearest’,’mirror’, ‘wrap’}, optional -The mode parameter determines how the array borders are -handled, where cval is the value when mode is equal to -‘constant’. Default is ‘reflect’
    • -
    • cval – scalar, optional -Value to fill past edges of input if mode is ‘constant’. Default is 0.0
    • +
    Parameters:
      +
    • pos – 4D position array
    • +
    • shape – output shape
    • +
    • bin_size – number of input element per output element (numpy array)
    • +
    • max_pixel_size – (2-tuple of int) size of a buffer covering the largest pixel
    • +
    • mask – arry with bad pixels marked as True
    Returns:

    look-up table

    +
    -
    -pyFAI.utils.expand(input_img, sigma, mode='constant', cval=0.0)
    -

    Expand array a with its reflection on boundaries

    +
    +pyFAI.ext._distortion.calc_area(float I1, float I2, float slope, float intercept) → float
    +

    Calculate the area between I1 and I2 of a line with a given slope & intercept

    +
    + +
    +
    +pyFAI.ext._distortion.calc_openmp(__Pyx_memviewslice pos, shape, max_pixel_size=(8, 8), __Pyx_memviewslice mask=None, format='csr', int bins_per_pixel=8)
    +

    Calculate the look-up table (or CSR) using OpenMP

    - + +
    Parameters:
      -
    • a – 2D array
    • -
    • sigma – float or 2-tuple of floats.
    • +
    Parameters:
      +
    • pos – 4D position array
    • +
    • shape – output shape
    • +
    • max_pixel_size – (2-tuple of int) size of a buffer covering the largest pixel
    • +
    • format – can be “CSR” or “LUT”
    • +
    • bins_per_pixel – average splitting factor (number of pixels per bin)
    Returns:

    look-up table in CSR/LUT format

    +
    -

    :param mode:”constant”, “nearest”, “reflect” or mirror -:param cval: filling value used for constant, 0.0 by default

    -

    Nota: sigma is the half-width of the kernel. For gaussian convolution it is adviced that it is 4*sigma_of_gaussian

    -
    -
    -pyFAI.utils.expand2d(vect, size2, vertical=True)
    -

    This expands a vector to a 2d-array.

    -

    The resul is the same as -if vertical:

    +
    +
    +pyFAI.ext._distortion.calc_pos
    +

    calc_pos(signatures, args, kwargs, defaults) +Calculate the pixel boundary position on the regular grid

    -
    numpy.outer(numpy.ones(size2), vect)
    -
    -
    else:
    -
    numpy.outer(vect, numpy.ones( size2))
    -
    -

    This is a ninja optimization: replace *1 with a memcopy, saves 50% of time at the ms level.

    - +
    - + + + + + + + + +
    Parameters:
      -
    • vect – 1d vector
    • -
    • size2 – size
    • -
    • vertical – if False,
    • -
    -
    param pixel_corners:
     pixel corner coordinate as detector.get_pixel_corner()
    param shape:requested output shape. If None, it is calculated
    param pixel1, pixel2:
     pixel size along row and column coordinates
    return:pos, delta1, delta2, shape_out, offset
    +
    -
    -
    -pyFAI.utils.expand_args(args)
    -

    Takes an argv and expand it (under Windows, cmd does not convert *.tif into a list of files. -Keeps only valid files (thanks to glob)

    - +
    +
    +pyFAI.ext._distortion.calc_size
    +

    calc_size(signatures, args, kwargs, defaults) +Calculate the number of items per output pixel

    +
    +
    - + - + + + + + + +
    Parameters:args – list of files or wilcards
    param pos:4D array with position in space
    Returns:list of actual args
    param shape:shape of the output array
    param mask:input data mask
    param offset:2-tuple of float with the minimal index of
    return:number of input element per output elements
    +
    -
    -pyFAI.utils.float_(val)
    -

    Convert anything to a float ... or None if not applicable

    +
    +pyFAI.ext._distortion.clip(int value, int min_val, int max_val) → int
    +

    Limits the value to bounds

    -
    -pyFAI.utils.gaussian(M, std)
    -

    Return a Gaussian window of length M with standard-deviation std.

    -

    This differs from the scipy.signal.gaussian implementation as: -- The default for sym=False (needed for gaussian filtering without shift) -- This implementation is normalized

    +
    +pyFAI.ext._distortion.correct_CSR(image, shape_in, shape_out, LUT, dummy=None, delta_dummy=None)
    +

    Correct an image based on the look-up table calculated ...

    - + +
    Parameters:
      -
    • M – length of the windows (int)
    • -
    • std – standatd deviation sigma
    • +
    Parameters:
      +
    • image – 2D-array with the image
    • +
    • shape_in – shape of input image
    • +
    • shape_out – shape of output image
    • +
    • LUT – Look up table, here a 3-tuple array of ndarray
    • +
    • dummy – value for invalid pixels
    • +
    • delta_dummy – precision for invalid pixels
    Returns:

    corrected 2D image

    +
    -

    The FWHM is 2*numpy.sqrt(2 * numpy.pi)*std

    -
    -pyFAI.utils.gaussian_filter(input_img, sigma, mode='reflect', cval=0.0)
    -

    2-dimensional Gaussian filter implemented with FFTw

    +
    +pyFAI.ext._distortion.correct_LUT(image, shape_in, shape_out, __Pyx_memviewslice LUT, dummy=None, delta_dummy=None)
    +

    Correct an image based on the look-up table calculated ...

    - + +
    Parameters:
      -
    • input_img (array-like) – input array to filter
    • -
    • sigma (scalar or sequence of scalars) – standard deviation for Gaussian kernel. -The standard deviations of the Gaussian filter are given for each axis as a sequence, -or as a single number, in which case it is equal for all axes.
    • -
    • mode – {‘reflect’,’constant’,’nearest’,’mirror’, ‘wrap’}, optional -The mode parameter determines how the array borders are -handled, where cval is the value when mode is equal to -‘constant’. Default is ‘reflect’
    • -
    • cval – scalar, optional -Value to fill past edges of input if mode is ‘constant’. Default is 0.0
    • +
    Parameters:
      +
    • image – 2D-array with the image
    • +
    • shape_in – shape of input image
    • +
    • shape_out – shape of output image
    • +
    • LUT – Look up table, here a 2D-array of struct
    • +
    • dummy – value for invalid pixels
    • +
    • delta_dummy – precision for invalid pixels
    Returns:

    corrected 2D image

    +
    -
    -pyFAI.utils.get_calibration_dir()
    -

    get the full path of a calibration directory

    +
    +pyFAI.ext._distortion.uncorrect_CSR(image, shape, LUT)
    +

    Take an image which has been corrected and transform it into it’s raw (with loss of information)

    - + + +
    Returns:the full path of the calibrant file
    Parameters:
      +
    • image – 2D-array with the image
    • +
    • shape – shape of output image
    • +
    • LUT – Look up table, here a 3-tuple of ndarray
    • +
    +
    Returns:

    uncorrected 2D image and a mask (pixels in raw image not existing)

    +
    -
    -pyFAI.utils.get_cl_file(filename)
    -

    get the full path of a openCL file

    +
    +pyFAI.ext._distortion.uncorrect_LUT(image, shape, __Pyx_memviewslice LUT)
    +

    Take an image which has been corrected and transform it into it’s raw (with loss of information)

    - + + +
    Returns:the full path of the openCL source file
    Parameters:
      +
    • image – 2D-array with the image
    • +
    • shape – shape of output image
    • +
    • LUT – Look up table, here a 2D-array of struct
    • +
    +
    Returns:

    uncorrected 2D image and a mask (pixels in raw image not existing)

    +
    -
    -
    -pyFAI.utils.get_ui_file(filename)
    -

    get the full path of a user-interface file

    +
    +
    +

    ext._geometry Module

    +

    This extension is a fast-implementation for calculating the geometry, i.e. where +every pixel of an array stays in space (x,y,z) or its (r, chi) coordinates.

    +
    +
    +pyFAI.ext._geometry.calc_chi(double L, double rot1, double rot2, double rot3, ndarray pos1, ndarray pos2, ndarray pos3=None)
    +

    Calculate the chi array (azimuthal angles) using OpenMP

    +

    X1 = p1*cos(rot2)*cos(rot3) + p2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) - L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) +X2 = p1*cos(rot2)*sin(rot3) - L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + p2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) +X3 = -(L*cos(rot1)*cos(rot2)) + p2*cos(rot2)*sin(rot1) - p1*sin(rot2) +tan(Chi) = X2 / X1

    - + + +
    Returns:the full path of the ui
    Parameters:
      +
    • L – distance sample - PONI
    • +
    • rot1 – angle1
    • +
    • rot2 – angle2
    • +
    • rot3 – angle3
    • +
    • pos1 – numpy array with distances in meter along dim1 from PONI (Y)
    • +
    • pos2 – numpy array with distances in meter along dim2 from PONI (X)
    • +
    • pos3 – numpy array with distances in meter along Sample->PONI (Z), positive behind the detector
    • +
    +
    Returns:

    ndarray of double with same shape and size as pos1

    +
    -
    -pyFAI.utils.int_(val)
    -

    Convert anything to an int ... or None if not applicable

    -
    - -
    -
    -pyFAI.utils.is_far_from_group(pt, lst_pts, d2)
    -

    Tells if a point is far from a group of points, distance greater than d2 (distance squared)

    +
    +pyFAI.ext._geometry.calc_cosa(double L, ndarray pos1, ndarray pos2, ndarray pos3=None)
    +

    Calculate the cosine of the incidence angle using OpenMP. +Used for sensors thickness effect corrections

    -
    Parameters:
      -
    • pt – point of interest
    • -
    • lst_pts – list of points
    • -
    • d2 – minimum distance squarred
    • +
    • L – distance sample - PONI
    • +
    • pos1 – numpy array with distances in meter along dim1 from PONI (Y)
    • +
    • pos2 – numpy array with distances in meter along dim2 from PONI (X)
    • +
    • pos3 – numpy array with distances in meter along Sample->PONI (Z), positive behind the detector
    Returns:

    True If the point is far from all others.

    +
    Returns:

    ndarray of double with same shape and size as pos1

    -
    -
    -class pyFAI.utils.lazy_property(fget)
    -

    Bases: object

    -

    meant to be used for lazy evaluation of an object attribute. -property should represent non-mutable data, as it replaces itself.

    -
    -
    -
    -pyFAI.utils.maximum_position(img)
    -

    Same as scipy.ndimage.measurements.maximum_position: -Find the position of the maximum of the values of the array.

    +
    +pyFAI.ext._geometry.calc_pos_zyx(double L, double poni1, double poni2, double rot1, double rot2, double rot3, ndarray pos1, ndarray pos2, ndarray pos3=None)
    +

    Calculate the 3D coordinates in the sample’s referential

    - + - +
    Parameters:img – 2-D image
    Parameters:
      +
    • L – distance sample - PONI
    • +
    • poni1 – PONI coordinate along y axis
    • +
    • poni2 – PONI coordinate along x axis
    • +
    • rot1 – angle1
    • +
    • rot2 – angle2
    • +
    • rot3 – angle3
    • +
    • pos1 – numpy array with distances in meter along dim1 from PONI (Y)
    • +
    • pos2 – numpy array with distances in meter along dim2 from PONI (X)
    • +
    • pos3 – numpy array with distances in meter along Sample->PONI (Z), positive behind the detector
    • +
    +
    Returns:2-tuple of int with the position of the maximum
    Returns:

    3-tuple of ndarray of double with same shape and size as pos1

    +
    -
    -pyFAI.utils.measure_offset(img1, img2, method='numpy', withLog=False, withCorr=False)
    -

    Measure the actual offset between 2 images -:param img1: ndarray, first image -:param img2: ndarray, second image, same shape as img1 -:param withLog: shall we return logs as well ? boolean -:return: tuple of floats with the offsets

    +
    +pyFAI.ext._geometry.calc_q(double L, double rot1, double rot2, double rot3, ndarray pos1, ndarray pos2, double wavelength, pos3=None)
    +

    Calculate the q (scattering vector) array using OpenMP

    +

    X1 = p1*cos(rot2)*cos(rot3) + p2*(cos(rot3)*sin(rot1)*sin(rot2) - cos(rot1)*sin(rot3)) - L*(cos(rot1)*cos(rot3)*sin(rot2) + sin(rot1)*sin(rot3)) +X2 = p1*cos(rot2)*sin(rot3) - L*(-(cos(rot3)*sin(rot1)) + cos(rot1)*sin(rot2)*sin(rot3)) + p2*(cos(rot1)*cos(rot3) + sin(rot1)*sin(rot2)*sin(rot3)) +X3 = -(L*cos(rot1)*cos(rot2)) + p2*cos(rot2)*sin(rot1) - p1*sin(rot2) +tan(Chi) = X2 / X1

    + +++ + + + + + +
    Parameters:
      +
    • L – distance sample - PONI
    • +
    • rot1 – angle1
    • +
    • rot2 – angle2
    • +
    • rot3 – angle3
    • +
    • pos1 – numpy array with distances in meter along dim1 from PONI (Y)
    • +
    • pos2 – numpy array with distances in meter along dim2 from PONI (X)
    • +
    • pos3 – numpy array with distances in meter along Sample->PONI (Z), positive behind the detector
    • +
    • wavelength – in meter to get q in nm-1
    • +
    +
    Returns:

    ndarray of double with same shape and size as pos1

    +
    -
    -pyFAI.utils.readFloatFromKeyboard(text, dictVar)
    -

    Read float from the keyboard ....

    +
    +pyFAI.ext._geometry.calc_r(double L, double rot1, double rot2, double rot3, ndarray pos1, ndarray pos2, ndarray pos3=None)
    +

    Calculate the radius array (radial direction) in parallel

    - + +
    Parameters:
      -
    • text – string to be displayed
    • -
    • dictVar – dict of this type: {1: [set_dist_min],3: [set_dist_min, set_dist_guess, set_dist_max]}
    • +
    Parameters:
      +
    • L – distance sample - PONI
    • +
    • rot1 – angle1
    • +
    • rot2 – angle2
    • +
    • rot3 – angle3
    • +
    • pos1 – numpy array with distances in meter along dim1 from PONI (Y)
    • +
    • pos2 – numpy array with distances in meter along dim2 from PONI (X)
    • +
    • pos3 – numpy array with distances in meter along Sample->PONI (Z), positive behind the detector
    Returns:

    ndarray of double with same shape and size as pos1

    +
    -
    -pyFAI.utils.read_cl_file(filename)
    -
    +
    +pyFAI.ext._geometry.calc_rad_azim(double L, double poni1, double poni2, double rot1, double rot2, double rot3, ndarray pos1, ndarray pos2, ndarray pos3=None, space='2th', wavelength=None)
    +

    Calculate the radial & azimutal position for each pixel from pos1, pos2, pos3.

    +
    - + - + + +
    Parameters:filename – read an OpenCL file and apply a preprocessor
    Parameters:
      +
    • L – distance sample - PONI
    • +
    • poni1 – PONI coordinate along y axis
    • +
    • poni2 – PONI coordinate along x axis
    • +
    • rot1 – angle1
    • +
    • rot2 – angle2
    • +
    • rot3 – angle3
    • +
    • pos1 – numpy array with distances in meter along dim1 from PONI (Y)
    • +
    • pos2 – numpy array with distances in meter along dim2 from PONI (X)
    • +
    • pos3 – numpy array with distances in meter along Sample->PONI (Z), positive behind the detector
    • +
    • space – can be “2th”, “q” or “r” for radial units. Azimuthal units are radians
    • +
    +
    Returns:preprocessed source code
    Returns:

    ndarray of double with same shape and size as pos1 + (2,),

    +
    Raise:

    KeyError when space is bad ! +ValueError when wavelength is missing

    +
    -
    -pyFAI.utils.relabel(label, data, blured, max_size=None)
    -

    Relabel limits the number of region in the label array. -They are ranked relatively to their max(I0)-max(blur(I0)

    +
    +pyFAI.ext._geometry.calc_tth(double L, double rot1, double rot2, double rot3, ndarray pos1, ndarray pos2, ndarray pos3=None)
    +

    Calculate the 2theta array (radial angle) in parallel

    - + +
    Parameters:
      -
    • label – a label array coming out of scipy.ndimage.measurement.label
    • -
    • data – an array containing the raw data
    • -
    • blured – an array containing the blured data
    • -
    • max_size – the max number of label wanted
    • +
    Parameters:
      +
    • L – distance sample - PONI
    • +
    • rot1 – angle1
    • +
    • rot2 – angle2
    • +
    • rot3 – angle3
    • +
    • pos1 – numpy array with distances in meter along dim1 from PONI (Y)
    • +
    • pos2 – numpy array with distances in meter along dim2 from PONI (X)
    • +
    • pos3 – numpy array with distances in meter along Sample->PONI (Z), positive behind the detector
    Returns:

    ndarray of double with same shape and size as pos1

    +
    -

    :return array like label

    +
    + +
    +
    +

    ext.histogram Module

    +

    Re-implementation of the numpy.histogram, optimized for azimuthal integration. +Deprecated, will be replaced by silx.math.histogramnd

    +

    Re-implementation of numpy histograms using OpenMP

    +
    +
    +pyFAI.ext.histogram.histogram(ndarray pos, ndarray weights, int bins=100, bin_range=None, pixelSize_in_Pos=None, nthread=None, double empty=0.0, double normalization_factor=1.0)
    +

    Calculates histogram of pos weighted by weights

    +

    @param pos: 2Theta array +@param weights: array with intensities +@param bins: number of output bins +@param pixelSize_in_Pos: size of a pixels in 2theta: DESACTIVATED +@param nthread: OpenMP is disabled. unused +@param empty: value given to empty bins +@param normalization_factor: divide the result by this value

    +

    @return 2theta, I, weighted histogram, raw histogram

    +
    + +
    +
    +pyFAI.ext.histogram.histogram2d(ndarray pos0, ndarray pos1, bins, ndarray weights, split=False, nthread=None, double empty=0.0, double normalization_factor=1.0)
    +

    Calculate 2D histogram of pos0,pos1 weighted by weights

    +

    @param pos0: 2Theta array +@param pos1: Chi array +@param weights: array with intensities +@param bins: number of output bins int or 2-tuple of int +@param split: pixel splitting is disabled in histogram +@param nthread: maximum number of thread to use. By default: maximum available. +@param empty: value given to empty bins +@param normalization_factor: divide the result by this value

    +

    @return I, edges0, edges1, weighted histogram(2D), unweighted histogram (2D)

    +

    One can also limit this with OMP_NUM_THREADS environment variable

    +
    + +
    +
    +

    ext.marchingsquares Module

    +

    The marchingsquares algorithm is used for calculating an iso-contour curve (displayed +on the screen while calibrating) but also to seed the points for the “massif” algoritm +during recalib.

    +

    Cythonized version of the marching square function for “isocontour” plot

    +
    +
    +pyFAI.ext.marchingsquares.isocontour(img, isovalue=None, sorted=False)
    +

    isocontour(img, isovalue=None)

    +

    Calculate the iso contours for the given 2D image. If isovalue +is not given or None, a value between the min and max of the image +is used.

    +

    @param img: 2D array representing the image +@param isovalue: the value for which the iso_contour shall be calculated +@param sorted: perform a sorting of the points to have them contiguous ?

    +

    Returns a pointset in which each two subsequent points form a line +piece. This van be best visualized using “vv.plot(result, ls=’+’)”.

    +
    + +
    +
    +pyFAI.ext.marchingsquares.marching_squares(__Pyx_memviewslice img, double isovalue, __Pyx_memviewslice cellToEdge, __Pyx_memviewslice edgeToRelativePosX, __Pyx_memviewslice edgeToRelativePosY)
    +
    + +
    +
    +pyFAI.ext.marchingsquares.sort_edges(edges)
    +

    Reorder edges in such a way they become contiguous

    +
    + +
    +
    +

    ext.morphology Module

    +

    The morphology extension provides a couple of binary morphology operations on images. +They are also implemented in scipy.ndimage in the general case, but not as fast.

    +

    A few binary morphology operation

    +
    +
    +pyFAI.ext.morphology.binary_dilation(__Pyx_memviewslice image, float radius=1.0)
    +

    Return fast binary morphological dilation of an image.

    +

    Morphological dilation sets a pixel at (i,j) to the maximum over all pixels in the neighborhood centered at (i,j). +Dilation enlarges bright regions and shrinks dark regions.

    +

    :param image : ndarray +:param radius: float +:return: ndiamge

    -
    -pyFAI.utils.removeSaturatedPixel(ds, threshold=0.1, minimum=None, maximum=None)
    -
    +
    +pyFAI.ext.morphology.binary_erosion(__Pyx_memviewslice image, float radius=1.0)
    +

    Return fast binary morphological erosion of an image.

    +

    Morphological erosion sets a pixel at (i,j) to the minimum over all pixels +in the neighborhood centered at (i,j). +Erosion shrinks bright regions and enlarges dark regions.

    +

    :param image : ndarray +:param radius: float +:return: ndiamge

    +
    + + +
    +

    ext.reconstruct Module

    +

    Very simple inpainting module for reconstructing the missing part of an image (masked) +to be able to use more common algorithms.

    +

    Cython module to reconstruct the masked values of an image

    +
    +
    +pyFAI.ext.reconstruct.reconstruct(ndarray data, ndarray mask=None, dummy=None, delta_dummy=None)
    +

    reconstruct missing part of an image (tries to be continuous)

    +
    -
    Parameters:
      -
    • ds – a dataset as ndarray
    • -
    • threshold – what is the upper limit? all pixel > max*(1-threshold) are discareded.
    • -
    • minimum – minumum valid value (or True for auto-guess)
    • -
    • maximum – maximum valid value
    • +
    • data – the input image
    • +
    • mask – where data should be reconstructed.
    • +
    • dummy – value of the dummy (masked out) data
    • +
    • delta_dummy – precision for dummy values
    Returns:

    another dataset

    +
    Returns:

    reconstructed image.

    +
    +
    +

    ext.relabel Module

    +

    Relabel regions, used to flag from largest regions to the smallest

    +

    A module to relabel regions

    -
    -pyFAI.utils.roundfft(N)
    -

    This function returns the integer >=N for which size the Fourier analysis is faster (fron the FFT point of view) -Credit: Alessandro Mirone, ESRF, 2012

    +
    +pyFAI.ext.relabel.countThem(ndarray label, ndarray data, ndarray blured)
    +

    Count +:param label: 2D array containing labeled zones +:param data: 2D array containing the raw data +:param blured: 2D array containing the blured data +:return: 2D arrays containing:

    +
    +
      +
    • count pixels in labelled zone: label == index).sum()
    • +
    • max of data in that zone: data[label == index].max()
    • +
    • max of blured in that zone: blured[label == index].max()
    • +
    • data-blured where data is max.
    • +
    +
    +
    + +
    +
    +

    ext.preproc Module

    +

    Contains a preprocessing function in charge of the dark-current subtraction, +flat-field normalization, ... taking care of masked values and normalization.

    +
    +
    +pyFAI.ext.preproc.preproc(data, dark=None, flat=None, solidangle=None, polarization=None, absorption=None, mask=None, dummy=None, delta_dummy=None, float normalization_factor=1.0, empty=None)
    +

    Common preprocessing step for all

    - - - +
    Parameters:N – interger on which one would like to do a Fourier transform
    Returns:integer with a better choice
    Parameters:
      +
    • data – raw value, as a numpy array, 1D or 2D
    • +
    • mask – array non null where data should be ignored
    • +
    • dummy – value of invalid data
    • +
    • delta_dummy – precision for invalid data
    • +
    • dark – array containing the value of the dark noise, to be subtracted
    • +
    • flat – Array containing the flatfield image. It is also checked for dummies if relevant.
    • +
    • solidangle – the value of the solid_angle. This processing may be performed during the rebinning instead. left for compatibility
    • +
    • polarization – Correction for polarization of the incident beam
    • +
    • absorption – Correction for absorption in the sensor volume
    • +
    • normalization_factor – final value is divided by this
    • +
    • empty – value to be given for empty bins
    • +
    +
    +

    All calculation are performed in single precision floating point.

    +

    NaN are always considered as invalid

    +

    if neither empty nor dummy is provided, empty pixels are 0

    -
    -
    -pyFAI.utils.shift(input_img, shift_val)
    -

    Shift an array like scipy.ndimage.interpolation.shift(input_img, shift_val, mode=”wrap”, order=0) but faster -:param input_img: 2d numpy array -:param shift_val: 2-tuple of integers -:return: shifted image

    +
    +
    +

    ext._tree Module

    +

    The tree is used in file hierarchy tree for the diff_map graphical user interface.

    +
    +
    +class pyFAI.ext._tree.TreeItem
    +

    Bases: object

    +

    TreeItem(str label=None, TreeItem parent=None)

    +

    Node of a tree ...

    +

    Each node contains:

    +
    +
      +
    • children: list
    • +
    • parent: TreeItem parent
    • +
    • label: str
    • +
    • order: int
    • +
    • type: str can be “dir”, “file”, “group” or “dataset”
    • +
    • extra: any object
    • +
    +
    +
    +
    +__init__
    +

    x.__init__(...) initializes x; see help(type(x)) for signature

    -
    -
    -pyFAI.utils.shiftFFT(input_img, shift_val, method='fftw')
    -

    Do shift using FFTs -Shift an array like scipy.ndimage.interpolation.shift(input, shift, mode=”wrap”, order=”infinity”) but faster -:param input_img: 2d numpy array -:param shift_val: 2-tuple of float -:return: shifted image

    +
    +
    +add_child(self, TreeItem child)
    +
    + +
    +
    +children
    +

    children: list

    -
    -
    -pyFAI.utils.str_(val)
    -

    Convert anything to a string ... but None -> “”

    +
    +
    +extra
    +

    extra: object

    -
    -
    -pyFAI.utils.unBinning(binnedArray, binsize, norm=True)
    +
    +
    +first(self) → TreeItem
    +
    + +
    +
    +get(self, str label) → TreeItem
    +
    + +
    +
    +has_child(self, str label) → bool
    +
    + +
    +
    +label
    +

    label: str

    +
    + +
    +
    +last(self) → TreeItem
    +
    + +
    +
    +name
    +
    + +
    +
    +next(self) → TreeItem
    +
    + +
    +
    +order
    +

    order: ‘int’

    +
    + +
    +
    +parent
    +

    parent: pyFAI.ext._tree.TreeItem

    +
    + +
    +
    +previous(self) → TreeItem
    +
    + +
    +
    +size
    +
    + +
    +
    +sort(self)
    +
    + +
    +
    +type
    +

    type: str

    +
    + +
    +
    +update(self, TreeItem new_root)
    +

    Add new children in tree

    +
    + +
    + +
    +
    +

    ext.watershed Module

    +

    Peak peaking via inverse watershed for connecting region of high intensity

    +

    Inverse watershed for connecting region of high intensity

    +
    +
    +class pyFAI.ext.watershed.Bilinear
    +

    Bases: object

    +

    Bilinear interpolator for finding max.

    +

    Instance attribute defined in pxd file

    +
    +
    +cp_local_maxi(self, size_t x) → size_t
    +
    + +
    +
    +data
    +
    + +
    +
    +f_cy(self, x)
    +

    Function f((y,x)) where f is a continuous function (y,x) are pixel coordinates +@param x: 2-tuple of float +@return: Interpolated signal from the image (negative for minimizer)

    +
    + +
    +
    +height
    +
    + +
    +
    +local_maxi(self, x)
    +

    Return the local maximum ... with sub-pixel refinement

    +

    @param x: 2-tuple of integers +@param w: half with of the window: 1 or 2 are advised +@return: 2-tuple of float with the nearest local maximum

    +

    Sub-pixel refinement: +Second order Taylor expansion of the function; first derivative is null +delta = x-i = -Inverse[Hessian].gradient

    +

    if Hessian is singular or |delta|>1: use a center of mass.

    +
    + +
    +
    +maxi
    +
    + +
    +
    +mini
    +
    + +
    +
    +width
    +
    + +
    + +
    +
    +class pyFAI.ext.watershed.InverseWatershed(self, data, thres=1.0)
    +

    Bases: object

    +

    Idea:

    +
      +
    • label all peaks
    • +
    • define region around those peaks which raise always to this peak
    • +
    • define the border of such region
    • +
    • search for the pass between two peaks
    • +
    • merge region with high pass between them
    • +
    +
    +
    +NAME = 'Inverse watershed'
    +
    + +
    +
    +VERSION = '1.0'
    +
    + +
    +
    +__init__(self, data, thres=1.0)
    - - - +
    Parameters:
      -
    • binnedArray – input ndarray
    • -
    • binsize – 2-tuple representing the size of the binning
    • -
    • norm – if True (default) decrease the intensity by binning factor. If False, it is non-conservative
    • -
    -
    Returns:

    unBinned input ndarray

    -
    Parameters:data – 2d image as numpy array
    -
    -
    -

    gui_utils Module

    -

    gui_utils

    -

    Module to handle matplotlib and the Qt backend

    -
    -
    -class pyFAI.gui_utils.Event(width, height)
    -

    Bases: object

    -

    Dummy class for dummy things

    +
    +
    +init(self)
    +
    + +
    +
    +init_borders(self)
    +
    + +
    +
    +init_labels(self)
    +
    + +
    +
    +init_pass(self)
    +
    + +
    +
    +init_regions(self)
    +
    + +
    +
    +classmethod load(cls, fname)
    +

    Load data from a HDF5 file

    -
    -
    -pyFAI.gui_utils.maximize_fig(fig=None)
    -

    Try to set the figure fullscreen

    +
    +
    +merge_intense(self, thres=1.0)
    +

    Merge groups then (pass-mini)/(maxi-mini) >=thres

    -
    -
    -pyFAI.gui_utils.update_fig(fig=None)
    -

    Update a matplotlib figure with a Qt4 backend

    - +
    +
    +merge_singleton(self)
    +

    merge single pixel region

    +
    + +
    +
    +merge_twins(self)
    +

    Twins are two peak region which are best linked together: +A -> B and B -> A

    +
    + +
    +
    +peaks_from_area(self, mask, Imin=None, keep=None, bool refine=True, float dmin=0.0, **kwarg)
    +
    - +
    Parameters:fig – pylab figure
    Parameters:
      +
    • mask – mask of data points valid
    • +
    • Imin – Minimum intensity for a peak
    • +
    • keep – Number of points to keep
    • +
    • refine – refine sub-pixel position
    • +
    • dmin – minimum distance from
    • +
    +
    +
    +
    +save(self, fname)
    +

    Save all regions into a HDF5 file

    +
    + +
    + +
    +
    +class pyFAI.ext.watershed.Region
    +

    Bases: object

    +
    +
    +border
    +
    + +
    +
    +get_borders(self)
    +
    + +
    +
    +get_highest_pass(self)
    +
    + +
    +
    +get_index(self)
    +
    + +
    +
    +get_maxi(self)
    +
    + +
    +
    +get_mini(self)
    +
    + +
    +
    +get_neighbors(self)
    +
    + +
    +
    +get_pass_to(self)
    +
    + +
    +
    +get_size(self)
    +
    + +
    +
    +highest_pass
    +
    + +
    +
    +index
    +
    + +
    +
    +init_values(self, __Pyx_memviewslice flat)
    +

    Initialize the values : maxi, mini and pass both height and so on +:param flat: flat view on the data (intensity) +:return: True if there is a problem and the region should be removed

    +
    + +
    +
    +maxi
    +
    + +
    +
    +merge(self, Region other)
    +

    merge 2 regions

    +
    + +
    +
    +mini
    +
    + +
    +
    +neighbors
    +
    + +
    +
    +pass_to
    +
    + +
    +
    +peaks
    +
    + +
    +
    +size
    +
    + +
    +
    @@ -8891,7 +11988,9 @@

    worker<

    Table Of Contents

    Previous topic

    @@ -8959,7 +12072,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • pyFAI API »
  • diff --git a/doc/build/biblio.html b/doc/build/biblio.html index c4b8ed2cc..83a828efb 100644 --- a/doc/build/biblio.html +++ b/doc/build/biblio.html @@ -6,7 +6,7 @@ - <no title> — pyFAI 0.12.0 documentation + Bibliography — pyFAI 0.13.0 documentation @@ -14,7 +14,7 @@ - + @@ -40,7 +40,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • @@ -49,7 +49,9 @@

    Navigation

    - +
    +

    Bibliography

    +
    [SRI2012]PyFAI, a versatile library for azimuthal regrouping @@ -200,6 +202,7 @@

    Navigation

    http://dx.doi.org/10.1107/S1600576714019773
    +
    @@ -244,7 +247,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • @@ -63,8 +63,8 @@

    Navigation

    normal incidence) which is subsequently used for processing the experiment.

    The program pyFAI-calib is used for calibrating the experimental setup using a constrained least squares optimization on -the Debye-Scherrer rings of a reference sample (\(LaB_6\), \(CeO_2\), silver -behenate \(AgBh\), …) and saves the results into a .poni file. +the Debye-Scherrer rings of a reference sample (LaB_6, CeO_2, silver +behenate AgBh, …) and saves the results into a .poni file. Alternatively, geometries calibrated using Fit2D can be imported into pyFAI, including geometric distortions (i.e. optical-fiber tapers distortion) described as spline-files. @@ -75,9 +75,10 @@

    Navigation

    While entering the geometry of the experiment in a poni-file is possible, it is easier to perform a calibration, using the Debye-Sherrer rings of a reference sample called calibrant. -About 30 calibrants are provided by pyFAI like \(LaB_6\), ceria \(CeO_2\), +About 30 calibrants are provided by pyFAI like LaB_6, ceria CeO_2, silicon, corrundum or silver behenate. -Among other simple compound, all of the NIST Standard Reference Materials +Among other simple compound, all of the NIST +Standard Reference Materials have been are tabulated and are directly available as calibrant. One can alternatively provide its own calibrant description files which is a simple text-file containing the largest d-spacing (in Angstrom) for a set of @@ -88,16 +89,29 @@

    Navigation

    Pre-processing of images:

    The typical pre-processing consists of the averaging (or better median filtering) of darks images. -Dark current images are then subtracted from data and corrected for flat.

    +Dark current images are then subtracted from data and corrected for flat. +The pre-processing is best performed using the pyFAI-average tool, which documentation +is available in the pyFAI scripts manual.

    If saturated pixels exists, the are likely to be treated like peaks but their positions will be wrong. It is advised to either mask them out or to desaturate them (pyFAI provides an option, -but it is expensive in calculation time).

    +but it is expensive in calculation time). +A Mask drawing tool, called pyFAI-drawmask, is installed together with pyFAI and +its documentation available in the pyFAI scripts manual.

    +

    To start the calibration the pyFAI-calib tool will need:

    +
      +
    • an image with Debye-Sherrer rings
    • +
    • the energy or the wavelength
    • +
    • the calibrant name or the d-spacing file of the calibrant
    • +
    • the detector description.
    • +

    Peak-picking

    -

    The Peak-picking consists in the identification of peaks and groups of peaks -belonging to same ring. It can be performed by 4 methods described hereafter.

    +

    Once started, pyFAI-calib will ask you to select rings. +The Peak-picking consists in the identification of peaks and groups of peaks +belonging to same ring. +It can be performed by 4 methods described hereafter.

    Massif detection

    This method consists in making the difference of the original image and a blurred @@ -133,7 +147,8 @@

    Monte-Carlo sampling

    Refinement of the parameters

    After selecting groups of peaks, each of them is assigned to a Debye-Scherrer ring number -and associated to a d-spacing value hence a theoritcal 2theta value. +(0-based numbering in python) +and associated to a d-spacing value hence a theoretical 2theta value. A supervised least-squares refinement, performed on the difference of peak position’s 2-theta values versus the expected ones from calibrant provides the 6-geometry parameters fitted.

    @@ -153,7 +168,7 @@

    Validation of the calibration previous | -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • General introduction to PyFAI »
  • diff --git a/doc/build/changelog.html b/doc/build/changelog.html index f4e7f47e9..bd7cd0c3a 100644 --- a/doc/build/changelog.html +++ b/doc/build/changelog.html @@ -6,7 +6,7 @@ - ChangeLog of Versions — pyFAI 0.12.0 documentation + ChangeLog of Versions — pyFAI 0.13.0 documentation @@ -14,7 +14,7 @@ - + @@ -44,7 +44,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • @@ -56,7 +56,63 @@

    Navigation

    ChangeLog of Versions

    -

    0.12.0: 06/2016

    +

    0.13.0: 01/12/2016

    +
      +
    • Global improvement of tests, packaging, code quality, documentation and project tools

      +
    • +
    • +
      Scripts
      +
        +
      • Add support for multiframe formats on pyFAI-average
      • +
      • Add support for monitoring correction from header file (on pyFAI-average)
      • +
      • Add progressbar in the shell (on pyFAI-average and pyFAI-integrate)
      • +
      • Script drawMask_pymca is renamed into pyFAI-drawmask
      • +
      • Rework of the drawmask GUI using silx
      • +
      • pyFAI-drawmask do not have anymore hard dependency on PyMCA
      • +
      • pyFAI-integrate can now be used without qt dependency (–no-gui)
      • +
      • Fix the script to support both Python 2 and 3 (pyFAI-calib, pyFAI-benchmark)
      • +
      • Fix selection of units on diff-map (the user selection was not propagated)
      • +
      +
      +
      +
    • +
    • +
      For users
      +
        +
      • More source code in MIT license
      • +
      • Update name and specification for cameras
      • +
      • Add cameras: Eiger500k, RaspberryPi5M, RaspberryPi8M
      • +
      • Fix Xpad S540 flat detector geometry
      • +
      • Fix definition of CeO2 calibrant
      • +
      • Add mask and flat on multi-geometry
      • +
      • Fix solid angle of the multi-geometry
      • +
      • Fix geometry processing for custom output space
      • +
      • Fix normalization factor and variance
      • +
      • Add support for Qt5
      • +
      • Add support for Debian 9 packaging
      • +
      +
      +
      +
    • +
    • +
      For developers
      +
        +
      • Create common preprocessing for distortion correction
      • +
      • Create common image preprocessing using Cython (NaN filter, flatfield, dark, polarisation)
      • +
      • Refactoring of units module. It allows to register custom units.
      • +
      • Worker can now use Writer
      • +
      • Worker polarization argument is renamed into polarization_factor
      • +
      • Remove the dependency from python-fftw3, use numpy instead
      • +
      • Remove QtWebKit dependency
      • +
      • Fix un-correction of images using sparse matrix from scipy
      • +
      +
      +
      +
    • +
    +
    +
    +

    0.12.0: 06/06/2016

    @@ -170,8 +181,6 @@

    Pixel splitting

    References:

    -

    :: _integrate: http://pythonhosted.org/pyFAI/api/pyFAI.html#pyFAI.azimuthalIntegrator.AzimuthalIntegrator.integrate1d

    -

    :: _CSR: http://en.wikipedia.org/wiki/Sparse_matrix

    @@ -241,7 +250,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • Design of the Python Fast Azimuthal Integration library »
  • diff --git a/doc/build/design/index.html b/doc/build/design/index.html index a4e41821a..9be8835e6 100644 --- a/doc/build/design/index.html +++ b/doc/build/design/index.html @@ -6,7 +6,7 @@ - Design of the Python Fast Azimuthal Integration library — pyFAI 0.12.0 documentation + Design of the Python Fast Azimuthal Integration library — pyFAI 0.13.0 documentation @@ -14,7 +14,7 @@ - + @@ -44,7 +44,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • @@ -125,7 +125,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • @@ -61,7 +61,8 @@

    Simple detector
  • pixel 0 goes from position 0 m to 50e-6m and is centered at 25e-6 m.
  • @@ -69,7 +70,7 @@

    Simple detector

    Complex detectors

    @@ -86,20 +87,20 @@

    Complex detectors

    Detectors classes

    They are used to define families of detectors. In order to take the specificities of each detector into account, pyFAI -contains about 55 detector class definitions (and twice a much with aliases) +contains about 58 detector class definitions (and 168 with aliases) which contain a mask (invalid pixels, gaps, ...) and a method to calculate the pixel positions in Cartesian coordinates. Available detectors can be printed using:

    -
    import pyFAI
    -print(pyFAI.detectors.ALL_DETECTORS)
    +
    >>> import pyFAI
    +>>> print(pyFAI.detectors.ALL_DETECTORS)
     
    -

    For optically coupled CCD detectors, the geometrical distortion is often +

    For optically coupled CCD detectors, the geometric distortion is often described by a bi-dimensional cubic spline which can be imported into the detector instance and be used to calculate the actual pixel position in space.

    @@ -120,7 +121,7 @@

    Nexus Detectors
    detector2nexus -s halfccd.spline -o halfccd.h5
    +
    +

    @@ -143,10 +145,10 @@

    ConclusionTutorials on detector definition which will help -you understanding the mechanisme :

    +you understanding the underlying mechanism:

      -
    • Distortion which explains how to correct images for geometric distortion
    • -
    • CCD-calibration which explains how to calibrate a detector for geometric +
    • Distortion which explains how to correct images for geometric distortion
    • +
    • CCD-calibration which explains how to calibrate such detectors for geometric distortion.

    @@ -211,7 +213,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • General introduction to PyFAI »
  • diff --git a/doc/build/ecosystem.html b/doc/build/ecosystem.html index b5c5bd05e..a069e4ca5 100644 --- a/doc/build/ecosystem.html +++ b/doc/build/ecosystem.html @@ -6,7 +6,7 @@ - PyFAI Ecosystem — pyFAI 0.12.0 documentation + PyFAI Ecosystem — pyFAI 0.13.0 documentation @@ -14,7 +14,7 @@ - + @@ -44,7 +44,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »
  • @@ -179,6 +179,24 @@

    PySAXSPyPI.

    +
    +

    Xi-cam

    +

    Xi-cam is developed by Ronald +Pandolfi, Dinesh Kumar, Singanallur Venkatakrishnan and Alexander Hexemer at ALS.

    +

    Xi-cam aims to provide a community driven platform for multimodal analysis +in synchrotron science. The platform core provides a robust plugin +infrastructure for extensibility, allowing continuing development to simply +add further functionality. Current modules include tools for +characterization with (GI)SAXS, Tomography, and XAS. This will continue to +serve as a development base as algorithms for multimodal analysis develop.

    +

    Seamless remote data access, visualization and analysis are key elements of +Xi-CAM, and will become critical to synchrotron data infrastructure as +expectations for future data volume and acquisition rates rise with +continuously increasing throughputs. The highly interactive design elements +of Xi-cam will similarly support a generation of users which depend on +immediate data quality feedback during high-throughput or burst acquisition +modes.

    +

    xPDFsuite

    Developed by the Billinge Group, this commercial software is described in @@ -222,6 +240,7 @@

    Table Of Contents

  • NanoPeakCell
  • pygix
  • PySAXS
  • +
  • Xi-cam
  • xPDFsuite
  • @@ -272,7 +291,7 @@

    Navigation

  • previous |
  • -
  • pyFAI 0.12.0 documentation »
  • +
  • pyFAI 0.13.0 documentation »