pybaselines.Baseline.mwmv

Baseline.mwmv(data, half_window=None, smooth_half_window=None, pad_kwargs=None, window_kwargs=None, **kwargs)[source]

Moving window minimum value (MWMV) baseline.

Parameters:
dataarray_like, shape (N,)

The y-values of the measured data, with N data points.

half_windowint, optional

The half-window used for the morphology functions. If a value is input, then that value will be used. Default is None, which will optimize the half-window size using optimize_window() and window_kwargs.

smooth_half_windowint, optional

The half-window to use for smoothing the data after performing the morphological operation. Default is None, which will use the same value as used for the morphological operation.

pad_kwargsdict, optional

A dictionary of keyword arguments to pass to pad_edges() for padding the edges of the data to prevent edge effects from the moving average.

window_kwargsdict, optional

A dictionary of keyword arguments to pass to optimize_window() for estimating the half window if half_window is None. Default is None.

**kwargs

Deprecated since version 1.2.0: Passing additional keyword arguments is deprecated and will be removed in version 1.4.0. Pass keyword arguments using window_kwargs.

Returns:
baselinenumpy.ndarray, shape (N,)

The calculated baseline.

dict

A dictionary with the following items:

  • 'half_window': int

    The half window used for the morphological calculations.

Notes

Performs poorly when baseline is rapidly changing.

References

Yaroshchyk, P., et al. Automatic correction of continuum background in Laser-induced Breakdown Spectroscopy using a model-free algorithm. Spectrochimica Acta Part B, 2014, 99, 138-149.