GithubHelp home page GithubHelp logo

charlesll / rampy Goto Github PK

View Code? Open in Web Editor NEW
215.0 18.0 61.0 32.39 MB

Python software for spectral data processing (IR, Raman, XAS...)

License: GNU General Public License v2.0

Python 100.00%
raman python baseline spectroscopy infrared smoothing

rampy's Introduction

RamPy

=======

Build Status DOI Binder GitHub

Rampy is a Python library that aims at helping processing spectroscopic data, such as Raman, Infrared or XAS spectra.

Rampy offers various functions to, for instance, subtract baselines, resample and smooth spectra... It aims at facilitating the use of Python in processing spectroscopic data. It integrates within a workflow that uses Numpy/Scipy/Matplotlib as well as optimisation libraries such as lmfit, emcee or PyMC3, for instance.

See the documentation for more information.

rampy's People

Contributors

ammon1 avatar baldonib avatar charlesll avatar kacpergrodecki avatar oguzhanmeteozturk avatar sjfraser05 avatar snijderfrey 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  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  avatar  avatar

Watchers

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

rampy's Issues

pseudovoigt() not working with arrays

While they were not originally designed to do so, it is possible to pass arrays of x and parameters to gaussian() or lorentzian().

This does not work with pseudovoigt() because of the test line 105 of functions.py

Add mlclassification function

As there is mlregressor and mlexplorer functions, I want to add a mlclassification function.

In particular, this could make use of 1D CNN via Keras.

Any comment/feedback/help welcome!

rampy.normalize error when asking "area"

y_fit = rp.normalise(y_fit,x=x_fit,method="area") yields an error:

184 if method == "area": --> 185 if x == 0: 186 raise TypeError("Input x values for area normalisation") 187 y = y/np.trapz(y,x)
I will correct this error in rampy v0.4.3, releasing it today.

ModuleNotFoundError: No module named 'rampy'

Hello, I am trying to import the rampy package but I get an error. I am launching it from Google Collaborator. It worked fine last year.

!pip install rampy
import rampy

Requirement already satisfied: rampy in /usr/local/lib/python3.10/dist-packages (0.5.1)
Requirement already satisfied: numpy>=1.12 in /usr/local/lib/python3.10/dist-packages (from rampy) (1.23.5)
Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from rampy) (1.11.4)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.10/dist-packages (from rampy) (1.2.2)
Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from rampy) (1.5.3)
Requirement already satisfied: xlrd in /usr/local/lib/python3.10/dist-packages (from rampy) (2.0.1)
Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from rampy) (3.7.1)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->rampy) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->rampy) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->rampy) (4.47.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->rampy) (1.4.5)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->rampy) (23.2)
Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->rampy) (9.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->rampy) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->rampy) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->rampy) (2023.3.post1)
Requirement already satisfied: joblib>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->rampy) (1.3.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn->rampy) (3.2.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->rampy) (1.16.0)

ModuleNotFoundError Traceback (most recent call last)
in <cell line: 3>()
1 get_ipython().system('pip install rampy')
2
----> 3 import rampy

ModuleNotFoundError: No module named 'rampy'

If I use:
!apt install rampy
import rampy

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package rampy

ModuleNotFoundError Traceback (most recent call last)
in <cell line: 3>()
1 get_ipython().system('apt install rampy')
2
----> 3 import rampy

ModuleNotFoundError: No module named 'rampy'

Does anyone know how to fix this or what is wrong?

Thanks!
Laura

Bug in tlcorrection

If using normalisation="no" in tlcorrection, this yields an error as ycorr is not calculated.

Code quality needs improvement

Here is an incomplete list of the issues in the project.

  1. https://github.com/charlesll/rampy/blob/master/rampy/filters.py#L94
    say 1000 times "eval is a performance and security issue, it is almost never needed, I will never use eval for anything for which there exist other means, and even if I had to use eval, I promise to be very cautionous" . There is getattr for your use case.

  2. https://github.com/charlesll/rampy/blob/master/setup.py#L18
    Say 1000 times "I will be extremily careful when referencing other packages. I will always make sure that the package I reference is the one meant". There already has been malware spread by exploiting people making typos in package names.

  3. https://github.com/charlesll/rampy/blob/master/rampy/filters.py#L88
    checking in an array is inefficient, you need a preconstructed frozenset

  4. ./raw/ WUT? I guess this path is valid only for your computer.

  5. https://github.com/charlesll/rampy/blob/master/rampy/filters.py#L173 - repeated line, should be refactored

  6. https://github.com/charlesll/rampy/blob/master/rampy/__init__.pyc - pyc files must not be present in a repo. (P.S. I see that you use Windows, your user name is charles and you still use python 2.7 in 2019 even though it is completely unneeded and is being dropped)

path error in rameau

path_in in rameau is an optional argument, but actually is not used in the code.

This should be corrected asap.

synergies with infrared emission code?

Hello,

I see that rampy is used to process IR spectra, but I do not know the needs of the geophysicist community : I've developed a high-resolution infrared emission code for gases, called RADIS. Do you ever need to calculate such spectra?

In that case, I'm considering updating my code (https://github.com/radis/radis) to make the output compatible with the rampy analysis tools

add ATR correction

Implementation of the ATR infrared correction for treating ATR spectra would be great!

[Suggestion] Applying the neighbour parameter to the averaging function

Description of the suggestion
In the current state, the neigh parameter in the despiking function is only used to define the numbers of points around the spikes to calculate the replacement value for the spike.

Use case/Problem
The despiking function does not work as intended on our dataset, as the spikes seem to be broader than the default window size for the smoothing function.

Suggestion
A more flexible approach would be to allow the user to specify the window size for the smoothing function.
My suggestion would be to pass the neigh parameter to the smoothing function.

I will provide a PR in a due course.

Raman maps from Renishaw spectrometer

I think it is valuable to add new functionality- possibility to read and analyse Raman maps taken from spectrometers like Renishaw or Horiba. I have already done it on Ammon1/spectroscopy repo. Part of it is reading of (quite havy Renishaw type of files) and change it to Horiba-like (much more elegant). Next step is to make possibility to analize peak params and save it as maps of params-very usefull in Raman spectroscopy in solid state physics.
My code is based on pandas and numpy. It is not very elegant because it is quite old but I may update and upgrade it.

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.