{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Part 2: Normalization and background removal\n", "\n", "*by Morgane Desmau & Marco Alsina*\n", "\n", "*Last update: June 2021*\n", "\n", "This notebook explains the following steps:\n", "\n", "1. Normalization of a spectrum.\n", "3. Background removal of spectrum.\n", "\n", "**Important:** This tutorial assumes you have succesfully completed the previous tutorial in the series:\n", "- [Part 1: Basics of data processing](01.basics_data_processing.ipynb)" ] }, { "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": [ "# checking version of araucaria and dependencies\n", "from araucaria.utils import get_version\n", "print(get_version(dependencies=True))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Retrieving the database filepath\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 be reading and processing a sample from a minerals database measured at the Fe K-edge in the P65 beamline of DESY, Hamburg (data kindly provided by Morgane Desmau):\n", "\n", "1. Fe_database.h5\n", "\n", "We will use the [get_testpath()](../../testdata_module.rst#araucaria.testdata.utils.get_testpath) function to retrieve the filepath to the database." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# retrieving filepath\n", "from pathlib import Path\n", "from araucaria.testdata import get_testpath\n", "\n", "fpath = get_testpath('Fe_database.h5')\n", "\n", "# checking that filepath is a Path class\n", "isinstance(fpath, Path)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "