python - Removing the baseline from data -
i want remove baseline , find peaks of noisy data using python (raman scattering measurements if anybody's had experience before).
following guide on peakutils library (https://pythonhosted.org/peakutils/tutorial_a.html), author fits data polynomial polyval, , finds baseline based on , subtracts it.
my questions a) why bother fitting polynomial data, why not remove baseline data is? , b) significance parameters [0.002,-0.08,5] have pass polyval? need fine-tune these own data? can explain how works me?
y2 = y + numpy.polyval([0.002,-0.08,5], x) pyplot.figure(figsize=(10,6)) pyplot.plot(x, y2) pyplot.title("data baseline") base = peakutils.baseline(y2, 2) pyplot.figure(figsize=(10,6)) pyplot.plot(x, y2-base) pyplot.title("data baseline removed")
my data of same shape seen here (below) except has had background removed.
in peakutils guide, [0.002, -0.08, 5]
pass polyval
stands y = 0.002*x^2 - 0.08*x + 5, , in order create example data looks parabolic ("right part of u-shape" baseline). have been flat, straight, or other passing shorter or longer list of polynomial coefficients. example data called y2
, sum of previous example data y
, artificially added baseline polyval
.
then apply peakutils.baseline
on result y2
, specifying parameter 2
degree of fit (again, parabolic because looks parabolic, may have try others compare). peakutils.baseline
fit parabola (i.e. calculate coefficients), return points on parabola correspond each of y2
points. finally, y2-base
data corrected baseline.
your data looks flat, there should no need correct baseline (except maybe vertical shift).
Comments
Post a Comment