pub fn calculate_scan_occurrence_gaussian(
inverse_ion_mobility: &[f64],
mean: f64,
sigma: f64,
target_p: f64,
step_size: f64,
n_lower_start: f64,
n_upper_start: f64,
) -> Vec<i32>
Expand description
Returns all scan indices (0-based) that fall into the range where Normal(mean, sigma)
has at least target_p
coverage.
For timsTOF data, inverse_ion_mobility
runs backward (highest to lowest values correspond to scans).
§Arguments
inverse_ion_mobility
: The inverse ion mobility values for all scans (descending order).mean
: The mean of the Gaussian distribution.sigma
: The standard deviation of the Gaussian distribution.target_p
: The target probability to capture.step_size
: Step size for searching bounds.n_lower_start
: Initial lower bound factor (relative to sigma).n_upper_start
: Initial upper bound factor (relative to sigma).
§Returns
A Vec<usize>
containing all scan indices (0-based) within the computed range.
§Example
use mscore::algorithm::utility::calculate_scan_occurrence_gaussian;
let inverse_ion_mobility = vec![0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3];
let scans = calculate_scan_occurrence_gaussian(
&inverse_ion_mobility,
1.1, // mean
0.001, // sigma
0.9999, // target probability
0.01, // step size
3.0, // n_lower_start
3.0 // n_upper_start
);
assert_eq!(scans, vec![2]); // Scans corresponding to 1.3 ± 1σ