Formula

Module containing molmass helper functions.

dget.formula.divide_formulas(a: Formula, b: Formula) Tuple[int, Formula]

Divide Formula a by b. Returns the number of times b is in a and remainder.

Parameters:
  • a – numerator Formula

  • b – divisor Formula

Returns:

number of times b in a Formula of remainder

dget.formula.formula_in_formula(a: Formula, b: Formula) bool

Check if all atoms of a are in b.

Returns:

True if a in b

dget.formula.spectra_mz_spread(spectra: List[Spectrum], charge: int = 0) Spectrum

Calculte the m/z spread of the given spectra.

Each entry with the same unit mass is averaged, weighted by its relative intensity.

Parameters:

spectra – list of Spectrum to combine

Returns:

array of mean m/z values