pybaselines.Baseline2D.imor

Baseline2D.imor(data, half_window=None, tol=0.001, max_iter=200, window_kwargs=None, **kwargs)[source]

An Improved Morphological based (IMor) baseline algorithm.

Parameters:
dataarray_like, shape (M, N)

The y-values of the measured data.

half_windowint or sequence[int, int], optional

The half-window used for the rows and columns, respectively, for the morphology functions. If a single value is given, rows and columns will use the same value. Default is None, which will optimize the half-window size using optimize_window() and window_kwargs.

tolfloat, optional

The exit criteria. Default is 1e-3.

max_iterint, optional

The maximum number of iterations. Default is 200.

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 (M, N)

The calculated baseline.

dict

A dictionary with the following items:

  • 'half_window': np.ndarray[int, int]

    The half windows used for the morphological calculations.

  • 'tol_history': numpy.ndarray

    An array containing the calculated tolerance values for each iteration. The length of the array is the number of iterations completed. If the last value in the array is greater than the input tol value, then the function did not converge.

References

Dai, L., et al. An Automated Baseline Correction Method Based on Iterative Morphological Operations. Applied Spectroscopy, 2018, 72(5), 731-739.