pybaselines.utils.optimize_window
- pybaselines.utils.optimize_window(data, increment=1, max_hits=3, window_tol=1e-06, max_half_window=None, min_half_window=None)[source]
Optimizes the morphological half-window size.
- Parameters:
- dataarray_like
The measured data values. Can be one or two dimensional.
- increment
int, optional The step size for iterating half windows. Default is 1.
- max_hits
int, optional The number of consecutive half windows that must produce the same morphological opening before accepting the half window as the optimum value. Default is 3.
- window_tol
float, optional The tolerance value for considering two morphological openings as equivalent. Default is 1e-6.
- max_half_window
int, optional The maximum allowable half-window size. If None (default), will be set to (len(data) - 1) / 2.
- min_half_window
int, optional The minimum half-window size. If None (default), will be set to 1.
- Returns:
- half_window
intornumpy.ndarray[int,int] The optimized half window size(s). If data is one dimensional, the output is a single integer, and if data is two dimensional, the output is an array of two integers.
- half_window
Notes
May only provide good results for some morphological algorithms, so use with caution.
References
Perez-Pueyo, R., et al. Morphology-Based Automated Baseline Removal for Raman Spectra of Artistic Pigments. Applied Spectroscopy, 2010, 64, 595-600.