get_smoothed_bandshape

MonitorControl.BackEnds.get_smoothed_bandshape(spectrum, degree=None, poly_order=15, plot=False)

Do a Gaussian smoothing of the spectrum and then fit a polynomial. Optionally, the raw and smoothed data and the fitted polynomial can be plotted.

Notes

numpy.polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False) Least squares polynomial fit. Fit a polynomial:

p(x) = p[0] * x**deg + ... + p[deg]

of degree deg to points (x, y). Returns a vector of coefficients p that minimises the squared error.

:param spectrum : input data :type spectrum : list of float

:param degree : number of samples to smoothed (Gaussian FWHM) :type degree : int

:param poly_order : order of the polynomial :type poly_order : int

:param plot : plotting option :type plot : boolean

Returns

(polynomial_coefficient, smoothed_spectrum)