Skip to main content

Code style: black CI GH actions codecov Test & Upload to TestPyPI

raman_cover_img

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.

# 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.

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.

raman_fitting run examples

or these commands in the Python interpreter or in a Jupyter Notebook.

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.

# 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.

home/.raman_fitting/datafiles

The following command will attempt the indexing, preprocessing, fitting and plotting on all the files found in this folder.

# 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:

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

Metadata

Release files for raman-fitting 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raman-fitting 0.8.0
File Size Uploaded
raman_fitting-0.8.0.tar.gz 2.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for raman-fitting 0.8.0
File Interpreter ABI Platform
raman_fitting-0.8.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 2.8 MB

Release files / raman_fitting-0.8.0.tar.gz

Download URL raman_fitting-0.8.0.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
fe969b119eff753db3df745bd944c2971a149af962b248ac5fd2a2da05fdf62c
BLAKE2b-256 checksum
How to use checksums
729435a52fb1904f510db1a86cbd54c96cb472d14a97858d4c08d1431ec58f34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / raman_fitting-0.8.0-py2.py3-none-any.whl

Download URL raman_fitting-0.8.0-py2.py3-none-any.whl
Size 155.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9164e7a2c4ffdb6a2c2b1cd9ca6eed2d5f67645c849574f2a61fa89338bab240
BLAKE2b-256 checksum
How to use checksums
b37d6c7772489a474b7095abf66a994a3e5e72ae752ef9cfb5ca9c27cccceea5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.15

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page