{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "introduction_to_spectrochempy_tutorial.ipynb", "provenance": [], "collapsed_sections": [], "private_outputs": true, "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "source": [ "# Introduction to SpectroChemPy" ], "metadata": { "id": "8euCqCdE8RYw" } }, { "cell_type": "markdown", "source": [ "The **SpectroChemPy** project was developed to provide advanced tools for processing and analyzing spectroscopic data, initially for internal purposes in the [LCS (https://www.lcs.ensicaen.fr)](https://www.lcs.ensicaen.fr).\n", "\n", "**SpectroChemPy** is essentially a library written in python language and which proposes objects (`NDDataset`, and `Project`) to contain data, equipped with methods to analyze, transform or display this data in a simple way by the user.\n", "\n", "The processed data are mainly spectroscopic data from techniques such as IR, Raman or NMR, but they are not limited to this type of application, as any type of numerical data arranged in tabular form can generally serve as the main\n", "input.\n", "\n", "To follow actively this tutorial, there are several possibilities.\n", "\n", "* If you have a python distribution installed on your computer, you can\n", " download the notebooks [archives](link) or you can clone the Github\n", " repository [![Github\n", " repository\n", "](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com/spectrochempy/spectrochempy_tutorials/tree/master/source/tutorials/00_introduction_to_spectrochempy.ipynb).\n", "\n", "* You can use the pages associated with this tutorial on Bnder [![binder\n", "](https://mybinder.org/badge_logo.svg)\n", "](https://mybinder.org/v2/gh/spectrochempy/spectrochempy_tutorials/master?labpath=source%2Ftutorials%2F00_introduction_to_spectrochempy.ipynb).\n", "\n", "* Or you can also use Google Colaboratory." ], "metadata": { "id": "CJ1KVlkoOYQn" } }, { "cell_type": "markdown", "source": [ "## SpectroChemPy installation\n", "In principle when running in a classic jupyter notebook or in jupyter lab,\n", "SpectroChemPy is already installed. If it is not the case, you must install it and its package dependencies using in the terminal:\n", "\n", "```bash\n", "python -m pip install spectrochempy\n", "```\n", "\n", "or\n", "\n", "```bash\n", "conda install -c spectrocat spectrochempy\n", "```\n", "\n", "More detail on the installation for different OS can be found in the\n", "[documentation](https://www.https://www.spectrochempy.fr/latest/gettingstarted/install/index.html)" ], "metadata": { "id": "Pz__DbQkBao8" } }, { "cell_type": "markdown", "source": [ "## Loading the SpectroChemPy API\n", "\n", "The recommended way of loading SpectroChemPy in the notebook namespace is as follow:" ], "metadata": { "id": "Zg0c-xKb_hQD" } }, { "cell_type": "code", "source": [ "import spectrochempy as scp" ], "metadata": { "id": "hg44iACm2Ffd" }, "execution_count": 1, "outputs": [ { "data": { "text/html": "\n \n
\n \n \n \n \n \n   SpectroChemPy's API - v.0.4.5.dev6+gfedad6288
© Copyright 2014-2022 - A.Travert & C.Fernandez @ LCS
\n \n
\n \n " }, "metadata": {}, "output_type": "display_data" } ] }, { "cell_type": "markdown", "source": [ "## Importing experimental data\n", "\n", "Let's show a first example. In the following cell we read experimental data aquired on an IR spectrometer in the `OMNIC (spg)` format and stored in our example repository on GitHub: [spectrochempy_data/testdata](https://github.com/spectrochempy/spectrochempy_data/tree/master/testdata).\n", "\n", "We simply specified the relative path with respect to the `testdata` folder, *i.e.,* `\"irdata/nh4y-activation.spg\"`." ], "metadata": { "id": "xf8F16bg_8TU" } }, { "cell_type": "code", "source": [ "X = scp.read(\"irdata/nh4y-activation.spg\")" ], "metadata": { "id": "ayLWe5pMdqqr" }, "execution_count": 2, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ " ERROR | FileNotFoundError: [Errno 2] No such file or directory: 'irdata/nh4y-activation.spg'\n" ] } ] }, { "cell_type": "markdown", "source": [ "It is worth to note that the data are downloaded from the remote repository and stored locall in the ``datadir`` default directory. As it is stored locally, if for some reason we need to download it again, it will be faster as no connection with the remote server need to be established again." ], "metadata": { "id": "cpZeUpPns2dx" } }, { "cell_type": "markdown", "source": [ "To check that everything has been executed normally, you can print the `X` NDDataset informations." ], "metadata": { "id": "4B1CgYB7D3yL" } }, { "cell_type": "code", "source": [ "X" ], "metadata": { "id": "E2ezgwbpqG9b" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "or plot it:" ], "metadata": { "id": "B_S2K7yhF0Js" } }, { "cell_type": "code", "source": [ "_ = X.plot()" ], "metadata": { "id": "jx1EnGGOEH49" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "" ], "metadata": { "id": "vPcoJAsQF9Ie" }, "execution_count": null, "outputs": [] } ] }