matchms.filtering.metadata_processing.derive_ionmode module

matchms.filtering.metadata_processing.derive_ionmode.derive_ionmode(spectrum_in: Spectrum, clone: bool | None = True) Spectrum | None[source]

Derive missing ionmode based on adduct.

Some input formates (e.g. MGF files) do not always provide a correct ionmode. This function reads the adduct from the metadata and uses this to fill in the correct ionmode where missing.

Parameters:
  • spectrum_in – Input spectrum.

  • clone – Optionally clone the Spectrum.

Return type:

Spectrum object with ionmode attribute set.