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
|
|
|
Average blocks of |
|
The readout of |
|
Integral of the baseline-subtracted trace over the whole trace (trace unit times s). |
|
Zero-phase Butterworth low-pass filter of every pulse: no shift in time. |
|
Time of the maximum from the start of the trace (s). |
|
Maximum of each trace above its pretrigger mean (units of the trace). |
|
10-90% rise time of the largest pulse of each trace (s), from the last crossings of |
- 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:
cutoff_hz (float)
config (PulseConfig)
order (int)
- goldpan.algorithms.downsample(pulses, k)[source]¶
Average blocks of
ksamples (a leftover tail shorter thankis dropped); seedownsampled_configfor the readout.- Parameters:
k (int)
- goldpan.algorithms.downsampled_config(config, k)[source]¶
The readout of
downsample(pulses, k): the sample period timesk, the sample counts divided byk.- Parameters:
config (PulseConfig)
k (int)
- Return type:
- 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
loandhiof its height before the peak.NaN where the trace has no positive peak or never lies below the
lolevel before it.- Parameters:
config (PulseConfig)
lo (float)
hi (float)
- goldpan.algorithms.compute(events, quantities, channels, config=None)[source]¶
events(anEvents) with, for each ofchannels, a record of thequantities(name ->f(pulses, config)) added.ev.quantities["A"]["max"]is then one number per event.configdefaults to the readout of the detector’s main segment.- Parameters:
config (PulseConfig)