get_gap_edges

function of dascore.utils.gaps source

get_gap_edges(
    coord ,
    tolerance: dascore.utils.gaps.GapTolerance | None[GapTolerance, None] = None,
)

Return cell edges and gap locations for drawing a coordinate as cells.

Cells follow the centre convention: an edge sits halfway between neighbouring values, and across a gap each side gets a cell one step wide instead. The step is the coordinate’s declared one when it has one and the median spacing otherwise. Timedelta coordinates are converted to seconds; datetimes are kept for plotting libraries which convert them.

Parameters

Parameter Description
coord A one-dimensional monotonic coordinate (or its values).
tolerance Which spacings are gaps. None means none are.

Returns

tuple[np.ndarray, np.ndarray] Cell edges and a Boolean array marking a gap after each value.

See Also

Spool.get_gaps answers the other gap question: where whole patches fail to meet, read from the index rather than from a coordinate’s values.