I want to remove the baseline and ultimately find the peaks of some noisy data using python (Raman Scattering measurements if anybody's had experience with that before).
Following this guide on the PeakUtils library (https://pythonhosted.org/PeakUtils/tutorial_a.html), the author fits the data to a polynomial with polyval, and then finds a baseline based on this and subtracts it.
My questions are a) why bother fitting a polynomial to the data, why not just remove the baseline from the data as it is? and b) what significance do the parameters [0.002,-0.08,5] have that they pass to polyval? Will I need to fine-tune these for my own data? Can someone explain how this works for me?
y2 = y + numpy.polyval([0.002,-0.08,5], x)
pyplot.figure(figsize=(10,6))
pyplot.plot(x, y2)
pyplot.title("Data with baseline")
base = peakutils.baseline(y2, 2)
pyplot.figure(figsize=(10,6))
pyplot.plot(x, y2-base)
pyplot.title("Data with baseline removed")
My data is of the same shape as seen here (below) except this has obviously already had the background removed.