raman-fitting


Nameraman-fitting JSON
Version 0.8.0 PyPI version JSON
download
home_page
SummaryPython framework for the batch processing and deconvolution of raman spectra.
upload_time2024-03-10 20:58:14
maintainer
docs_urlNone
author
requires_python
licenseMIT License Copyright (c) 2021 David Wallace 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.
keywords raman batch processing carbonaceous materials deconvolution fitting spectroscopy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![CI GH actions](https://github.com/MyPyDavid/raman-fitting/actions/workflows/build-test-codecov.yml/badge.svg)](https://github.com/MyPyDavid/raman-fitting/actions/workflows/build-test-codecov.yml)
[![codecov](https://codecov.io/gh/MyPyDavid/raman-fitting/branch/main/graph/badge.svg?token=II9JZAODJY)](https://codecov.io/gh/MyPyDavid/raman-fitting)
[![Test & Upload to TestPyPI](https://github.com/MyPyDavid/raman-fitting/actions/workflows/upload-to-testpypi.yml/badge.svg)](https://github.com/MyPyDavid/raman-fitting/actions/workflows/upload-to-testpypi.yml)

<p align="center" width="100%">
  <img src="https://user-images.githubusercontent.com/13996213/140090631-ed7c9f51-7630-49b6-9081-fb0675a5a4c9.png" alt="raman_cover_img"  width="200px" height="100px"/>
</p>


# raman-fitting
 A Python framework that performs a deconvolution on typical parts of interest on the spectrum of carbonaceous materials.
 The deconvolutions are done with models which are composed of collections of lineshapes or peaks that are typically assigned to these spectra in scientific literature.

In batch processing mode this package will index the raman data files in a chosen folder.
First, it will try to extract a sample ID and position number from the filenames and create an index of the files in a dataframe. Over this index a preprocessing, fitting and exporting loop will start.
There are several models, each with a different combination of typical peaks, used for fitting. Each individual typical peak is defined as a class in the deconvolution/default_models folder with some added literature reference in the docstring. Here, the individual peak parameter settings can also be easily adjusted for initial values, limits, shape (eg. Lorentzian, Gaussian and Voigt) or be fixed at certain initial values.
Export is done with plots and excel files for the spectral data and fitting parameters for further analysis.


### Example plots

https://github.com/MyPyDavid/raman-fitting/wiki


### Set up virtual environment and install the package

A release is now available on PyPI, installation can be done with these commands in a terminal.
``` bash
# Setting up and activating a virtual environment
python -m venv env # python 3.11 is recommended
source env/bin/activate

# Installation from PyPI
python -m pip install raman_fitting
```

#### From source installation

The following shows how to install the package from this source repository.
Download or clone this repository in a certain folder.
``` bash
git clone https://github.com/MyPyDavid/raman-fitting.git

# set up and activate venv ...

# regular install
python -m pip install raman-fitting/

# editable/develop mode
python -m pip install -e raman-fitting/
```

### Usage

#### Post installation test run

In order to test the package after installation, please try the following command in a terminal CLI.
``` bash
raman_fitting run examples
```
or these commands in the Python interpreter or in a Jupyter Notebook.
``` python
import raman_fitting
raman_fitting.make_examples()
```
This test run should yield the resulting plots and files in the following folder. Where home means the local user home directory depending on the OS.
``` bash
# Linux
home/.raman_fitting/example_results

# For Other OSs, log messages will show:
# Results saved in ...

```

#### Fitting your own datafiles
Place your data files in the default location or change this default setting in the config.
``` bash
home/.raman_fitting/datafiles
```
The following command will attempt the indexing, preprocessing, fitting and plotting on all the files found in this folder.
``` bash
# default run mode is "normal" means over all the files found in the index
raman_fitting

# If you add a lot of files, try to check if the index is properly constructed
# before fitting them.
raman_fitting make index

# Location of index
home/.raman_fitting/datafiles/results/raman_fitting_index.csv
```

#### Datafiles

The raman data files should be .txt files with two columns of data values.
The first column should contain the Raman shift values and the second one the measured intensity.
Filenames will be parsed into a sampleID and position, in order to take the mean of the measured intensity
of several positions on the same sample.

An example of filename formatting and parsing result:
``` python
samplename1_pos1.txt => sampleID = 'samplename1', position = 1
sample2-100_3.txt => sampleID = 'sample2-100', position = 3
```
### Version

The current version is v0.8.0

### Dependencies

- python >= 3.11
- lmfit >= 1.2.0
- pandas >= 2.0.0
- scipy >= 1.10.1
- matplotlib >= 3.7.2
- numpy >= 1.24.2

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "raman-fitting",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Raman,batch processing,carbonaceous materials,deconvolution,fitting,spectroscopy",
    "author": "",
    "author_email": "David Wallace <mypydavid@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/72/94/35a52fb1904f510db1a86cbd54c96cb472d14a97858d4c08d1431ec58f34/raman_fitting-0.8.0.tar.gz",
    "platform": null,
    "description": "[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![CI GH actions](https://github.com/MyPyDavid/raman-fitting/actions/workflows/build-test-codecov.yml/badge.svg)](https://github.com/MyPyDavid/raman-fitting/actions/workflows/build-test-codecov.yml)\n[![codecov](https://codecov.io/gh/MyPyDavid/raman-fitting/branch/main/graph/badge.svg?token=II9JZAODJY)](https://codecov.io/gh/MyPyDavid/raman-fitting)\n[![Test & Upload to TestPyPI](https://github.com/MyPyDavid/raman-fitting/actions/workflows/upload-to-testpypi.yml/badge.svg)](https://github.com/MyPyDavid/raman-fitting/actions/workflows/upload-to-testpypi.yml)\n\n<p align=\"center\" width=\"100%\">\n  <img src=\"https://user-images.githubusercontent.com/13996213/140090631-ed7c9f51-7630-49b6-9081-fb0675a5a4c9.png\" alt=\"raman_cover_img\"  width=\"200px\" height=\"100px\"/>\n</p>\n\n\n# raman-fitting\n A Python framework that performs a deconvolution on typical parts of interest on the spectrum of carbonaceous materials.\n The deconvolutions are done with models which are composed of collections of lineshapes or peaks that are typically assigned to these spectra in scientific literature.\n\nIn batch processing mode this package will index the raman data files in a chosen folder.\nFirst, it will try to extract a sample ID and position number from the filenames and create an index of the files in a dataframe. Over this index a preprocessing, fitting and exporting loop will start.\nThere are several models, each with a different combination of typical peaks, used for fitting. Each individual typical peak is defined as a class in the deconvolution/default_models folder with some added literature reference in the docstring. Here, the individual peak parameter settings can also be easily adjusted for initial values, limits, shape (eg. Lorentzian, Gaussian and Voigt) or be fixed at certain initial values.\nExport is done with plots and excel files for the spectral data and fitting parameters for further analysis.\n\n\n### Example plots\n\nhttps://github.com/MyPyDavid/raman-fitting/wiki\n\n\n### Set up virtual environment and install the package\n\nA release is now available on PyPI, installation can be done with these commands in a terminal.\n``` bash\n# Setting up and activating a virtual environment\npython -m venv env # python 3.11 is recommended\nsource env/bin/activate\n\n# Installation from PyPI\npython -m pip install raman_fitting\n```\n\n#### From source installation\n\nThe following shows how to install the package from this source repository.\nDownload or clone this repository in a certain folder.\n``` bash\ngit clone https://github.com/MyPyDavid/raman-fitting.git\n\n# set up and activate venv ...\n\n# regular install\npython -m pip install raman-fitting/\n\n# editable/develop mode\npython -m pip install -e raman-fitting/\n```\n\n### Usage\n\n#### Post installation test run\n\nIn order to test the package after installation, please try the following command in a terminal CLI.\n``` bash\nraman_fitting run examples\n```\nor these commands in the Python interpreter or in a Jupyter Notebook.\n``` python\nimport raman_fitting\nraman_fitting.make_examples()\n```\nThis test run should yield the resulting plots and files in the following folder. Where home means the local user home directory depending on the OS.\n``` bash\n# Linux\nhome/.raman_fitting/example_results\n\n# For Other OSs, log messages will show:\n# Results saved in ...\n\n```\n\n#### Fitting your own datafiles\nPlace your data files in the default location or change this default setting in the config.\n``` bash\nhome/.raman_fitting/datafiles\n```\nThe following command will attempt the indexing, preprocessing, fitting and plotting on all the files found in this folder.\n``` bash\n# default run mode is \"normal\" means over all the files found in the index\nraman_fitting\n\n# If you add a lot of files, try to check if the index is properly constructed\n# before fitting them.\nraman_fitting make index\n\n# Location of index\nhome/.raman_fitting/datafiles/results/raman_fitting_index.csv\n```\n\n#### Datafiles\n\nThe raman data files should be .txt files with two columns of data values.\nThe first column should contain the Raman shift values and the second one the measured intensity.\nFilenames will be parsed into a sampleID and position, in order to take the mean of the measured intensity\nof several positions on the same sample.\n\nAn example of filename formatting and parsing result:\n``` python\nsamplename1_pos1.txt => sampleID = 'samplename1', position = 1\nsample2-100_3.txt => sampleID = 'sample2-100', position = 3\n```\n### Version\n\nThe current version is v0.8.0\n\n### Dependencies\n\n- python >= 3.11\n- lmfit >= 1.2.0\n- pandas >= 2.0.0\n- scipy >= 1.10.1\n- matplotlib >= 3.7.2\n- numpy >= 1.24.2\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2021 David Wallace  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.",
    "summary": "Python framework for the batch processing and deconvolution of raman spectra.",
    "version": "0.8.0",
    "project_urls": {
        "homepage": "https://pypi.org/project/raman-fitting/",
        "repository": "https://github.com/MyPyDavid/raman-fitting.git"
    },
    "split_keywords": [
        "raman",
        "batch processing",
        "carbonaceous materials",
        "deconvolution",
        "fitting",
        "spectroscopy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b37d6c7772489a474b7095abf66a994a3e5e72ae752ef9cfb5ca9c27cccceea5",
                "md5": "8ee26d038c4c7a78489f23883dc8d2f9",
                "sha256": "9164e7a2c4ffdb6a2c2b1cd9ca6eed2d5f67645c849574f2a61fa89338bab240"
            },
            "downloads": -1,
            "filename": "raman_fitting-0.8.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ee26d038c4c7a78489f23883dc8d2f9",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 155719,
            "upload_time": "2024-03-10T20:58:12",
            "upload_time_iso_8601": "2024-03-10T20:58:12.912380Z",
            "url": "https://files.pythonhosted.org/packages/b3/7d/6c7772489a474b7095abf66a994a3e5e72ae752ef9cfb5ca9c27cccceea5/raman_fitting-0.8.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "729435a52fb1904f510db1a86cbd54c96cb472d14a97858d4c08d1431ec58f34",
                "md5": "83fbf34ae1a49bc2efc0036a4de80c6e",
                "sha256": "fe969b119eff753db3df745bd944c2971a149af962b248ac5fd2a2da05fdf62c"
            },
            "downloads": -1,
            "filename": "raman_fitting-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "83fbf34ae1a49bc2efc0036a4de80c6e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2630361,
            "upload_time": "2024-03-10T20:58:14",
            "upload_time_iso_8601": "2024-03-10T20:58:14.946422Z",
            "url": "https://files.pythonhosted.org/packages/72/94/35a52fb1904f510db1a86cbd54c96cb472d14a97858d4c08d1431ec58f34/raman_fitting-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-10 20:58:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MyPyDavid",
    "github_project": "raman-fitting",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "raman-fitting"
}
        
Elapsed time: 0.21038s