calendar

function of dascore.viz.spool source

calendar(
    spool ,
    method: str = percent,
    tolerance: float = 1.5,
    group: str | collections.abc.Sequence[str, collections.abc.Sequence[str], None] = None,
    time: tuple | None[<class ’tuple, None] = None,
    ax: matplotlib.axes._axes.Axes | None[Axes, None] = None,
    figsize: tuple[tuple[float, float], None] = None,
    show: bool = False,
)-> ‘plt.Axes’

Plot how much data a spool holds on each day, as a calendar.

One row per month and one column per day of month, colored by what method asks for. The runs a day is measured against are the ones get_gaps leaves between its gaps, so a day drawn as full is a day chunk would merge end to end.

Parameters

  </tr>
  <tr>
      <td>tolerance</td>
      <td>How many samples patches may be spaced and still count as<br>contiguous. Same meaning as chunk's `tolerance`.</td>
  </tr>
  <tr>
      <td>group</td>
      <td>Attributes which separate patches into unrelated groups. Defaults<br>to the config option `patch_kind_attrs`. It decides which<br>boundaries are gaps; a day is the union of every group's data,<br>so regrouping moves a day's total only where it moves a gap.</td>
  </tr>
  <tr>
      <td>time</td>
      <td>The days to draw, as a (start, end) pair. Either end may be None<br>to run to what the spool itself states.</td>
  </tr>
  <tr>
      <td>ax</td>
      <td>A matplotlib Axes; one is created when None.</td>
  </tr>
  <tr>
      <td>figsize</td>
      <td>Size of the figure built when ax is None.</td>
  </tr>
  <tr>
      <td>show</td>
      <td>Whether to call plt.show.</td>
  </tr>
Parameter Description
spool The spool to measure.
method What each day says.
  • “percent”: how much of the day holds data, as a percentage.
    - “gap”: how much of the day does not, in seconds, log scaled.
    - “count”: how many patches overlap the day.
Note

Groups which run at once cover one day between them, not two, so a day is the measure of what they cover together and never exceeds 100%. A day the spool says nothing about is drawn grey; one it covers by nothing at all is drawn as empty, which is a different claim.

group is not a way to pick one of them: select the patches first, as spool.select(tag="temperature").viz.calendar(), and the calendar is of those alone.

A run covers one sample past the last one it states, taken from the step its group reports. Patches within sampling_group_tolerance of each other share a group and so share that step, which rounds a day’s total by at most one sample.

Examples

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

spool = dc.get_example_spool("sparse_dss")
_ = calendar(spool)
_ = calendar(spool, method="gap")