Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 53 additions & 53 deletions doc/source/usage/cookbook/calibration_with_jupyter.ipynb

Large diffs are not rendered by default.

35 changes: 21 additions & 14 deletions doc/source/usage/cookbook/integration_with_python.ipynb

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions doc/source/usage/cookbook/integration_with_scripts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"tags": []
},
"source": [
"# Performing the azimutal integration from shell scripts\n",
"# Performing the azimuthal integration from shell scripts\n",
"\n",
"There are three main tools for performing azimuthal integration from the command line. \n",
"Two of them specicalized for SAXS and WAXS and the last which is common to the GUI but we will see how to use it in command line mode (CLI).\n",
"Two of them specialized for SAXS and WAXS and the last which is common to the GUI but we will see how to use it in command line mode (CLI).\n",
"\n",
"They all require 3 mandatory parameters: \n",
"\n",
Expand Down Expand Up @@ -184,11 +184,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"One options which may be of some interest is the *--do-2D* which allow to perform caking.\n",
"One option which may be of some interest is the *--do-2D* which allows to perform caking.\n",
"\n",
"## Azimuthal integration for small angle data\n",
"\n",
"Small angle scattering usually prefer integration in a radial unit independant of the wavelength, typically \n",
"Small angle scattering usually prefer integration in a radial unit independent of the wavelength, typically \n",
"$q = \\frac{4 \\pi sin(2\\theta/2)}{\\lambda}$\n",
"in inverse nanometers ($nm^{-1}$)."
]
Expand Down Expand Up @@ -339,10 +339,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Common tool for azimuthal intration\n",
"## Common tool for azimuthal integration\n",
"\n",
"pyFAI-integrate offers a graphical user interface for integration which exposes most options from pyFAI. \n",
"Once all options have been configured in the the windows, one can either launch the processing or save the configuration into a *JSON* file to be able to create script with all the options.\n",
"Once all options have been configured in the windows, one can either launch the processing or save the configuration into a *JSON* file to be able to create script with all the options.\n",
"\n",
"![pyFAI-integrate GUI](pyFAI-integrate.png)\n",
"\n",
Expand Down Expand Up @@ -508,8 +508,8 @@
"source": [
"## Conclusion\n",
"\n",
"This cookbook exposed the way to perfrom azimuthal integration in scripts with pyFAI using three tools: pyFAI-waxs, pyFAI-saxs and pyFAI-integrate. \n",
"Using shell scripts is probably not as efficient as writing Python scripts but they may be easier to interface with batch queueing system managing compute-clusters. \n"
"This cookbook exposed the way to perform azimuthal integration in scripts with pyFAI using three tools: pyFAI-waxs, pyFAI-saxs and pyFAI-integrate. \n",
"Using shell scripts is probably not as efficient as writing Python scripts but they may be easier to interface with batch queueing system managing compute-clusters. "
]
}
],
Expand Down
318 changes: 211 additions & 107 deletions doc/source/usage/tutorial/AzimuthalFilter.ipynb

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions doc/source/usage/tutorial/Calibrant/Calibrant.ipynb

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions doc/source/usage/tutorial/Calibrant/hydrocerussite.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"source": [
"# Creation of hydrocerussite calibrant\n",
"\n",
"In this tutorial we will see how to create a new calibrant. For this example we will use one of the componant of mostpaintings: hydrocerussite.\n",
"In this tutorial we will see how to create a new calibrant. For this example we will use one of the components of most paintings: hydrocerussite.\n",
"\n",
"The cell parameter are definied in this document:\n",
"The cell parameters are defined in this document:\n",
"http://rruff.geo.arizona.edu/AMS/AMC_text_files/11987_amc.txt\n",
"\n",
"The first step is to record the cell parameters and provide them to pyFAI to define the cell."
Expand All @@ -29,7 +29,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"pyFAI version 2025.11.0-dev0\n"
"pyFAI version 2026.6.0-dev0\n"
]
}
],
Expand All @@ -55,12 +55,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Chromium oxide has a crystal structure de Corrundom which is R-3m (space group 166). \n",
"Chromium oxide has a crystal structure of Corundum which is R-3m (space group 166). \n",
"The selection rules are rather complicated and are available in:\n",
"![Space-group 166](http://img.chem.ucl.ac.uk/sgp/large/166bz2.gif \"Space-group 166\")\n",
"\n",
"\n",
"We will setup a function corresponding to the selection rules. It returns True if the reflection is active and False otherwise.\n"
"We will setup a function corresponding to the selection rules. It returns True if the reflection is active and False otherwise."
]
},
{
Expand Down Expand Up @@ -286,7 +286,7 @@
"metadata": {},
"source": [
"## Conclusion\n",
"This is an advanced tutorial, most user won't have to define their own calibrant. You can also contact the developers to get your own calibrant integrated into pyFAI which makes things easier for you and other users."
"This is an advanced tutorial, most users won't have to define their own calibrant. You can also contact the developers to get your own calibrant integrated into pyFAI which makes things easier for you and other users."
]
}
],
Expand All @@ -306,7 +306,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.1"
"version": "3.14.0"
}
},
"nbformat": 4,
Expand Down
63 changes: 36 additions & 27 deletions doc/source/usage/tutorial/Calibrant/make_calibrant.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
"\n",
"In this tutorial we will see how to generate a file describing a *reference material* used as calibrant to refine the geometry of the experimental setup, especially the position of the detector.\n",
"\n",
"In pyFAI, calibrant are defined in a bunch of files available from [github](https://github.com/silx-kit/pyFAI/tree/master/calibration). Those files are automatically installed with pyFAI and readily available from the programming interface, as described in the **Calibrant** tutorial.\n",
"In pyFAI, calibrants are defined in a bunch of files available from [GitHub](https://github.com/silx-kit/pyFAI/tree/master/calibration). Those files are automatically installed with pyFAI and readily available from the programming interface, as described in the **Calibrant** tutorial.\n",
"\n",
"This tutorials focuses on the content of the file and how to generate other calibrant files and how to exended existing ones.\n",
"This tutorial focuses on the content of the file and how to generate other calibrant files and how to extend existing ones.\n",
"\n",
"## Content of the file\n",
"\n",
"Calibrant files from *pyFAI* are heavily inspired from the ones used in *Fit2D*: they simply store the *d-spacing* between Miller plans and are simply loaded using the *numpy.loadtxt* function. \n",
"In pyFAI we have improved with plent of comment (using **#**) to provide in addition the familly of Miller plan associated and the multiplicity, which, while not proportionnal to *Fobs* is somewhat related.\n",
"In pyFAI we have improved with plenty of comments (using **#**) to provide in addition the family of Miller plan associated and the multiplicity, which, while not proportional to *Fobs* is somewhat related.\n",
"\n",
"One may think it would have been better/simpler to describe the cell of the material. \n",
"Actually some calibrant, especially the ones used in SAXS like silver behenate (AgBh), but not only, are not well crystallized compounds and providing the *d-spacing* allows to use them as calibrant.\n",
"Neverthless this tutorial will be focused on how to generate calibrant files fron crystal structures.\n",
"Nevertheless this tutorial will be focused on how to generate calibrant files from crystal structures.\n",
"\n",
"Finally the *calibrant file* has a few lines of headers containing the name, the crystal cell parameters (if available) and quite importantly a reference to the source of information like a publication to allow the re-generation of the file if needed. \n",
"\n",
Expand Down Expand Up @@ -51,15 +51,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"using pyFAI version: 2025.11.0-dev0\n",
"using pyFAI version: 2026.6.0-dev0\n",
"\n",
"This is a cell object, able to calculate the volume and d-spacing according to formula from:\n",
"\n",
"http://geoweb3.princeton.edu/research/MineralPhy/xtalgeometry.pdf\n",
"\n",
"Constructor of the Cell class:\n",
"\n",
"Crystalographic units are Angstrom for distances and degrees for angles !\n",
"Crystallographic units are Angstrom for distances and degrees for angles !\n",
"\n",
":param a,b,c: unit cell length in Angstrom\n",
":param alpha, beta, gamma: unit cell angle in degrees\n",
Expand All @@ -81,7 +81,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The constructor of the class is used to build and well suited to triclinic crystal. \n",
"The constructor of the class is used to build and is well suited to triclinic crystal. \n",
"\n",
"### Specific constructors ###\n",
"\n",
Expand All @@ -98,7 +98,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Primitive cubic cell a=3.3590 b=3.3590 c=3.3590Å α=90.000 β=90.000 γ=90.000°\n"
"Primitive cubic cell a=3.35900Å b=3.35900Å c=3.35900Å α=90° β=90° γ=90°\n"
]
}
],
Expand Down Expand Up @@ -188,7 +188,7 @@
"output_type": "stream",
"text": [
"# Calibrant: Po\n",
"# Cell: Primitive cubic cell a=3.3590 b=3.3590 c=3.3590Å α=90.000 β=90.000 γ=90.000° (P)\n",
"# Cell: Primitive cubic cell a=3.35900Å b=3.35900Å c=3.35900Å α=90° β=90° γ=90° (P)\n",
"# Ref: http://www.periodictable.com/Elements/084/data.html\n",
"\n",
"# d_spacing # (h k l) mult intensity\n",
Expand Down Expand Up @@ -217,9 +217,9 @@
"source": [
"### Other Examples: LaB6 ###\n",
"\n",
"Lantanide Hexaboride, probably my favorite calibrant as it has a primitive cubic cell hence all reflections are valid and intense. The cell parameter is available from the [NIST](https://www-s.nist.gov/srmors/certificates/660C.pdf) at a=4.156826. \n",
"Lanthanide Hexaboride, probably my favorite calibrant as it has a primitive cubic cell hence all reflections are valid and intense. The cell parameter is available from the [NIST](https://www-s.nist.gov/srmors/certificates/660C.pdf) at a=4.156826. \n",
"\n",
"The number of reflections in a file is controled by the *dmin* parameter. The lower it is, the more lines there are and the more time-consuming this will be:\n"
"The number of reflections in a file is controlled by the *dmin* parameter. The lower it is, the more lines there are and the more time-consuming this will be:"
]
},
{
Expand All @@ -231,8 +231,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 2.04 s, sys: 11.9 ms, total: 2.05 s\n",
"Wall time: 2.05 s\n",
"CPU times: user 2.15 s, sys: 19.8 ms, total: 2.17 s\n",
"Wall time: 2.17 s\n",
"Number of reflections: 1441\n"
]
}
Expand Down Expand Up @@ -262,7 +262,7 @@
"output_type": "stream",
"text": [
"# Calibrant: my_LaB6\n",
"# Cell: Primitive cubic cell a=4.1568 b=4.1568 c=4.1568Å α=90.000 β=90.000 γ=90.000° (P)\n",
"# Cell: Primitive cubic cell a=4.15683Å b=4.15683Å c=4.15683Å α=90° β=90° γ=90° (P)\n",
"# Ref: https://www-s.nist.gov/srmors/certificates/660C.pdf\n",
"\n",
"# d_spacing # (h k l) mult intensity\n",
Expand Down Expand Up @@ -307,7 +307,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Face centered cubic cell a=5.4312 b=5.4312 c=5.4312Å α=90.000 β=90.000 γ=90.000°\n"
"Face centered cubic cell a=5.43118Å b=5.43118Å c=5.43118Å α=90° β=90° γ=90°\n"
]
}
],
Expand All @@ -325,7 +325,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Face centered cubic cell a=5.4312 b=5.4312 c=5.4312Å α=90.000 β=90.000 γ=90.000°\n"
"Face centered cubic cell a=5.43118Å b=5.43118Å c=5.43118Å α=90° β=90° γ=90°\n"
]
}
],
Expand All @@ -338,7 +338,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Apparently, there is not difference. \n",
"Apparently, there is no difference. \n",
"But to check it, let's generate all lines down to 1A and compare them:"
]
},
Expand Down Expand Up @@ -399,13 +399,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"So there are many more reflection in the FCC structure compared to the diamond-like structure: (4 2 0), (2 2 2) are extinct\n",
"So there are many more reflections in the FCC structure compared to the diamond-like structure: (4 2 0), (2 2 2) are extinct\n",
"as h+k+l=4n and all even. \n",
"\n",
"### Selection rules ###\n",
"Cell object contain *selection_rules* which tells if a reflection is allowed or not.\n",
"Those *selection_rules* can be introspected:\n",
"\n"
"Cell objects contain *selection_rules* which tells if a reflection is allowed or not.\n",
"Those *selection_rules* can be introspected:\n"
]
},
{
Expand All @@ -418,9 +417,9 @@
"output_type": "stream",
"text": [
"Selections rules for Si:\n",
"[<function Cell.type.<locals>.<lambda> at 0x7fc8e218b880>, <function Cell.type.<locals>.<lambda> at 0x7fc8e218b560>, <function Cell.diamond.<locals>.<lambda> at 0x7fc8e218ba60>]\n",
"[<function ReflectionCondition.default at 0x7f78effd5c70>, <function ReflectionCondition.type_F at 0x7f78effd6ae0>, <function Cell.diamond.<locals>.<lambda> at 0x7f7a785a9bc0>]\n",
"Selections rules for FCC:\n",
"[<function Cell.type.<locals>.<lambda> at 0x7fc8e218be20>, <function Cell.type.<locals>.<lambda> at 0x7fc8e218bba0>]\n"
"[<function ReflectionCondition.default at 0x7f78effd5c70>, <function ReflectionCondition.type_F at 0x7f78effd6ae0>]\n"
]
}
],
Expand All @@ -435,7 +434,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The *Si* object has one additionnal selection rule which explains the difference:\n",
"The *Si* object has one additional selection rule which explains the difference:\n",
"A specific rule telling that reflection with h+k+l=4n is forbidden when (h,k,l) are all even.\n",
"\n",
"We will now have a look at the source code of those selection rules using the *inspect* module.\n",
Expand All @@ -452,8 +451,18 @@
"name": "stdout",
"output_type": "stream",
"text": [
"self.selection_rules = [lambda h, k, l: not (h == 0 and k == 0 and l == 0)] # noqa: E741\n",
"lambda h, k, l: (h % 2 + k % 2 + l % 2) in (0, 3) # noqa: E741\n",
"@staticmethod\n",
" def default(h: int, k: int, l: int) -> bool: # noqa: E741\n",
" \"\"\"\n",
" Default selection rule: h=k=l=0 is forbidden\n",
" \"\"\"\n",
" return not (h == 0 and k == 0 and l == 0)\n",
"@staticmethod\n",
" def type_F(h: int, k: int, l: int) -> bool: # noqa: E741\n",
" \"\"\"\n",
" Face-centered type: h,k,l all even or all odd\n",
" \"\"\"\n",
" return (h % 2 + k % 2 + l % 2) in (0, 3)\n",
"lambda h, k, l: not ( # noqa: E741\n",
" (h % 2 == 0)\n",
" and (k % 2 == 0)\n",
Expand Down Expand Up @@ -498,7 +507,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.1"
"version": "3.14.0"
}
},
"nbformat": 4,
Expand Down
Loading
Loading