coverage

function of dascore.viz.spool source

coverage(
    spool ,
    dim: str = time,
    tolerance: float | pint.registry.Quantity | numpy.timedelta64 | None[float, Quantity, timedelta64, None] = None,
    max_shift: float | None[float, None] = None,
    group: str | collections.abc.Sequence[str, collections.abc.Sequence[str], None] = None,
    color = None,
    ax: matplotlib.axes._axes.Axes | None[Axes, None] = None,
    show: bool = False,
)-> ‘plt.Axes’

Plot what a spool covers along a dimension, and where it does not.

One lane per group of patches which could combine, drawn as the runs the group holds and the holes between them. The holes are the ones get_gaps reports, so a gap drawn here is exactly a boundary chunk starts a new output at, and the percentage on each lane is that group’s get_coverage.

Parameters

Parameter Description
spool The spool to measure.
dim The dimension to measure along.
tolerance Seams up to this many steps wide also join, or up to this width
when a quantity or timedelta (eg 1 * s); off by default. Same
meaning as chunk’s tolerance.
max_shift The seam test’s slack, in steps; None means
dascore.config.max_shift. Same meaning as chunk’s max_shift.
group Attributes which separate patches into unrelated groups; a gap
is never reported between two groups. Defaults to the config
option patch_kind_attrs.
color A mapping of “data” and “gap” to colors, overriding the default.
ax A matplotlib Axes; one is created, a lane tall per group, when
None. Pass one to say how large the plot is.
show Whether to call plt.show.
Note

The whole of what the spool holds is drawn. A part of it is a smaller spool: select it first, as spool.select(time=(start, end)).viz.coverage(), and the lanes and their percentages are of that window rather than of a window drawn over percentages of everything. To keep the whole picture and look at part of it instead – where a lane running off the edge says the data does not stop there – set the limits on the axes this returns. Labels are laid out for the extent drawn, so a zoom made that way shows fewer of them than it has room for.

Coverage is measured between patches, from the envelopes the index records, so a hole inside a patch is not visible here. A lane reading 100% says “nothing chunk would refuse to merge”, not “nothing missing”.

Examples

import dascore as dc
from dascore.viz.spool import coverage

spool = dc.get_example_spool("diverse_das")
_ = coverage(spool)
_ = coverage(spool, "distance")
_ = coverage(spool.select(time=("2020-01-03", "2020-01-04")))