Skip to main content

A Raman peak finder and model fitter

Project description

ramanfitter

This package seeks to provide and easy and efficient matter for fitting Raman data with Lorentzian, Gaussian, or Voigt models.

Developed by John Ferrier, NEU Physics (c) 2022

Quickstart Example

For a simple run,

import os
import numpy as np
from ramanfitter import RamanFitter

filename    = os.path.join( 'path', 'to', 'data.csv' )      # Get File
data        = np.genfromtxt( filename, delimiter = ',' )    # Open File

x           = data[ :, 0 ]                                  # Parse x-values
y           = data[ :, 1 ]                                  # Parse y-values

RF          = RamanFitter( x = x, y = y, autorun = True )   # Run Fitter automatically

components  = RF.comps                                      # Returns a dictionary of each curve plot
curveParams = RF.params                                     # Returns a dictionary of the parameters of each Lorentzian, Gaussian, or Voigt curve
bestFitLine = RF.fit_line                                   # Returns the plot data of the model

For more control over parameters

import os
import numpy as np
from ramanfitter import RamanFitter

filename    = os.path.join( 'path', 'to', 'data.csv' )      # Get File
data        = np.genfromtxt( filename, delimiter = ',' )    # Open File

x           = data[ :, 0 ]                                  # Parse x-values
y           = data[ :, 1 ]                                  # Parse y-values

RF          = RamanFitter( x = x, y = y, autorun = False )  # Run Fitter automatically


''' Each step ran when autorun = False '''
RF.NormalizeData()
RF.Denoise( ShowPlot = True )
RF.FindPeaks( showPlot = True )
RF.FitData( type = 'Voigt', showPlot = True )


components  = RF.comps                                      # Returns a dictionary of each curve plot
curveParams = RF.params                                     # Returns a dictionary of the parameters of each Lorentzian, Gaussian, or Voigt curve
bestFitLine = RF.fit_line                                   # Returns the plot data of the model

On 0.0.3, a new Mapper feature is added for handling mapped data. This example below creates a 4K video across a sweep of frequencies.

from ramanfitter.mapper import Mapper

here    = os.path.abspath( os.path.dirname( __file__ ) )
fname   = os.path.join( here, 'sample_map', 'sample.txt' )
MP      = Mapper( file = fname, display_name = "Sample 1", output_path = os.path.join( here, 'sample_map' ), delimiter = ',', provided_img=img, makePlot=False, makeVideo=True, plotType='imshow', resolution = '4k')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ramanfitter-0.0.3.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

ramanfitter-0.0.3-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file ramanfitter-0.0.3.tar.gz.

File metadata

  • Download URL: ramanfitter-0.0.3.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for ramanfitter-0.0.3.tar.gz
Algorithm Hash digest
SHA256 fc96d51254ee675849c356c95129b1098e47d365dfc381ba65a586651bf390c5
MD5 9a3b01de00e669b203ffbafc854360ca
BLAKE2b-256 eeae73c5c018bf55368e4c6b175a4b5f6bdd235134aa1a134ebaceb56a21b1cb

See more details on using hashes here.

File details

Details for the file ramanfitter-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ramanfitter-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for ramanfitter-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b0ba9e60b9145819c4312391ed01896e1ff54b28f71abe653aadecc719329619
MD5 613231d3ce08e961003148f98873cc76
BLAKE2b-256 428841b13d17c8bd21f189714133b2e2c5a727f712b0d469f2ae98f3f39840e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page