raman.baseline_correction

raman.baseline_correction(y, n0=2, verbose=False, iterate=True)

Automated baseline removal algorithm. Code is based on Schulze et al., Appl. Spectrosc. 65, 75 (2011).

Works better if baseline is more flat at the beginning and end of the spectrum. If divisor is too high, there will be some ringing of the baseline. Sometimes it is better to start with a higher value for n0 to get a good baseline removal, especially when the baseline is wavy and there are strong Raman lines. More suited for spectra with dominant Raman lines than FT_baseline_correction.

Parameters:
  • y (array) – Input spectrum. If y is a list or a 2d-array of spectra, apply correction to each one.
  • n0 (int) – Initial divisor for window size, i.e. initial window size is size of spectrum divided by n0. Must be at least 1 (default = 2).
  • verbose (bool) – If True, print final number of iterations and final divisor at the end (default = False).
  • iterate (bool) – If True, automatically increase the order of the divisor until optimal baseline removal is achieved. If False, just use the value given by n0.
Returns:

Baseline corrected spectrum with same shape as y.