from dascore.utils.gaps import GapTolerance
tol = GapTolerance.samples(1.5)
bool(tol.is_gap(2.0, step=1.0)), bool(tol.is_gap(1.4, step=1.0))
GapTolerance.absolute(0.5).is_gap(1.6, step=1.0)np.True_
| class of dascore.utils.gaps | source |
GapTolerance(
count: float | None[float, None] = None,
excess: Any = None,
)-> None
How far past one step a spacing may reach before it is a gap.
Two constructors, one predicate. samples(k) allows k steps between neighbouring samples (k = 1 is contiguity); absolute(q) allows one step plus q in the coordinate’s own units, so the excess over the step is what is bounded. resolve converts an absolute quantity or timedelta into a coordinate’s own scalar; until then is_gap cannot be asked of it.
| Name | Description |
|---|---|
| absolute |
A spacing is a gap past one step plus excess, in coordinate units.
|
| is_gap |
Whether each spacing delta is a gap against sampling step.
|
| resolve | Convert an absolute excess into a coordinate’s own scalar. |