pub fn process_segment(
segment: &[f64],
sample_rate: f64,
nfft: usize,
nlap: usize,
response: &Response,
psd_periods: &[f64],
bin_left: &[f64],
bin_right: &[f64],
) -> Result<Vec<Option<f64>>>Expand description
Process one PPSD segment, replicating ObsPy’s PPSD.__process exactly.
Performs the full pipeline:
- Welch PSD —
mlab.psdwith cosine taper and linear detrend - Reorder — skip DC bin, reverse to period order
- Response removal — divide by |H(f)|² and multiply by ω² (velocity→acceleration)
- dB conversion — 10 × log₁₀(PSD)
- Period bin averaging — octave-spaced bins
Takes stationxml_rs::Response directly — no intermediate types needed.
§Arguments
segment— Time-domain samples for one PPSD segment.sample_rate— Sampling rate in Hz.nfft— FFT length for Welch’s method.nlap— Overlap samples for Welch’s method.response— Instrument response fromstationxml_rs::Channel.psd_periods— Period values (seconds) from the Welch FFT.bin_left— Left edges of period bins (seconds).bin_right— Right edges of period bins (seconds).
§Returns
Vector of Option<f64> — dB values per period bin. None for empty bins.
§Errors
Returns PpsdError if response evaluation fails (see eval_response).