goldpan.data¶
The in-memory container of one detector’s events: traces, quantities, readout, provenance.
This is the middle of the design in GoldpanGoldsluice/2026-10-25 (log repository): file formats live in adapters, the
functions of goldpan are pure, and what passes between them is an Events, immutable. The simplest version is
built first: one detector, and the traces of a channel are held in named segments (here only the default,
"main"), so that hybrid sampling later (a coarse and a fine segment) changes no signature and no file.
An Events has
a
Detector: its name, its channels (name, role, the readout unit and input they come through) and itsReadout(the segments of a trace, each with aPulseConfig);traces:{(channel, segment): array of shape (n_events, n_samples_of_the_segment)}, read-only (useev.trace(channel));quantities: an Awkward Array, one record per event. Its first fields identify the event,series,dumpandevent(event numbers restart in every dump), andt_trigger(seconds on the clock named inmeta["clock"]) may follow; the rest are the quantities (RQs). Flat numbers and variable-length lists are both fields.meta: provenance (source files, program versions, units of the quantities, the clock).
Nothing here opens a file. Build one by hand with Events.from_arrays (for a notebook or a test) or get one from an
adapter.
Module Attributes
The name of the default segment of a trace. |
|
The fields that identify an event in |
|
The optional field with the trigger time in seconds, on the clock named in |
Classes
|
|
|
|
|
|
|
|
|
- goldpan.data.MAIN = 'main'¶
The name of the default segment of a trace.
- goldpan.data.KEY_COLUMNS = ('series', 'dump', 'event')¶
The fields that identify an event in
Events.quantities; they cannot be replaced bywith_quantities.
- goldpan.data.TIME_COLUMN = 't_trigger'¶
The optional field with the trigger time in seconds, on the clock named in
Events.meta["clock"].
- class goldpan.data.ChannelInfo(name: str, role: str | None = None, unit: str | None = None, input: str | None = None)[source]¶
Bases:
object
- class goldpan.data.Segment(name: str, n_samples: int, config: goldpan.config.PulseConfig, start_s: float | None)[source]¶
Bases:
object- Parameters:
name (str)
n_samples (int)
config (PulseConfig)
start_s (float | None)
- name: str¶
mainfor an ordinary trace,coarseandfinefor hybrid sampling.- Type:
The segment’s name
- config: PulseConfig¶
its pretrigger window, glitch samples and sample period.
- Type:
The readout of this segment
- start_s: float | None¶
Time of the first sample relative to the trigger, in seconds (negative before it);
Noneif unknown.
- classmethod main(n_samples, config)[source]¶
The ordinary single segment: the trigger is sample
config.pretrigger_samples.- Parameters:
n_samples (int)
config (PulseConfig)
- Return type:
- class goldpan.data.Readout(segments: tuple)[source]¶
Bases:
object- Parameters:
segments (tuple)
- classmethod single(n_samples, config)[source]¶
A readout with the one segment
main.- Parameters:
n_samples (int)
config (PulseConfig)
- Return type:
- class goldpan.data.Detector(name: str, channels: tuple, readout: goldpan.data.Readout)[source]¶
Bases:
object
- class goldpan.data.Events(detector: goldpan.data.Detector, traces: Mapping[tuple, numpy.ndarray], quantities: awkward.highlevel.Array, meta: Mapping[str, Any] = <factory>)[source]¶
Bases:
object- Parameters:
- quantities: Array¶
the key fields, the optional
t_trigger, then the quantities.- Type:
One record per event
- classmethod from_arrays(detector, traces, *, series='', dump='', event=None, quantities=None, meta=None)[source]¶
Build
Eventsby hand:tracesis{channel: (n_events, n_samples)}(segmentmain).seriesanddumpare one value for every event or one per event;eventdefaults to 0, 1, 2, …quantitiesadds more columns.
- trace(channel, segment='main')[source]¶
The read-only array
(n_events, n_samples)of a channel’s segment.
- time_axis(segment='main')[source]¶
Time of each sample of
segment, seconds relative to the trigger, from this detector’s own readout.
- select(where)[source]¶
The events where
whereis True (a boolean array of lengthn_events) or at the given integer positions.- Return type: