interference_database.py¶
ICP-MS Interference Database for spICP-ToF-MS
Comprehensive database of known spectral interferences including: - Isobaric (same nominal mass from different elements) - Polyatomic / Argide (ArO+, ArAr+, ArN+, ArCl+, etc.) - Oxide (MO+, MOH+) - Chloride (MCl+) - Doubly-charged (M2+) - Nitride / Hydride adducts
Used for: 1. Per-particle interference diagnosis 2. Smart isotope auto-selection (scoring function) 3. Visual warnings in periodic table and plots
References: May & Wiedmeyer, Atomic Spectroscopy 19(5), 150-155 (1998) Thomas, Practical Guide to ICP-MS, 3rd Ed. (2013) Balcaen et al., Anal. Chim. Acta 894, 7-19 (2015)
Constants¶
| Name | Value |
|---|---|
PLASMA_SPECIES |
frozenset({'Ar', 'O', 'N', 'H', 'C'}) |
Functions¶
get_interferences_for_mass¶
Get all known interferences for a given nominal mass.
Args:
nominal_mass: Integer nominal mass (e.g. 56 for 56Fe)
Returns:
List of interference dicts, empty if none known
get_particle_relevant_interferences¶
Get interferences that are plausible for a specific particle based on which elements were co-detected.
Plasma-based interferences (ArO+, Ar2+, etc.) are always included. Non-plasma interferences are only included if ALL required non-plasma components are present in the particle.
Args:
nominal_mass: Integer nominal mass being evaluatedelements_in_particle: Set of element symbols detected in this particle
Returns:
List of plausible interference dicts
get_worst_severity¶
Get the worst (most severe) interference severity from a list.
Args:
interferences: List of interference dicts
Returns:
'critical', 'major', 'minor', or 'none'
has_any_interference¶
Quick check if a nominal mass has any known interferences.
Args:
nominal_mass: Integer nominal mass
Returns:
True if interferences are known
score_isotope¶
def score_isotope(mass: float, abundance: float, interferences: list, abundance_weight: float = 1.0, interference_weight: float = 50.0, min_abundance: float = 0.5) → float
Score an isotope for auto-selection. Higher score = better choice.
The score balances abundance (we want high signal) against interference risk (we want clean measurements).
Score = abundance - (severity_penalty * interference_weight)
For isotopes below min_abundance, a heavy penalty is applied to avoid selecting isotopes with too little signal.
Args:
mass: Exact isotope massabundance: Natural abundance as percentage (0-100)interferences: List of interference dicts for this massabundance_weight: Weight for abundance term (default 1.0)interference_weight: Penalty weight per interference (default 50.0)min_abundance: Minimum abundance % to consider (default 0.5)
Returns:
Float score (higher is better)
get_best_isotope¶
def get_best_isotope(element_data: dict, available_masses: list = None, abundance_weight: float = 1.0, interference_weight: float = 50.0, min_abundance: float = 0.5) → Optional[dict]
Select the best isotope for an element based on abundance and interference scoring.
Args:
element_data: Element dict from PeriodicTableWidget containing'symbol', 'isotopes' listavailable_masses: Optional list of masses available in the data.If provided, only isotopes matching available masses areconsidered (tolerance 0.5 Da).abundance_weight: Weight for abundance in scoringinterference_weight: Weight for interference penaltymin_abundance: Minimum abundance to consider
Returns:
Best isotope dict {'mass', 'abundance', 'label', 'score','interferences'} or None if no isotopes available
build_smart_preferred_isotopes¶
Build a complete preferred isotopes dictionary using smart scoring.
This replaces the hardcoded PREFERRED_ISOTOPES dict in IsotopeDisplay.
Args:
elements_data: List of element dicts from PeriodicTableWidgetavailable_masses: Optional list of available masses
Returns:
Dict mapping element symbol to preferred isotope label stringe.g. {'Ca': '44Ca', 'Fe': '57Fe', 'Au': '197Au'}
get_isotope_interference_summary¶
Get a summary of all isotopes for an element with their interference status, for display in the periodic table isotope panel.
Args:
element_data: Element dict from PeriodicTableWidgetavailable_masses: Optional list of available masses
Returns:
List of dicts with keys:mass, abundance, label, nominal_mass,has_interference, worst_severity, interferences, scoreSorted by mass.