rustms::algorithm::isotope

Function convolve

Source
pub fn convolve(
    dist_a: &Vec<(f64, f64)>,
    dist_b: &Vec<(f64, f64)>,
    mass_tolerance: f64,
    abundance_threshold: f64,
    max_results: usize,
) -> Vec<(f64, f64)>
Expand description

convolve two distributions of masses and abundances

Arguments:

  • dist_a - first distribution of masses and abundances
  • dist_b - second distribution of masses and abundances
  • mass_tolerance - mass tolerance for combining peaks
  • abundance_threshold - minimum abundance for a peak to be included in the result
  • max_results - maximum number of peaks to include in the result

Returns:

  • Vec<(f64, f64)> - combined distribution of masses and abundances

ยงExamples

use rustms::algorithm::isotope::convolve;

let dist_a = vec![(100.0, 0.5), (101.0, 0.5)];
let dist_b = vec![(100.0, 0.5), (101.0, 0.5)];
let result = convolve(&dist_a, &dist_b, 1e-6, 1e-12, 200);
assert_eq!(result, vec![(200.0, 0.25), (201.0, 0.5), (202.0, 0.25)]);