charge_signal_proc in workflow.py, which calls functions from pedestals.py and noise_filter.py in a fixed sequence.
The goal is to subtract a per-channel baseline (pedestal) and remove several categories of noise — coherent pickup, high-frequency noise, and microphonics — while preserving the signal regions of interest (ROI).
Raw pedestal estimation
is_raw=True), which biases the result in the presence of signal.To correct for this, the code performs n_iter = 2 refinement iterations using the raw_rms_thr = 3 threshold:3 × RMS from the mean are masked out before recomputing the pedestal. The result is stored as noise_raw on the event. NaN values (used to align frames) are replaced with the pedestal mean, and the pedestal is subtracted from all waveforms.At least 10 unmasked samples are required to compute a valid RMS. Channels with fewer valid samples receive a pedestal of 0. A minimum value of
1e-5 prevents the RMS from reaching exactly zero.ROI mask refinement (pre-FFT, 2 iterations)
refine_mask function applies different algorithms depending on the wire view type.Collection view (unipolar signal) — mask_collection_signal:A region is marked as signal if it contains a pulse-like feature satisfying all of:- Duration above
low_threxceedsmin_dt = 10samples - Peak value exceeds
high_thr - Rise time (samples from start to peak) ≥
min_rise = 3 - Fall time (samples from peak to end) ≥
min_fall = 8
pad_bef = 10 samples before and pad_aft = 15 samples after.Induction view (bipolar signal) — mask_induction_signal:A region is marked as signal if it contains both a positive lobe and a negative lobe satisfying:- Positive lobe: duration ≥
min_dt = 8,low_thr = 1.8σ,high_thr = 2.5σ, rise ≥ 3, fall ≥ 1 - Negative lobe: duration ≥ 8,
low_thr = -1.8σ,high_thr = -2.5σ, rise ≥ 1, fall ≥ 3 - If the time between the positive peak and negative peak is within
max_dt_pos_neg = 20samples, the gap between the lobes is also masked
pad_bef = 10 and pad_aft = 15 samples.The default thresholds come from default_reco_parameters.json:FFT low-pass filter
default_reco_parameters.json:low_cut = 0.6MHz: frequencies at or above this value are attenuatedgaus_sigma = 0.02MHz: rolloff width of the Gaussian filterfreq = -1: no specific frequency notch is applied by default; if positive, that frequency is removed with a narrow notch (sigma = 0.001MHz)
low_cut and follows a Gaussian decay above it, centered at low_cut.Zero-padding after FFT
irfft) returns an even number of samples, causing a length mismatch. A zero is appended to both the data and mask arrays to restore the expected length.Re-compute pedestal and refine mask (post-FFT, 2 iterations, pass 2)
n_pass=2 thresholds (index 1 of low_thr / high_thr arrays), which are tuned to the filtered waveform shape.Shield coupling removal (PDVD TDE View 0 only)
Coherent noise removal (CNR)
per_view_per_card flag (default: 1):per_view_per_card = 1 (default) — coherent_noise_per_view_per_card:Channels are grouped by their (view, card) pair from the channel map. For each group, the weighted mean of non-ROI samples is computed and subtracted:capa_weight = 0: apply per-channel capacitance weights before computing the group meancalibrated = 0: apply per-channel gain calibration
per_view = 1 — coherent_noise_per_view: groups channels by view within each card slice (requires groupings to specify card sizes, default 32 channels per group).Neither flag — regular_coherent_noise: groups channels into fixed-size slices of groupings[0] = 32 channels and subtracts the masked mean.Default configuration:Microphonic noise removal
noise.microphonic.window in the configuration (-1 by default, which skips this step entirely).The centered_median_filter pads the array so that the output window is centered on each sample rather than left-aligned.