interpgap
biosigpy.tools.interpgap.interpgap ¶
interpgap(signal: ArrayLike, max_gap: int, method: str = 'linear') -> np.ndarray
Reconstruct short internal gaps without changing sample alignment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal | array_like | Real vector with finite values or NaN on a regular sampling grid. | required |
max_gap | int | Maximum number of consecutive missing samples to reconstruct. | required |
method | (linear, nearest, pchip, spline) | Interpolation method; defaults to linear. | 'linear' |
Returns:
| Name | Type | Description |
|---|---|---|
interpolated_signal | ndarray | One-dimensional copy with eligible gaps reconstructed. |
Raises:
| Type | Description |
|---|---|
TypeError | If signal is not real numeric data or max_gap is not an integer. |
ValueError | If signal is not a vector, contains infinity, max_gap is negative, or method is unsupported. |
Notes
Long gaps separate independent segments. Each segment uses only its original finite samples as support. Boundary gaps are never extrapolated. Nearest ties choose the right sample. Spline uses not-a-knot conditions, a quadratic with three knots, and a line with two knots.
Source code in src/biosigpy/tools/interpgap.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |