summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/man/pymca.19
-rw-r--r--doc/man/pymcaroitool.19
-rw-r--r--doc/source/customization/index.rst2
-rw-r--r--doc/source/customization/plugins/plugins1d.rst10
-rw-r--r--doc/source/customization/plugins/stackplugins.rst4
-rw-r--r--doc/source/customization/settings.rst4
-rw-r--r--doc/source/customization/settings/img/settings_01.pngbin0 -> 10733 bytes
-rw-r--r--doc/source/customization/settings/img/settings_02.pngbin0 -> 26112 bytes
-rw-r--r--doc/source/customization/settings/index.rst71
-rw-r--r--doc/source/index.rst3
-rw-r--r--doc/source/license.rst2
-rw-r--r--doc/source/recipes.rst7
-rw-r--r--doc/source/recipes/recipescode/GenerateHDF5Stack.py105
-rw-r--r--doc/source/recipes/xrfembedpyqt.rst15
-rw-r--r--doc/source/recipes/xrfhdf5stack.rst87
-rw-r--r--doc/source/training/matrix/img/matrix_01.pngbin0 -> 110739 bytes
-rw-r--r--doc/source/training/matrix/img/matrix_02.pngbin0 -> 54887 bytes
-rw-r--r--doc/source/training/matrix/img/matrix_03.pngbin0 -> 56825 bytes
-rw-r--r--doc/source/training/matrix/img/matrix_04.pngbin0 -> 15242 bytes
-rw-r--r--doc/source/training/matrix/img/tertiary_01.pngbin0 -> 18372 bytes
-rw-r--r--doc/source/training/matrix/img/tertiary_03.pngbin0 -> 56151 bytes
-rw-r--r--doc/source/training/matrix/img/tertiary_04.pngbin0 -> 43209 bytes
-rw-r--r--doc/source/training/matrix/index.rst83
-rw-r--r--doc/source/training/quantification/img/quantification_01.pngbin0 -> 134481 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_02.pngbin0 -> 133255 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_03.pngbin0 -> 133429 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_04.pngbin0 -> 153974 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_05.pngbin0 -> 119006 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_06.pngbin0 -> 29025 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_07.pngbin0 -> 72960 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_08.pngbin0 -> 127428 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_09.pngbin0 -> 122441 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_10.pngbin0 -> 147754 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_11.pngbin0 -> 131580 bytes
-rw-r--r--doc/source/training/quantification/img/quantification_12.pngbin0 -> 127802 bytes
-rw-r--r--doc/source/training/quantification/index.rst221
-rw-r--r--doc/source/training/tertiary/img/tertiary_01.pngbin0 -> 18372 bytes
-rw-r--r--doc/source/training/tertiary/img/tertiary_02.pngbin0 -> 111921 bytes
-rw-r--r--doc/source/training/tertiary/img/tertiary_03.pngbin0 -> 56151 bytes
-rw-r--r--doc/source/training/tertiary/img/tertiary_04.pngbin0 -> 43209 bytes
-rw-r--r--doc/source/training/tertiary/index.rst65
-rw-r--r--doc/source/training/xraydata/img/xraydata_01.pngbin0 -> 76401 bytes
-rw-r--r--doc/source/training/xraydata/img/xraydata_02.pngbin0 -> 80811 bytes
-rw-r--r--doc/source/training/xraydata/index.rst71
-rw-r--r--doc/source/tutorials.rst43
45 files changed, 784 insertions, 27 deletions
diff --git a/doc/man/pymca.1 b/doc/man/pymca.1
index cfebe58..d055597 100644
--- a/doc/man/pymca.1
+++ b/doc/man/pymca.1
@@ -3,7 +3,7 @@
.\"
-.TH pymca 1 "March 2012" "ESRF" "PyMca X-Ray Fluorescence Toolkit"
+.TH pymca 1 "September 2018" "ESRF" "PyMca X-Ray Fluorescence Toolkit"
.SH NAME
@@ -50,7 +50,12 @@ Start the program using the selected graphics backend (mpl for matplotlib, gl fo
i
.B pymca --binding=XX
.P
-Start the program using the selected Qt binding. It has ot be one of PyQt5, PyQt4, PySide or PySide2.
+Start the program using the selected Qt binding. It has to be one of PyQt5 (default), PyQt4, PySide or PySide2.
+i
+.B pymca --logging=XX
+.P
+Set the logging level. Allowed values are, in increasing order of verbosity: critical, error, warning (default), info, debug.
+Alternatively, you can specify an integer in range 0 (critical) to 4 (debug).
.SH SEE ALSO
HDF5, h5py
diff --git a/doc/man/pymcaroitool.1 b/doc/man/pymcaroitool.1
index c7d9ec6..7f9d17d 100644
--- a/doc/man/pymcaroitool.1
+++ b/doc/man/pymcaroitool.1
@@ -43,7 +43,7 @@ Start the program with a file browser to select the input files.
.B pymcaroitool --binding=XX
.P
-Start the program using the selected Qt binding. It has ot be one of PyQt5, PyQt4, PySide or PySide2.
+Start the program using the selected Qt binding. It has to be one of PyQt5 (default), PyQt4, PySide or PySide2.
.B pymcaroitool file_0001.edf
.P
@@ -69,6 +69,13 @@ file_00200.edf
Load the double indexed files from row10_col0100.dat, row10_col0101.dat, ...
to row20_col0199.dat, row20_col0200.dat
+.B pymcaroitool --logging=XX
+.P
+Set the logging level. Allowed values are, in increasing order of verbosity: critical, error, warning (default), info, debug.
+Alternatively, you can specify a value in range 0 (critical) to 4 (debug).
+
+
+
.SH CAVEATS
If files f_000.xxx and f_001.xxx are present in the same directory, and
only one of them is selected, the program will always try to load both of
diff --git a/doc/source/customization/index.rst b/doc/source/customization/index.rst
index 02b2707..20a3a41 100644
--- a/doc/source/customization/index.rst
+++ b/doc/source/customization/index.rst
@@ -5,5 +5,5 @@ Customizing PyMca
.. toctree::
:maxdepth: 3
- settings
+ settings/index.rst
plugins/index.rst
diff --git a/doc/source/customization/plugins/plugins1d.rst b/doc/source/customization/plugins/plugins1d.rst
index 77bb7b9..14bd217 100644
--- a/doc/source/customization/plugins/plugins1d.rst
+++ b/doc/source/customization/plugins/plugins1d.rst
@@ -23,8 +23,8 @@ Overview
.. autofunction:: getPlugin1DInstance
-Builtin 1D plugins
-******************
+Built-in 1D plugins
+*******************
Background subtraction tools
++++++++++++++++++++++++++++
@@ -50,11 +50,15 @@ Alignment plugin
.. automodule:: PyMca5.PyMcaPlugins.AlignmentScanPlugin
+Advanced alignment plugin
++++++++++++++++++++++++++
+
+.. automodule:: PyMca5.PyMcaPlugins.AdvancedAlignmentScanPlugin
+
.. TODO: Kinetic tools
.. TODO: XASNormalization
-.. TODO: AdvancedAlignmentScanPlugin (see .html file in PYMCA_DOC_DIR)
Remove glitches from curves
+++++++++++++++++++++++++++
diff --git a/doc/source/customization/plugins/stackplugins.rst b/doc/source/customization/plugins/stackplugins.rst
index b9cc9fc..6bbd8fe 100644
--- a/doc/source/customization/plugins/stackplugins.rst
+++ b/doc/source/customization/plugins/stackplugins.rst
@@ -23,8 +23,8 @@ Stack plugin API
.. autofunction:: getStackPluginInstance
-Builtin stack plugins
-*********************
+Built-in stack plugins
+**********************
Alternative ROI options
+++++++++++++++++++++++
diff --git a/doc/source/customization/settings.rst b/doc/source/customization/settings.rst
deleted file mode 100644
index d39314a..0000000
--- a/doc/source/customization/settings.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-
-Settings
---------
-
diff --git a/doc/source/customization/settings/img/settings_01.png b/doc/source/customization/settings/img/settings_01.png
new file mode 100644
index 0000000..027859a
--- /dev/null
+++ b/doc/source/customization/settings/img/settings_01.png
Binary files differ
diff --git a/doc/source/customization/settings/img/settings_02.png b/doc/source/customization/settings/img/settings_02.png
new file mode 100644
index 0000000..9cf15f1
--- /dev/null
+++ b/doc/source/customization/settings/img/settings_02.png
Binary files differ
diff --git a/doc/source/customization/settings/index.rst b/doc/source/customization/settings/index.rst
new file mode 100644
index 0000000..4f1302f
--- /dev/null
+++ b/doc/source/customization/settings/index.rst
@@ -0,0 +1,71 @@
+Settings
+========
+
+.. |img_01| image:: ./img/settings_01.png
+ :align: middle
+ :alt: Settings Directory
+
+.. |img_02| image:: ./img/settings_02.png
+ :align: middle
+ :alt: File mneu
+
+.. contents::
+ :local:
+
+PyMca allows a certain level of customization via user settings.
+
+Settings Directory
+------------------
+
+The first time *PyMca* is started, it creates a user accessible settings directory to allow user customization up to a certain extent.
+
+The location and name of this settings directory is different following the operation system.
+
+The typical layout of the directory is shown below
+
+|img_01|
+
+Windows
+.......
+
+The name of the folder is PyMca and it is located in the Documents folder of the user. The idea is that this folder should be easily accessible by the user and this location seems preferable to the use of a hidden folder.
+
+MacOS, Linux,...
+................
+
+The settings directory is created in the user $HOME directory.
+
+The name of the directory was PyMca in older versions of the program. Recent versionstry to use the more standard way of using a .pymca directory. Nevertheless, if they find a PyMca directory at he $HOME level, they will keep using it.
+
+
+GUI settings
+------------
+
+Graphical user interfaces are nice to start but sometimes they require a lot of interaction from the user.
+
+In an attempt to minimize the amount of user interaction, *PyMca* allows to save some settings like main window geometry, open files, last used directory, fit configuration, ROI table configuration...
+
+
+|img_02|
+
+
+This feature is accessible from the File menu either by choosing *File->Save default settings* or *File->Save->PyMca Configuration* This creates a .ini file in the user accessible settings folder of PyMca created when first using the program.
+
+The PyMca.ini file contains the default settings used by the application on start up. They can be bypassed by a fresh start of PyMca (typing *pymca -f* from the command line or selecting "*PyMca Fresh Start* from the Windows start menu).
+
+XRF Database
+------------
+
+The subdirectory data allows the user to modify the data used by *PyMca* when performing X-ray fluorescence calculations. It is enough to copy to this directory any of the original ASCII files contained in the `fisx_data <https://github.com/vasole/fisx/tree/master/fisx_data>`_ directory of the fisx module to force the program to use that file. The user can then proceed to edit the file and PyMca will use the modified file the next time is started.
+
+If you are interested in modifying the data used by *PyMca* the is an `exercise <../../training/xraydata/index.html>`_ to teach you how to proceed.
+
+CAUTION: At this point it is not advisable to modify the EADL97_* or the XCOM_CrossSections.dat files.
+
+CAUTION: Those files use unix line endings (LF) and not windows line endings (CR/LF). If you are under windows you have to make sure you do not use an editor modifying line endings. Convenient and free editors for windows are `Notepad++ <https://notepad-plus-plus.org>`_ or `Vim for windows <https://www.vim.org>`_
+
+User Plugins
+------------
+
+The subdirectory plugins contains the user plugins to be used in the application. Please refer to the plugins documentation for details.
+
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 4f1ce15..8ad93f2 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -14,7 +14,7 @@ The proper way to cite PyMca is:
V.A. Sole, E. Papillon, M. Cotte, Ph. Walter, J. Susini, A multiplatform code for the analysis of energy-dispersive X-ray fluorescence spectra, Spectrochim. Acta Part B 62 (2007) 63-68.
-Due to the copyright transfer to the publisher, the online availability of the article will depend on your subscription to ScienceDirect. The article doi is 10.1016/j.sab.2006.12.002. The abstract should be available in any case.
+Due to the copyright transfer to the publisher, the online availability of the article will depend on your subscription to ScienceDirect. The article `doi is 10.1016/j.sab.2006.12.002 <https://www.doi.org/10.1016/j.sab.2006.12.002>`_. The abstract should be available in any case.
The current version features:
@@ -36,6 +36,7 @@ Table of contents
overview.rst
install.rst
tutorials.rst
+ recipes.rst
changelog.rst
license.rst
faq.rst
diff --git a/doc/source/license.rst b/doc/source/license.rst
index b7261eb..a2b8857 100644
--- a/doc/source/license.rst
+++ b/doc/source/license.rst
@@ -1,7 +1,7 @@
License
=======
-The source code of *silx* is licensed under the `MIT <https://opensource.org/licenses/MIT>`_ license:
+The source code of *PyMca* is licensed under the `MIT <https://opensource.org/licenses/MIT>`_ license:
.. include:: ../../LICENSE
diff --git a/doc/source/recipes.rst b/doc/source/recipes.rst
new file mode 100644
index 0000000..5f887b6
--- /dev/null
+++ b/doc/source/recipes.rst
@@ -0,0 +1,7 @@
+Recipes
+=======
+
+.. toctree::
+
+ HOWTO Embed XRF fitting in a PyQt5 application <./recipes/xrfembedpyqt.rst>
+ HOWTO Write a stack of XRF spectra in HDF5 <./recipes/xrfhdf5stack.rst>
diff --git a/doc/source/recipes/recipescode/GenerateHDF5Stack.py b/doc/source/recipes/recipescode/GenerateHDF5Stack.py
new file mode 100644
index 0000000..6834f48
--- /dev/null
+++ b/doc/source/recipes/recipescode/GenerateHDF5Stack.py
@@ -0,0 +1,105 @@
+#/*##########################################################################
+#
+# Copyright (c) 2018 European Synchrotron Radiation Facility
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+#############################################################################*/
+__author__ = "V.A. Sole - ESRF Data Analysis"
+__contact__ = "sole@esrf.fr"
+__license__ = "MIT"
+__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+__doc__ = """
+Script writing a stack of XRF data with calibration and live_time information
+"""
+
+import os
+import numpy
+import h5py
+
+# use a dummy 3D array generated using data supplied with PyMca
+from PyMca5 import PyMcaDataDir
+from PyMca5.PyMcaIO import specfilewrapper as specfile
+from PyMca5.PyMcaIO import ConfigDict
+
+dataDir = PyMcaDataDir.PYMCA_DATA_DIR
+spe = os.path.join(dataDir, "Steel.spe")
+cfg = os.path.join(dataDir, "Steel.cfg")
+sf = specfile.Specfile(spe)
+y = counts = sf[0].mca(1)
+x = channels = numpy.arange(y.size).astype(numpy.float)
+configuration = ConfigDict.ConfigDict()
+configuration.read(cfg)
+calibration = configuration["detector"]["zero"], \
+ configuration["detector"]["gain"], 0.0
+initialTime = configuration["concentrations"]["time"]
+
+# create the data
+nRows = 5
+nColumns = 10
+nTimes = 3
+data = numpy.zeros((nRows, nColumns, counts.size), dtype = numpy.float)
+live_time = numpy.zeros((nRows * nColumns), dtype=numpy.float)
+
+mcaIndex = 0
+for i in range(nRows):
+ for j in range(nColumns):
+ factor = (1 + mcaIndex % nTimes)
+ data[i, j] = counts * factor
+ live_time[i * nColumns + j] = initialTime * factor
+ mcaIndex += 1
+
+# now we have a 3D array containing the spectra in data (mandatory)
+# we have the channels (not mandatory)
+# we have the associated calibration (not mandatory)
+# we have the live_time (not mandatory)
+# and we are going to create an HDF5 with that information
+#
+# Just writing those data as a dataset in an HDF5 file would be enough for
+# using it in PyMca, but we can create a container group in order to associate
+# additional information (channels, live_time, calibration)
+# "instrument" can be replaced by, for instance, the beamline name
+# "detector" can be replaced by, for instance, "mca_0"
+#
+h5File = "Steel.h5"
+if os.path.exists(h5File):
+ os.remove(h5File)
+h5 = h5py.File(h5File, "w")
+h5["/entry/instrument/detector/calibration"] = calibration
+h5["/entry/instrument/detector/channels"] = channels
+h5["/entry/instrument/detector/data"] = data
+h5["/entry/instrument/detector/live_time"] = live_time
+
+# add nexus conventions (not needed)
+h5["/entry/title"] = u"Dummy generated map"
+h5["/entry"].attrs["NX_class"] = u"NXentry"
+h5["/entry/instrument"].attrs["NX_class"] = u"NXinstrument"
+h5["/entry/instrument/detector/"].attrs["NX_class"] = u"NXdetector"
+h5["/entry/instrument/detector/data"].attrs["interpretation"] = \
+ u"spectrum"
+# implement a default plot named measurement (not needed)
+h5["/entry/measurement/data"] = \
+ h5py.SoftLink("/entry/instrument/detector/data")
+h5["/entry/measurement"].attrs["NX_class"] = u"NXdata"
+h5["/entry/measurement"].attrs["signal"] = u"data"
+h5["/entry"].attrs["default"] = u"measurement"
+
+h5.flush()
+h5.close()
+h5 = None
diff --git a/doc/source/recipes/xrfembedpyqt.rst b/doc/source/recipes/xrfembedpyqt.rst
new file mode 100644
index 0000000..ddc5166
--- /dev/null
+++ b/doc/source/recipes/xrfembedpyqt.rst
@@ -0,0 +1,15 @@
+Embedding PyMca XRF fitting
+===========================
+
+Besides providing ready-to-use applications, PyMca is very modular and it allows to be used as a library.
+
+Let's say you have your own way of displaying your data into a PyQt5 (or PyQt4, PySide or PySide2)
+application. All you need to do to provide XRF fitting capabilities to it requires 4 lines of code.
+
+.. code-block:: python
+
+ from PyMca5.PyMca import McaAdvancedFit
+ widget = McaAdvancedFit.McaAdvancedFit()
+ widget.setData(channels, counts)
+ widget.show()
+
diff --git a/doc/source/recipes/xrfhdf5stack.rst b/doc/source/recipes/xrfhdf5stack.rst
new file mode 100644
index 0000000..8b7d512
--- /dev/null
+++ b/doc/source/recipes/xrfhdf5stack.rst
@@ -0,0 +1,87 @@
+HDF5 XRF Stack
+==============
+
+There is a recurrent cuestion concerning how one should write the spectra associated to a raster
+experiment to be compatible with PyMca.
+
+The solution is not unique, because PyMca can deal with (too) many data formats. For instance, if
+you have a map of 20000 spectra corresponding to a map of 100 rows per 200 columns, 20000 single-column
+ASCII files containing the measured counts would do the job. You would be "compatible" with PyMca but
+you would be missing relevant information known at acquisition time like live_time and calibration
+parameters.
+
+The most versatile file format supported by PyMca is without doubt HDF5. You can find information about it
+at the `HDF Group web site <https://portal.hdfgroup.org/display/HDF5/HDF5>`_
+
+Let's assume data is a 3-dimensional array or 20000 spectra corresponding to a raster scan of 100 rows per
+200 columns. If each spectrum has 2048 channels, the shape of that array will be (following C-convention)
+(100, 200, 2048). The simplest HDF5 file compatible with PyMca would contain a single 3-dimensional dataset
+and it could be written using the code snipset shown below.
+
+.. code-block:: python
+
+ import h5py
+ h5 = h5py.File("myfile.h5", "w")
+ h5["data"] = data
+ h5.flush()
+ h5.close()
+
+Obviously, besides a faster readout of the data by PyMca, one would not gain any information compared to
+the use of single-column ASCII files.
+
+PyMca will automatically look for information associated to a dataset provided that information is
+stored within the same container group in the file.
+
+If live_time is a one dimensional dataset with 20000 values corresponding to the actual measuring time
+associated to each spectrum, the simplest way to allow PyMca to use that information is to put it at
+the same level within the same group.
+
+If the channels associated to the data are different from 0,1,2,3, ..., 2046, 2047, they can be specified by
+a one dimensional dataset named channels.
+
+The calibration can be specified as a dataset containing three values (corresponding to a, b and c in the
+expression energy = a + b * ch + c * ch^2 and named calibration.
+
+.. code-block:: python
+
+ import h5py
+ h5 = h5py.File("myfile.h5", "w")
+ h5["/mca_0/data"] = data
+ h5["/mca_0/channels"] = channels
+ h5["/mca_0/calibration"] = calibration
+ h5["/mca_0/live_time"] = live_time
+ h5.flush()
+ h5.close()
+
+Additional conventions can be applied to improve the user experience when using the PyMca graphical user
+interface.
+
+The code below writes an HDF5 following NeXus conventions. Those conventions are attribute based, therefore
+the actual names of the different groups are free. You can :download:`download a script <./recipescode/GenerateHDF5Stack.py>` generating a file using these
+conventions.
+
+.. code-block:: python
+
+ h5File = "myfile.h5"
+ if os.path.exists(h5File):
+ os.remove(h5File)
+ h5 = h5py.File(h5File, "w")
+ h5["/entry/instrument/detector/calibration"] = calibration
+ h5["/entry/instrument/detector/channels"] = channels
+ h5["/entry/instrument/detector/data"] = data
+ h5["/entry/instrument/detector/live_time"] = live_time
+
+ # add nexus conventions (not needed)
+ h5["/entry/title"] = u"Dummy generated map"
+ h5["/entry"].attrs["NX_class"] = u"NXentry"
+ h5["/entry/instrument"].attrs["NX_class"] = u"NXinstrument"
+ h5["/entry/instrument/detector/"].attrs["NX_class"] = u"NXdetector"
+ h5["/entry/instrument/detector/data"].attrs["interpretation"] = u"spectrum"
+ # implement a default plot named measurement (not needed)
+ h5["/entry/measurement/data"] = h5py.SoftLink("/entry/instrument/detector/data")
+ h5["/entry/measurement"].attrs["NX_class"] = u"NXdata"
+ h5["/entry/measurement"].attrs["signal"] = u"data"
+ h5["/entry"].attrs["default"] = u"measurement"
+
+ h5.flush()
+ h5.close()
diff --git a/doc/source/training/matrix/img/matrix_01.png b/doc/source/training/matrix/img/matrix_01.png
new file mode 100644
index 0000000..c84eec6
--- /dev/null
+++ b/doc/source/training/matrix/img/matrix_01.png
Binary files differ
diff --git a/doc/source/training/matrix/img/matrix_02.png b/doc/source/training/matrix/img/matrix_02.png
new file mode 100644
index 0000000..81a26e9
--- /dev/null
+++ b/doc/source/training/matrix/img/matrix_02.png
Binary files differ
diff --git a/doc/source/training/matrix/img/matrix_03.png b/doc/source/training/matrix/img/matrix_03.png
new file mode 100644
index 0000000..3b5e147
--- /dev/null
+++ b/doc/source/training/matrix/img/matrix_03.png
Binary files differ
diff --git a/doc/source/training/matrix/img/matrix_04.png b/doc/source/training/matrix/img/matrix_04.png
new file mode 100644
index 0000000..ec2268f
--- /dev/null
+++ b/doc/source/training/matrix/img/matrix_04.png
Binary files differ
diff --git a/doc/source/training/matrix/img/tertiary_01.png b/doc/source/training/matrix/img/tertiary_01.png
new file mode 100644
index 0000000..fbf88d8
--- /dev/null
+++ b/doc/source/training/matrix/img/tertiary_01.png
Binary files differ
diff --git a/doc/source/training/matrix/img/tertiary_03.png b/doc/source/training/matrix/img/tertiary_03.png
new file mode 100644
index 0000000..5325dfc
--- /dev/null
+++ b/doc/source/training/matrix/img/tertiary_03.png
Binary files differ
diff --git a/doc/source/training/matrix/img/tertiary_04.png b/doc/source/training/matrix/img/tertiary_04.png
new file mode 100644
index 0000000..69af2c7
--- /dev/null
+++ b/doc/source/training/matrix/img/tertiary_04.png
Binary files differ
diff --git a/doc/source/training/matrix/index.rst b/doc/source/training/matrix/index.rst
new file mode 100644
index 0000000..c84732f
--- /dev/null
+++ b/doc/source/training/matrix/index.rst
@@ -0,0 +1,83 @@
+Automatic Sample Matrix Refinement
+==================================
+
+
+.. |img1| image:: ./img/matrix_01.png
+ :width: 400px
+ :align: middle
+ :alt: Fitted Steel Data
+
+.. |img2| image:: ./img/matrix_02.png
+ :width: 400px
+ :align: middle
+ :alt: The Single Layer Strategy Window
+
+.. |img3| image:: ./img/matrix_03.png
+ :width: 400px
+ :align: middle
+ :alt: Strategy Configured
+
+.. |img4| image:: ./img/matrix_04.png
+ :align: middle
+ :alt: Last Composition
+
+.. contents::
+ :local:
+
+Introduction
+------------
+
+The characterization of the experimental setup (excitation beam, filters, attenuators, detector, geometry) and theoretical peak ratios are not sufficient to appropriately quantify X-ray fluorescence spectra. Unless we are dealing with very thin samples (that means samples where self-attenuation or multiple excitation effects can be neglected), the sample itself plays a critical role. However, the sample composition is exactly what we want to know.
+
+Versions of PyMca older than 5.0 required the user to manually modify the initial guess of the sample composition if the obtained composition was very different from the initial guess.
+
+Exercise
+--------
+
+The goal of the exercise it to show the user one way to instruct the program to automatically update the initial sample composition guess.
+
+
+Preparation
+...........
+
+This starting point of this exercise is the same as the one of the previous exercise `Accounting for higher order excitations <../tertiary/index.html>`_
+
+In that exercise the reader was able to properly account for multiple order excitations in the sample. However, the actual composition of the sample was provided. A more realistic situation would be to know that we are dealing with a stainless steel sample of unknown composition. Despite the fact the spectrum itself tells us what elements are present, we are going to ask the program to perform a quantification starting from a pure Fe sample.
+
+As with the previous exercise, we have to make sure we have reached the situation shown below.
+
+|img1|
+
+
+Configuring the Fit Strategy
+............................
+
+To properly configure the program we'll have to follow these steps:
+
+- As usual, enter the fit configuration widget via the Configure button.
+- In the ATTENUATORS tab, enter (by typing) Fe as the Material of the Matrix. The program will automatically change the density. You can reset the value to the previous one if you want. It is a thick sample in any case and the results will not change.
+- Make sure we have selected the Consider Tertiary Excitation checkbox of the CONCENTRATIONS tab.
+- Move to the FIT tab of the configuration widget and select the Perform a fit using the selected strategy checkbox and click the SETUP button.
+
+You will be presented a screen similar to the screenshot below.
+
+|img2|
+
+Since you are there, please take a time to read the algorithm description.
+
+We are going to select a set of peak families and we are going to specify the chemical form in which they will be incorporated in the matrix. Since we are dealing with an alloy, we'll ask the program to incorporate the elements as pure metals. If we were dealing with a glass, we would have selected Si1O2 as completing material and incorporated the different elements in the form of oxides.
+
+We can directly select the peak families Cr K, Mn K, Fe Ka, Ni K. The idea is to select those peaks that give a high contribution to the spectrum and that we suspect they a present in the sample. For instance, if a experiment takes place in air, we can find an important contribution from Argon but the argon signal does not come from the sample and therefore should not be entered in the sample composition. You should manage to achieve the image below.
+
+|img3|
+
+Press OK to accept the strategy configuration and press OK again to finish the fit configuration.
+
+If you now carry out the fit you notice the fit takes longer due to the fit reconfiguration process associated to the matrix modifications.
+
+If you go to the CONCENTRATIONS tab, you will see that the obtained concentrations are quite acceptable despite about crude initial guess.
+
+If you are interested on knowing which was the last matrix composition used in the iterative process, you can obtain it by coming back to the ATTENUATORS tab of the fit configuration widget and selecting SingleLayerStrategyMaterial in the combo box of the Material Editor.
+
+|img4|
+
diff --git a/doc/source/training/quantification/img/quantification_01.png b/doc/source/training/quantification/img/quantification_01.png
new file mode 100644
index 0000000..db0e316
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_01.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_02.png b/doc/source/training/quantification/img/quantification_02.png
new file mode 100644
index 0000000..8edbd1f
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_02.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_03.png b/doc/source/training/quantification/img/quantification_03.png
new file mode 100644
index 0000000..88e0a8d
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_03.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_04.png b/doc/source/training/quantification/img/quantification_04.png
new file mode 100644
index 0000000..76b8855
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_04.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_05.png b/doc/source/training/quantification/img/quantification_05.png
new file mode 100644
index 0000000..180f910
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_05.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_06.png b/doc/source/training/quantification/img/quantification_06.png
new file mode 100644
index 0000000..9657e2e
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_06.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_07.png b/doc/source/training/quantification/img/quantification_07.png
new file mode 100644
index 0000000..0259224
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_07.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_08.png b/doc/source/training/quantification/img/quantification_08.png
new file mode 100644
index 0000000..134962b
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_08.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_09.png b/doc/source/training/quantification/img/quantification_09.png
new file mode 100644
index 0000000..74aa531
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_09.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_10.png b/doc/source/training/quantification/img/quantification_10.png
new file mode 100644
index 0000000..7b1af7c
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_10.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_11.png b/doc/source/training/quantification/img/quantification_11.png
new file mode 100644
index 0000000..6680735
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_11.png
Binary files differ
diff --git a/doc/source/training/quantification/img/quantification_12.png b/doc/source/training/quantification/img/quantification_12.png
new file mode 100644
index 0000000..05ebac3
--- /dev/null
+++ b/doc/source/training/quantification/img/quantification_12.png
Binary files differ
diff --git a/doc/source/training/quantification/index.rst b/doc/source/training/quantification/index.rst
new file mode 100644
index 0000000..1fc7f65
--- /dev/null
+++ b/doc/source/training/quantification/index.rst
@@ -0,0 +1,221 @@
+XRF Analysis
+============
+
+.. |img_01| image:: ./img/quantification_01.png
+ :width: 400px
+ :align: middle
+ :alt: XRF Spectrum
+
+.. |img_02| image:: ./img/quantification_02.png
+ :width: 400px
+ :align: middle
+ :alt: Calibration Widget
+
+.. |img_03| image:: ./img/quantification_03.png
+ :width: 400px
+ :align: middle
+ :alt: Calibrated Spectrum
+
+.. |img_04| image:: ./img/quantification_04.png
+ :width: 400px
+ :align: middle
+ :alt: Fit Region Selected
+
+.. |img_05| image:: ./img/quantification_05.png
+ :width: 400px
+ :align: middle
+ :alt: Fit Window
+
+.. |img_06| image:: ./img/quantification_06.png
+ :align: middle
+ :alt: Peak Identifier
+
+.. |img_07| image:: ./img/quantification_07.png
+ :width: 400px
+ :align: middle
+ :alt: Peak Family Selection
+
+.. |img_08| image:: ./img/quantification_08.png
+ :width: 400px
+ :align: middle
+ :alt: Initial Fit
+
+.. |img_09| image:: ./img/quantification_09.png
+ :width: 400px
+ :align: middle
+ :alt: Final Fit
+
+.. |img_10| image:: ./img/quantification_10.png
+ :width: 400px
+ :align: middle
+ :alt: Peaks Spectrum
+
+.. |img_11| image:: ./img/quantification_11.png
+ :width: 400px
+ :align: middle
+ :alt: Matrix Spectrum
+
+.. |img_12| image:: ./img/quantification_12.png
+ :width: 400px
+ :align: middle
+ :alt: One per cent Sc
+
+.. contents::
+ :local:
+
+Introduction
+------------
+
+Many synchrotron users performing X-ray fluorescence experiments are interested in imaging the distribution of elements in their samples. However, they tend to show little interest in learning how to perform quantitative X-ray fluorescence (XRF) analysis and that can lead to the obtention of wrong elemental distribution maps.
+
+One has to take into account that even for pure imaging experiments one needs to calibrate the spectra, to identify the different elements in the sample and, most of the times, perform some fitting in order to resolve overlapping peaks of different elements. At this point users might not be aware that the relative peak areas they are extracting may be wrong because they did not take into account the modification of the database peak ratios by the conditions of the experiment. Simply introducing the experimental conditions and a guestimate of the sample composition is often enough to properly extract the signal from the different elements.
+
+The additional step to take to go from pure qualitative to quantitative analysis is a very small one if a minimum of care was taken (for instance recording the acquisition time and incoming flux and a known sample has been measured).
+
+Exercise
+--------
+
+The objective of this exercise is to get familiar with x-ray fluorescence analysis. For this, we are going to work with a spectrum from a thin film standard although we'll make some simplifications.
+
+Step 1: Loading the data
+........................
+
+The data required for this exercise are supplied with PyMca and can be loaded into the program via the main window File menu following the sequence File->Open->Load Training Data->XRF Analysis.
+
+The format associated to that spectrum is the simplest that PyMca can read. It is just a single column of numbers corresponding to the counts in the different channels. Under that situation, PyMca does not know if those data belong to an XRF experiment or to something else and offers two different visualization modes. One generic and one specific to XRF.
+
+Your first task is to achieve the situation shown in the figure below where the data are present in the MCA tab of the main window in a semilogarithmic plot.
+
+|img_01|
+
+Step 2: Calibrating the data
+............................
+
+If it is your first time with PyMca, you should take a look at the `Calibration tutorial <http://www.esrf.fr/computing/bliss/downloads/pymca/calibrationtutorial.htm>`_
+
+The excitation energy was about 17.5 keV. Very often this is enough information for an initial calibration. However, this detector presented a very important offset and you will need an addition calibration point. Just imagine you have previously measured a cobalt sample and that you know that the peak around channel 1474 corresponds to the main emission line of Co.
+
+You may reach the situation illustrated below where the calibration window is shown. You have to press the OK button to validate the calibration.
+
+|img_02|
+
+At this point you should be back to the main window without any change respect to the previous situation. Prior to go any further, you should instruct PyMca about what calibration you intend to use. Unless you have changed the name of the calibration, choosing Internal in the calibration combo box should apply the just calculated one to the spectrum leading to the situation below.
+
+|img_03|
+
+Under the calibration combo box, following *Active curve uses*, you will see the calibration actually applied. It should be close to A=-0.5, B=-0.005 and C=0. (Hint: Make sure you have selected a first order calibration when calculating the calibration). If it is very different your calibration is wrong and you will experience a lot of difficulties later on.
+
+
+Step 3: Select your fit region
+..............................
+
+We already have a calibrated spectrum. The rest of the exercise will use the McaAdvancedFit window.
+
+Prior to reach that window, we should select the region of the sample we'd like to analyze. For that, we have to zoom in that region by pressing and dragging the mouse. PyMca implements a zoom stack, you can go back by pressing the mouse right button or by pressing the reset zoom icon.
+
+At the very least, you should always leave the cut at the low energy side corresponding to the low-level discriminator of your acquisition system out of the fitting region. Something around 1.0 keV should be OK in this case.
+
+PyMca (still!) implements a very poor description of the scattering peaks. Unless you absolutely need it, you will obtain better results by limiting the high energy side of the region to the rail of the scattered peaks. Something like 16.3 keV should be a good upper limit.
+
+|img_04|
+
+At this point we are ready to access the McaAdvancedFit window by pressing the fit icon and selecting the *Advanced* option.
+
+Step 4: Using the Peak Identifier
+.................................
+
+The first thing you will get is a message telling you that no peaks have been defined. PyMca has very good peak search routines and it could do a very good guess about the elements present. However, the author(s) consider that the responsibility should fall on the person carrying the analysis.
+
+In order to allow PyMca to give you some hints about what elements can be associated to a peak, you need to toggle the energy axis on. Your next target should be to obtain the image below.
+
+|img_05|
+
+If you now click on top of a peak, PyMca will show you the peaks that can be associated to that energy. If you click at around 6.9 keV. PyMca should show you the peak identifier.
+
+|img_06|
+
+You will be presented with a table of elements, peak families and rates within the family of all the elements emitting x-ray within the specified energy threshold around the selected energy.
+
+As a rule of thumb, you should aim at identifying the most intense peaks. Why? Because that can help you decide to what element they belong. For instance, the L3 lines are usually more intense than the L2 lines or L1 lines. If the program proposes you the L2 lines of one element and the L3 lines of other element, there are strong chances of having the element with the L3 lines because if it would be the element with the L2 lines there should be a stronger peak somewhere in the spectrum corresponding to the L3 lines of that element. Of course, that is to be considered as a hint. It may well happen that the intense L3 lines are hidden beneath the peak of another already identified element...
+
+Step 5: Fit Configuration
+.........................
+
+In this example you could already start adding peaks families to be fitted immediately because the sample is relatively thin and matrix effects are small. However, you should aim at doing the things properly and enter as much information as possible into the fit configuration.
+
+The experimental conditions are excitation energy around 17.5 keV, Si detector 450 micron thickness and Be window of 8 micron thickness. For the sake of simplicity assume the sample is 100 micron water and contains 500 ppm of Co. Incident beam angle is 0.1 degrees and fluorescence beam angle is 90 degrees. There is an air path between sample and detector window of 2 mm.
+
+To will enter the fit configuration by pressing the Configure button.
+
+To enter the experimental setup you will need to use the ATTENUATORS tab and the MATRIX tab. The incident beam energy is set into the BEAM tab.
+
+Concerning the FIT tab, at this point just make sure the *Stripping* check box is selected in order to have some baseline to be applied to your fit.
+
+If you have done that and you select the PEAKS tab, you will see the excitation energy in red. Below you will see the selection of the Co K lines as peaks to be fitted.
+
+|img_07|
+
+Press OK to accept the changes. You will be back to the fit window and by pressing the Fit icon or the Fit again! button you should obtain a fit similar to the one displayed below.
+
+|img_08|
+
+As you see the background still needs some adjustment. You can do it via the corresponding SETUP button at the FIT tab of the fit configuration widget.
+
+You should spend some time going to the fit configuration to add peaks and back to the fit window to perform fits. WARNING: It is advisable to save your fit configuration from the fit configuration widget via the Save button. That can save you a lot of time in case of problems because you could restart form that point.
+
+You can take the image below as encouragement.
+
+|img_09|
+
+If you need to take a look at the individual contributions of the different elements to the fitted spectrum, you can do so by selecting the *Peaks Spectrum* button.
+
+|img_10|
+
+If you want to highlight a particular element contribution, you should make the legends widget appear by pressing on Options and selecting Legends. It is not shown here in order not to make the exercise too simple (remember *No pain, no gain*).
+
+Hint. You should not need more than 18 elements to achieve the same fit quality.
+
+Step 6: Concentrations
+......................
+
+The additional step to calculate concentrations is very simple. One either needs to know some details about the system (flux, acquisition live time, solid angle) or to use an internal standard.
+
+If we have set the sample is water with 500 ppm of Co, we can go back to the fit configuration and select in the CONCENTRATIONS tab the *From matrix composition* check box. You can also enter Co as *Matrix Reference Element* if you wish.
+
+To get the concentrations is as easy as selecting the CONCENTRATIONS tab of the
+advanced fit window after performing a fit.
+
+Hint: If everything is OK, the concentrations of all the elements present in the sample should be in the vicinity of 500 ppm (0.0005 mass fraction).
+
+In real life you often do not have an internal standard. However, you could imagine that you have just measured a reference sample you have just prepared with a concentration of 500 ppm Co in water and that you want to calibrate your system. Then, obviously, the Co concentration given by the program is exactly 0.0005 because it is used as internal standard. To calibrate your system all what you have to do is to select the *From fundamental parameters* check box and modify the Active area, distance, time to match those of your experiment and finally play with the flux until the concentration of Co is back to 0.0005. From there on you will be ready to use your system without an internal standard. You would have removed the water-with-Co sample and measured our unknown sample.
+
+Step 7: Using the Matrix Spectrum
+.................................
+
+PyMca can be used to calculate the expected measured spectrum given the experimental conditions and the sample composition.
+
+If you have performed the previous steps, you just have to perform a fit and press the Matrix Spectrum button. You can see something similar to the figure below where besides the spectrum and the fit there is a spectrum corresponding to the matrix (in this case is shown in magenta but the colors may vary). In our case it is just Co what is shown.
+
+|img_11|
+
+We can use this PyMca feature to measure the thickness of layers or to estimate confidence limits. Let's take a look at the later.
+
+We go back to the fit configuration and select the Sc K-line as element family of peaks to be fitted and we perform a fit. If we go to the CONCENTRATIONS tab we'll see that PyMca reports a concentration of the order of some ppms. The question is, can we trust that information?
+
+A simple exercise is to add Sc at different amounts to the sample composition and to ask the program to calculate the matrix spectrum. We can start with a fairly large amount like 1 % to visualize where the signal should appear. Then we just have to repeat the exercise lowering the concentration until we reach a point below which we would not trust anything. The figure below shows the matrix spectrum with 1 % of Scandium.
+
+|img_12|
+
+After performing the exercise, you will easily conclude that the concentration of Sc in the sample, if any, it is below the detection limits of our system under the exact conditions of our experiment (including sample!).
+
+Step 8: Final Comments
+......................
+
+If you want, you can also observe how the changes on the calculated concentrations when changing the attenuation conditions:
+
+ - play with an air path between 1.0 mm and 100 mm (what happens at low energies?)
+ - play with a detector thickness between 10 micron and 1 mm (what happens with the concentrations at high energies?)
+
+The information to carry out this exercise is also available within PyMca. To access it, you just have to select the FILE tab of the widget appearing after a right click on the list shown after loading the file (right-mouse click on #S1 Unknown...) and *Show scan header* selection).
+
+
diff --git a/doc/source/training/tertiary/img/tertiary_01.png b/doc/source/training/tertiary/img/tertiary_01.png
new file mode 100644
index 0000000..fbf88d8
--- /dev/null
+++ b/doc/source/training/tertiary/img/tertiary_01.png
Binary files differ
diff --git a/doc/source/training/tertiary/img/tertiary_02.png b/doc/source/training/tertiary/img/tertiary_02.png
new file mode 100644
index 0000000..bfa82d7
--- /dev/null
+++ b/doc/source/training/tertiary/img/tertiary_02.png
Binary files differ
diff --git a/doc/source/training/tertiary/img/tertiary_03.png b/doc/source/training/tertiary/img/tertiary_03.png
new file mode 100644
index 0000000..5325dfc
--- /dev/null
+++ b/doc/source/training/tertiary/img/tertiary_03.png
Binary files differ
diff --git a/doc/source/training/tertiary/img/tertiary_04.png b/doc/source/training/tertiary/img/tertiary_04.png
new file mode 100644
index 0000000..69af2c7
--- /dev/null
+++ b/doc/source/training/tertiary/img/tertiary_04.png
Binary files differ
diff --git a/doc/source/training/tertiary/index.rst b/doc/source/training/tertiary/index.rst
new file mode 100644
index 0000000..3ed19a7
--- /dev/null
+++ b/doc/source/training/tertiary/index.rst
@@ -0,0 +1,65 @@
+Accounting for higher order excitations
+=======================================
+
+.. |img1| image:: ./img/tertiary_01.png
+ :width: 300px
+ :align: middle
+ :alt: Secondary Excitation Process
+
+.. |img2| image:: ./img/tertiary_02.png
+ :width: 400px
+ :align: middle
+ :alt: Fitted Steel Data
+
+.. |img3| image:: ./img/tertiary_03.png
+ :width: 400px
+ :align: middle
+ :alt: Analytical corrections
+
+.. |img4| image:: ./img/tertiary_04.png
+ :width: 400px
+ :align: middle
+ :alt: Monte Carlo corrections
+
+.. contents::
+ :local:
+
+Introduction
+------------
+
+It can happen that the X-rays emitted by a sample element j excite other element i present in the sample up to a non-negligible extent as compared to the direct excitation process. The figure below illustrates the case for secondary excitation.
+
+|img1|
+
+Obviously it may happen that the element i excite in turn other element up to a non-negligible amount and so son. PyMca can account for these processes using two totally different approaches. One based on the use of analytical formulae and one based on the use of a Monte Carlo code.
+
+The analytical approach implemented in PyMca makes use of the `formulation of D.K.G. de Boer <https://doi.org/10.1002/xrs.1300190312>`_ that is well adapted for its use with multiple-layer samples.
+
+The Monte Carlo approach uses the `XMI-MSIM code <https://doi.org/10.1016/j.sab.2012.03.011>`_ mainly developed by Tom Schoonjans and Laszlo Vincze The code can be freely downloaded `here <http://lvserver.ugent.be/xmi-msim/>`_
+
+Currently, PyMca simply evaluates the ratio between the expected measured signal considering primary excitation and the expected measured signal considering higher-order excitation. That ratio gives the correction to be applied to the concentrations calculated just considering primary excitation.
+
+Exercise
+--------
+
+We are going to learn how to account for secondary excitations using the spectrum from a stainless steel sample.
+
+The data are provided with PyMca. To access them, just start a new session of PyMca and, via the File menu, access the data following the sequence File -> Open -> Load Training Data -> Tertiary Excitation. At this point, PyMca will show you the spectrum in the MCA window.
+
+We are going to skip the usual procedure of calibrating the spectrum. Therefore we are going to press the fit icon and select the Advanced fit option to reach our usual McaAdvancedFit window where we perform our XRF analysis.
+
+A fit configuration file named Steel.cfg is also provided. As supplied, it only considers quantification following primary excitation. To load it, just press the Configure button, load the file from the file dialog that will appear after pressing the Load button and press OK to return to the McaAdvancedFit window. If you press the Fit Again! button or the fit icon, you should be able to obtain something similar to the figure below (please note the change to energy axis and logarithmic scale via the appropriate toolbar icons).
+
+|img2|
+
+At this point we can calculate the concentrations by selecting the CONCENTRATIONS tab. We can also select the DIAGNOSTICS tab. If we do so, we'll see that the program warns about secondary or tertiary excitation contributions when the correction is more than 1 %. You should see that neglecting secondary excitation would lead to overestimating the concentration of Cr in the sample by more than 60 % and that even tertiary excitation is not negligible.
+
+|img3|
+
+If XMI-MSIM is not installed, the MC Matrix Spectrum button will not be shown. If it is installed, you can also calculate the corrections using it. You just need to press the MC Matrix Spectrum button. You should get a window open where the output of the code will be shown. Under windows sometimes you need to use the 32-bit version of XMI-MSIM. The first time you run the XMI-MSIM code for a given detector and geometry it can take quite long. Subsequent runs are very fast for a Monte Carlo code. Besides showing the Monte Carlo calculated spectrum following 1 or 4 interactions in the sample, the logging window will show you the corrections we are interested on.
+
+|img4|
+
+Whether using the analytical formulas or the Monte Carlo approach, accounting for those corrections is as simple as selecting the appropriate option in the CONCENTRATIONS tab. You will see how the different concentrations are corrected following the selection of the appropriate checkbox to consider secondary, tertiary or Monte Carlo correction. If you know your samples require account for secondary or higher order excitations, you should select the appropriate checkbox of the CONCENTRATIONS tab of the fit configuration as part of the fir configuration itself.
+
+
diff --git a/doc/source/training/xraydata/img/xraydata_01.png b/doc/source/training/xraydata/img/xraydata_01.png
new file mode 100644
index 0000000..4601932
--- /dev/null
+++ b/doc/source/training/xraydata/img/xraydata_01.png
Binary files differ
diff --git a/doc/source/training/xraydata/img/xraydata_02.png b/doc/source/training/xraydata/img/xraydata_02.png
new file mode 100644
index 0000000..24dd553
--- /dev/null
+++ b/doc/source/training/xraydata/img/xraydata_02.png
Binary files differ
diff --git a/doc/source/training/xraydata/index.rst b/doc/source/training/xraydata/index.rst
new file mode 100644
index 0000000..4c6146c
--- /dev/null
+++ b/doc/source/training/xraydata/index.rst
@@ -0,0 +1,71 @@
+Customizing X-Ray Data
+======================
+
+.. |img_01| image:: ./img/xraydata_01.png
+ :align: middle
+ :alt: Initial data
+
+.. |img_02| image:: ./img/xraydata_02.png
+ :align: middle
+ :alt: Final data
+
+
+.. contents::
+ :local:
+
+Introduction
+------------
+
+A program for X-ray fluorescence analysis needs:
+
+- A database
+- A Physics engine
+- A set of algorithms for spectrum deconvolution
+- A user interface
+
+The developers of *PyMca* put the maximum degree of effort into correctness and transparency but they are not at the origin of the data used by the program. The theoretical data may not be reliable in some cases (in fact we know they are not!) and, since we do not have the time to perform a systematic study or to determine them ourselves, we have made sure the program can be modified by the user in order to adapt it to other data that the user may consider more reliable.
+
+Exercise
+--------
+
+The objective of this exercise is to teach you how to modify the theoretical data used by *PyMca*. For this, we are going to take the case of the L1-shell fluorescence yield of Pb and we are going to force *PyMca* to use a different value from the supplied default one.
+
+Step 1: Getting the data
+........................
+
+The L1-shell fluorescence yields are stored in the `LShellConstants.dat <https://github.com/vasole/fisx/blob/master/fisx_data/LShellConstants.dat>`_ file of the `fisx library <https://github.com/vasole/fisx>`_.
+
+As explained in the `Customizing PyMca section <../../customization/settings/index.html>`_, we have to download that file and put it into the data directory of the settings folder. You can do it by opening the `link <https://github.com/vasole/fisx/blob/master/fisx_data/LShellConstants.dat>`_ above in your browser, clicking on the button with the text Raw shown at the right side of the page and saving the file to the mentioned directory.
+
+Step 2: Initial verification
+............................
+
+In order to check the data *PyMca* is using, we can open the *Elements Info* tool available from the *Tools* option of the menu of the *PyMca* main window.
+
+We can click on the atomic symbol of Pb in order to display the information used by the program.
+
+|img_01|
+
+We should find a value of of 0.0932 for the lead L1-shell fluorescence yield. This value was obtained by interpolating the theoretical values in TABLE I from the article by M.H. Chen, B. Crasemann, H. Mark in *Widths and fluorescence yields of atomic L-shell vacancy states Physical Review A volume 24 number 1 (1981) 177-182*
+
+We are going to update that value with the value 0.128 recommended in Table 2 from the article by J.L. Campbell *Fluorescence yields and Coster-Kronig probabilities for the atomic L subshells. Part II: The L1 subshell revisited* with `doi:10.1016/j.adt.2008.08.002 <https://dx.doi.org/10.1016/j.adt.2008.08.002>`_
+
+DISCLAIMER: The goal of this exercise is to show you how to update the data used by the application. We are not endorsing the use of the data provided by Campbell because we have not made an exhaustive study for all the elements. Despite that, we have to say that Campbell has performed such systematic studies and the value Campbell recommends for lead is indeed much closer to the value used in our own research than the theoretical one. You SHOULD verify yourself if, when calculating concentrations using the L1, L2 and L3 lines of Pb, you find a) a systematic discrepancy of the value of the L1-derived concentrations respect to the concentration values derived from the L2 and L3 shells and b) if you can correct the discrepancy by changing the L1-shell fluorescence yield of lead.
+
+Step 3: Modifying the data
+..........................
+
+You need an editor not modifying line endings. That is usually not a problem for Linux or MacOS users. For windows users `Notepad++ <https://notepad-plus-plus.org>`_ or `Vim for windows <https://www.vim.org>`_ could be good choices.
+
+We just have to get to the line 93 of the file, replace the value 0.0932 by the value 0.128 and save the changes.
+
+Step 4: Final verification
+..........................
+
+We close *PyMca* if we did not do it yet and we start it again.
+
+If we repeat the operation described in the step 2 above, we should get now the modified value.
+
+|img_02|
+
+Please keep in mind the DISCLAIMER above.
diff --git a/doc/source/tutorials.rst b/doc/source/tutorials.rst
index 0ed1b9c..bc536ab 100644
--- a/doc/source/tutorials.rst
+++ b/doc/source/tutorials.rst
@@ -1,5 +1,5 @@
-Tutorials and sample code
-=========================
+Tutorials and Exercises
+=======================
.. toctree::
:hidden:
@@ -8,31 +8,50 @@ Tutorials and sample code
./xrf/strip-background/index.rst
./customization/index.rst
./hdf5/index.rst
+ ./training/quantification/index.rst
+ ./training/tertiary/index.rst
+ ./training/matrix/index.rst
+ ./training/xraydata/index.rst
-There are several tutorials explaining different aspects of the program.
+Things learned by practice usually require a greater effort than just reading or listening and tend to be better retained. Therefore we have prepared some `Exercises`_ to complement the usual set of `Tutorials`_ teaching different aspects of *PyMca*.
+
+Their combination should provide a good starting point to use the program.
+
+Tutorials
+---------
The `Getting Started tutorial <http://www.esrf.fr/computing/bliss/downloads/pymca/PyMcaCHESS.pdf>`_
is a very old tutorial written by Darren Dale and initially tailored to `CHESS <http://www.chess.cornell.edu>`_
-users but usefull to everybody starting to use PyMca. In case the previous link is down, you can try
+users but usefull to everybody starting to use *PyMca*. In case the previous link is down, you can try
this `alternative link <https://wiki.utep.edu/display/MASE6402MME4501/PyMCA+support>`_.
-:doc:`./hdf5/index` PyMca can deal with
-HDF5 files since version 4.4.0. You should take a look at the
-`HDF Group web site <https://portal.hdfgroup.org/display/HDF5/HDF5>`_ to know more about HDF.
-`NeXus <http://www.nexusformat.org>`_ files are only supported when using the HDF5 backend.
-
`Calibration tutorial <http://www.esrf.fr/computing/bliss/downloads/pymca/calibrationtutorial.htm>`_.
To be used if you still have some doubts about how to calibrate your spectra.
:doc:`./xrf/material-definition/index`. This tutorial will show you how to define your own materials.
+:doc:`./xrf/strip-background/index`. Description of the parameters defining your favorite background.
+
`ROI Imaging tutorial <http://www.esrf.fr/computing/bliss/downloads/pymca/roitooltutorial.htm>`_ .
-Introduction to the stack imaging capabilities of PyMca
+Introduction to the stack imaging capabilities of *PyMca*
`Kinetics tutorial <http://www.esrf.fr/computing/bliss/downloads/pymca/kineticstutorial.htm>`_ .
Illustration of the use of the ROI Imaging tool for kinetics studies.
-:doc:`./xrf/strip-background/index`. Description of the parameters defining your favorite background.
+:doc:`./hdf5/index` *PyMca* can deal with
+HDF5 files since version 4.4.0. You should take a look at the
+`HDF Group web site <https://portal.hdfgroup.org/display/HDF5/HDF5>`_ to know more about HDF.
+`NeXus <http://www.nexusformat.org>`_ files are only supported when using the HDF5 backend.
+
+:doc:`./customization/index` Description about how to provide customized settings and add-ons to *PyMca*.
+
+Exercises
+---------
+
+:doc:`./training/quantification/index`. The classical exercise to learn how to carry out XRF analysis with *PyMca*.
+
+:doc:`./training/tertiary/index`. Press-button exercise to show how to deal with secondary and higher order excitations in X-ray fluorescence quantification problems.
-:doc:`./customization/index` Description about how to add your own add-ons to PyMca.
+:doc:`./training/matrix/index`. This exercise shows the user one way to tell the program how to automatically update the sample composition.
+:doc:`./training/xraydata/index`. Exercise to teach the user how to modify the theoretical data used by *PyMca*.