GapTolerance

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. An absolute quantity or timedelta is converted into the coordinate’s own scalar by the caller which knows the units (a coordinate’s _gap_tolerance, a chunk cell’s _cell_tolerance); until then is_gap cannot be asked of it.

Examples

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_

Methods

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.