{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Part 1: Basics of data processing\n", "\n", "*by Morgane Desmau & Marco Alsina*\n", "\n", "*Last update: June 2021*\n", "\n", "The following notebook explains the steps required to create a database in `araucaria`:\n", "\n", "1. Read spectra from files.\n", "2. Align spectra.\n", "3. Merge spectra and calibrate reference channel.\n", "4. Create a database with the processed spectra." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Checking version\n", "\n", "It is convenient to first check the version of `araucaria` and its dependencies. In this case we will use the [get_version()](../../utils_module.rst#araucaria.utils.get_version) function.\n", "\n", "As seen in the output, this tutorial was developed with version 0.1.9 (your version could vary)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Python version : 3.9.4\n", "Numpy version : 1.20.3\n", "Scipy version : 1.6.3\n", "Lmfit version : 1.0.2\n", "H5py version : 3.2.1\n", "Matplotlib version : 3.4.2\n", "Araucaria version : 0.1.9\n" ] } ], "source": [ "from araucaria.utils import get_version\n", "print(get_version(dependencies=True))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Retrieving filepaths\n", "\n", "`araucaria` contains spectra from different beamlines as examples and for testing purposes.\n", "The [testdata](../../testdata_module.rst) module offers routines to retrieve the respective filepaths.\n", "\n", "In this case we will read and process several scans of goethite (an iron oxyhydroxide). Spectra was measured at the Fe K-edge in the P65 beamline of DESY, Hamburg (data kindly provided by Morgane Desmau):\n", "\n", "1. 20K_GOE_Fe_K_240.00000.xdi\n", "2. 20K_GOE_Fe_K_240.00001.xdi\n", "3. 20K_GOE_Fe_K_240.00002.xdi\n", "4. 20K_GOE_Fe_K_240.00003.xdi\n", "5. 20K_GOE_Fe_K_240.00004.xdi\n", "\n", "We will use the [get_testpath()](../../testdata_module.rst#araucaria.testdata.utils.get_testpath) function to construct a list with filepaths to the scan files." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# retrieving filepaths and storing them in a list\n", "from pathlib import Path\n", "from araucaria.testdata import get_testpath\n", "\n", "fpaths = []\n", "for i in range(0,5):\n", " path = get_testpath('20K_GOE_Fe_K_240.0000%i.xdi' % i)\n", " fpaths.append(path)\n", "\n", "# checking that all filepaths are Path classes\n", "all([isinstance(p, Path) for p in fpaths])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "