Giter Site home page Giter Site logo

barahona-research-group / ramanspy Goto Github PK

View Code? Open in Web Editor NEW
55.0 4.0 10.0 33.36 MB

RamanSPy: An open-source Python package for integrative Raman spectroscopy data analysis

Home Page: https://ramanspy.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

Python 4.63% Jupyter Notebook 95.37%
analytical-chemistry artificial-intelligence chemometrics data-analysis python raman-spectroscopy

ramanspy's People

Contributors

dgeorgiev21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ramanspy's Issues

Regarding the issue of retaining coordinate values of data

Hi!
First of all, thank you for your contribution! Ramanspy is a wonderful package and easy to use even for a code rookie like me.
I have a question about the pre-processing stage. Will the order of the data points be altered during this process? I'm currently utilizing Ramanspy for handling my 2-D Raman data (mapping data) and employing the Ramancontainer to load the data from a CSV file (attached below). I hope to retain the coordiates so that I can apply Voigt fitting with lmfit after pre-processing and then import the data to QGIS to see the FWHM value distribution.
test.csv
By the way, I've observed that some peaks appear to be eliminated during the processing. For example, my original data set had 167 peaks, but after pre-processing, the number of peaks has decreased to 166. Is this expected, or could there be a mistake in my code? Here's the code I'm currently using:
pipe = rpy.preprocessing.Pipeline([ rpy.preprocessing.despike.WhitakerHayes(), rpy.preprocessing.denoise.Gaussian(), rpy.preprocessing.baseline.ASLS(), rpy.preprocessing.normalise.MaxIntensity() ]) processed_data = pipe.apply(ramancontainer) newaxis = processed_data.spectral_axis

Thank you again for your contribution!

Can't load the Volumetric cell data

I would like to use the built-in function ramanspy.datasets.volumetric_cells(cell_type='THP-1', folder=None) from this Python package to load the dataset. However, the downloaded raw dataset files have the .wip file extension, while the provided function can only load .mat files.
I'm unsure how to proceed. I have attempted to convert the .wip files to .mat format, but it was unsuccessful.

cannot import name 'get_args' from 'typing' when importing ramanspy

reproduce:
import ramanspy as rp

python 3.7.1

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\ramanspy_init_.py", line 4, in
from . import load
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\ramanspy\load.py", line 7, in
from . import core
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\ramanspy\core.py", line 10, in
from . import plot
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\ramanspy\plot_init_.py", line 1, in
from .plot import spectra, mean_spectra, peak_dist, image, volume, peaks, show
File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\ramanspy\plot\plot.py", line 7, in
from typing import List, get_args, Union, TYPE_CHECKING
ImportError: cannot import name 'get_args' from 'typing' (C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\typing.py)

Improve computational performance for the Whittaker algorithm

Hi,

I found out that the current implementation for the Whittaker algorithm is quite heavy and it takes time to compute for a good amount of spectra.
For example for 374 spectra, the current implementation took around 74 seconds to complete the preprocessing.

I found an alternative implementation https://github.com/mhvwerts/whittaker-eilers-smoother/blob/master/whittaker_smooth.py under the CeCILL-B license thus you need to cite the author.

The code will be something like this:

def _whittaker(intensity_data, spectral_axis, lam, d):
    m = len(intensity_data)
    E = sparse.eye(m, format='csc')
    D = _speyediff(m, d, format='csc')
    coefmat = E + lam * D.conj().T.dot(D)
    z = splu(coefmat).solve(intensity_data)
    return z, spectral_axis

This solution run 374 preprocessing in 0.47 seconds.

Hope it can helps, thanks!

Extract data from Ramanspy

preprocessing_pipeline = ramanspy.preprocessing.Pipeline([
ramanspy.preprocessing.misc.Cropper(region=(200, 2200)),
ramanspy.preprocessing.despike.WhitakerHayes(),
ramanspy.preprocessing.denoise.SavGol(window_length=7, polyorder=3),
ramanspy.preprocessing.baseline.ASLS(),
ramanspy.preprocessing.normalise.MinMax(pixelwise=False),

])
preprocessed_spectrum = preprocessing_pipeline.apply(raman_spectrum)

How to extract the data X and Y columns from preprocessed_spectrum ?

Kernel Denoising attribute name

Hi, Is not possible to create the Kernel denoising object, since the subclass Kernel, which derives from PreprocessingStep, has an additional parameter called "method" which is already available in the PreprocessingStep class, thus I got the error {TypeError}Kernel.init() takes 1 positional but 2 were given.

Peak deconvolution

Hi, I've some questions about peak deconvolution using Ramanspy, in order to fit Raman data.

Is there a function to do this type of analysis ?
If yes, could you give some examples pls

Thanks for the attention.

Background Subtraction

Hi! I seem to be having an issue with background substraction. When I add it to the preprocessing protocols pipeline I get the following error:

TypeError: init() takes 1 positional argument but 2 were given

My code is as follows:

import ramanspy as rp
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

project_directory = "/Users/ps/Documents/GOM GRADients raman/"
test_s1d = rp.load.labspec("/Users/ps/Documents/GOM GRADients raman/REAL station 1 drum/s1_d_p1.txt")
rp.plot.spectra(test_s1d)

background_test = "/Users/ps/Documents/GOM GRADients raman/si substrate/si_3_102728.txt"

pipe = rp.preprocessing.protocols.Pipeline([rp.preprocessing.misc.BackgroundSubtractor(background_test),
rp.preprocessing.denoise.Gaussian()])
preprocessed_test = pipe.apply(test_s1d)

Thanks so much!

Savefig

When I use ramanspy.plot.peaks it's returns an axes.

ax = ramanspy.plot.peaks(preprocessed_spectrum, prominence=0.08)

ax.savefig('test.png')

AttributeError Traceback (most recent call last)
c:\Users\Maria Clara\OneDrive\Área de Trabalho\MAC\Raman\5A.ipynb Célula 12 line 1
----> 1 ax.savefig('test.png')

AttributeError: 'Axes' object has no attribute 'savefig'

How to transform ax in a figure?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.