goldpan.algorithms

Trace algorithms: filters and per-trace quantities (ported from pulsedata.algorithms of scdms-analysis-tools).

Like the rest of the package they work on arrays shaped (..., n_samples) and take the readout as a config; the baseline is the pretrigger window of that config (the collaboration version used a fixed 10 ms, which is the window of the Z7 preset). Units follow the trace (amps for Z7 traces) and seconds:

clean = lowpass(pulses, 50e3, config)                      # a filtered copy
peak = pulse_max(pulses, config)                           # one number per trace
ev2 = compute(ev, {"max": pulse_max, "tmax": max_time}, channels=["A"])      # as quantities of an Events

A quantity is any function f(pulses, config) returning one number per trace; compute adds the results to an Events as one record per channel (ev2.quantities["A"]["max"]). The baseline mean, std and subtraction already exist as quantities.pretrigger_mean, quantities.pretrigger_std and operations.baseline_subtract.

Functions

compute(events, quantities, channels[, config])

events (an Events) with, for each of channels, a record of the quantities (name -> f(pulses, config)) added.

downsample(pulses, k)

Average blocks of k samples (a leftover tail shorter than k is dropped); see downsampled_config for the readout.

downsampled_config(config, k)

The readout of downsample(pulses, k): the sample period times k, the sample counts divided by k.

integral(pulses, config)

Integral of the baseline-subtracted trace over the whole trace (trace unit times s).

lowpass(pulses, cutoff_hz, config[, order])

Zero-phase Butterworth low-pass filter of every pulse: no shift in time.

max_time(pulses, config)

Time of the maximum from the start of the trace (s).

pulse_max(pulses, config)

Maximum of each trace above its pretrigger mean (units of the trace).

rise_time(pulses, config[, lo, hi])

10-90% rise time of the largest pulse of each trace (s), from the last crossings of lo and hi of its height before the peak.

goldpan.algorithms.lowpass(pulses, cutoff_hz, config, order=4)[source]

Zero-phase Butterworth low-pass filter of every pulse: no shift in time.

The same magnitude response as scipy.signal.sosfiltfilt (1 / (1 + (f / cutoff) ** (2 * order))), applied with the FFT after odd extension of both ends so that the edges do not ring; numpy only. It agrees with scipy away from the edges (see the test).

Parameters:
goldpan.algorithms.downsample(pulses, k)[source]

Average blocks of k samples (a leftover tail shorter than k is dropped); see downsampled_config for the readout.

Parameters:

k (int)

goldpan.algorithms.downsampled_config(config, k)[source]

The readout of downsample(pulses, k): the sample period times k, the sample counts divided by k.

Parameters:
Return type:

PulseConfig

goldpan.algorithms.pulse_max(pulses, config)[source]

Maximum of each trace above its pretrigger mean (units of the trace).

Parameters:

config (PulseConfig)

goldpan.algorithms.max_time(pulses, config)[source]

Time of the maximum from the start of the trace (s).

Parameters:

config (PulseConfig)

goldpan.algorithms.integral(pulses, config)[source]

Integral of the baseline-subtracted trace over the whole trace (trace unit times s).

Parameters:

config (PulseConfig)

goldpan.algorithms.rise_time(pulses, config, lo=0.1, hi=0.9)[source]

10-90% rise time of the largest pulse of each trace (s), from the last crossings of lo and hi of its height before the peak.

NaN where the trace has no positive peak or never lies below the lo level before it.

Parameters:
goldpan.algorithms.compute(events, quantities, channels, config=None)[source]

events (an Events) with, for each of channels, a record of the quantities (name -> f(pulses, config)) added.

ev.quantities["A"]["max"] is then one number per event. config defaults to the readout of the detector’s main segment.

Parameters:

config (PulseConfig)