Skip to main content

eval_response

Function eval_response 

Source
pub fn eval_response(response: &Response, freqs: &[f64]) -> Result<Vec<f64>>
Expand description

Evaluate full instrument response |H(f)|² at given frequencies.

Walks all stages in stationxml_rs::Response::stages, evaluating PAZ, FIR, and Coefficients stages. Returns the product of all stage |H(f)|² values.

FIR coefficients are DC-normalized (divided by their sum) to match evalresp behavior. Symmetry expansion is handled for Even and Odd FIR filters.

§Arguments

  • response — Instrument response from a stationxml_rs::Channel.
  • freqs — Frequencies (Hz) at which to evaluate the response.

§Returns

Vector of |H(f)|² values, same length as freqs.

§Errors

Returns PpsdError if:

§Examples

let inv = stationxml_rs::read_from_file("station.xml").unwrap();
let response = inv.networks[0].stations[0].channels[0]
    .response.as_ref().unwrap();
let freqs: Vec<f64> = (1..=100).map(|i| i as f64 * 0.1).collect();
let h_sq = ppsd_rs::eval_response(response, &freqs).unwrap();
assert_eq!(h_sq.len(), freqs.len());