goldpan.archive

Persistent archive of “good event” selections, keyed by series/detector/channel.

Every cut in goldpan.cuts is cheap to recompute from raw data, so this isn’t a cache – it’s a durable record of which detector_ids a particular cut (run with particular parameters, on a particular dump) actually selected, so a later notebook or a re-run with different library code can compare against what was kept before, without re-deriving it from scratch or re-reading notebook output by hand.

One HDF5 file, one group per (series, detector, channel):

/<series>/detector<N>/channel<C>
    dataset "detector_ids"   -- variable-length UTF-8 strings
    attrs: cut_name, cut_status, cut_params (JSON string), n_total,
           n_kept, dump, pretrigger_samples, glitch_samples,
           sample_period_s, source_notebook, created (ISO 8601, UTC)

Saving a group overwrites it – the archive holds the current good-event list per series/detector/channel, not a history of every past run. Only this module knows about h5py; everything else in python/ stays free of that dependency.

Functions

list_archive(path)

Return {series: {detector: {channel: n_kept}}} for every group in the archive -- a quick overview of what's been saved so far.

load_good_events(path, series, detector, channel)

Read back one (series, detector, channel) group.

save_good_events(path, series, detector, ...)

Write (or overwrite) the good-event list for one (series, detector, channel) group.

goldpan.archive.save_good_events(path, series, detector, channel, detector_ids, cut_name, *, cut_status=None, cut_params=None, n_total=None, dump=None, config=None, source_notebook=None)[source]

Write (or overwrite) the good-event list for one (series, detector, channel) group. detector_ids is any iterable of id strings (e.g. from goldpan.io.load_channel_batch, indexed by a cut’s boolean mask).

Pass cut_status (e.g. goldpan.cuts.excursion_band_AI.status) so a reader can tell at a glance whether the archived selection came from a done or under_development cut, without re-importing the library. cut_params (e.g. {"low": 0.5, "high": 0.7, "min_duration": 50}) and config (a PulseConfig) are stored as a record of exactly how the cut was run.

Parameters:
  • series (str)

  • detector (int)

  • channel (int)

  • cut_name (str)

  • cut_status (str)

  • cut_params (dict)

  • n_total (int)

  • dump (str)

  • source_notebook (str)

goldpan.archive.load_good_events(path, series, detector, channel)[source]

Read back one (series, detector, channel) group.

Returns a dict with detector_ids (a plain np.ndarray of strings) plus every attribute save_good_events wrote (cut_params is decoded back into a dict).

Parameters:
Return type:

dict

goldpan.archive.list_archive(path)[source]

Return {series: {detector: {channel: n_kept}}} for every group in the archive – a quick overview of what’s been saved so far. Returns {} if path doesn’t exist yet.

Return type:

dict