pybaselines.utils.pad_edges
- pybaselines.utils.pad_edges(data, pad_length, mode='extrapolate', extrapolate_window=None, **pad_kwargs)[source]
Adds left and right edges to the data.
- Parameters:
- dataarray_like
The array of the data.
- pad_length
int The number of points to add to the left and right edges.
- mode
stror callable, optional The method for padding. Default is 'extrapolate'. Any method other than 'extrapolate' will use
numpy.pad().- extrapolate_window
int, optional The number of values to use for linear fitting on the left and right edges. Default is None, which will set the extrapolate window size equal to pad_length.
- **pad_kwargs
Any keyword arguments to pass to
numpy.pad(), which will be used if mode is not 'extrapolate'.
- Returns:
- padded_data
numpy.ndarray, shape (N + 2 * half_window,) The data with padding on the left and right edges.
- padded_data
Notes
If mode is 'extrapolate', then the left and right edges will be fit with a first order polynomial and then extrapolated. Otherwise, uses
numpy.pad().