Function fetch_nuclides

pub fn fetch_nuclides<N>(
    nuclides: &[N],
    rad_type: RadType,
) -> HashMap<String, RecordSet>
where N: TryInto<Nuclide> + Clone, <N as TryInto<Nuclide>>::Error: Debug,
Expand description

Fetch multiple nuclides direct from IAEA

This automatically deserialises the raw CSV data into Records for the decay radiation type and all requested nuclides. The returned hashmap is a dictionary of key value pairs where:

  • key : Nuclide name, e.g. “Co60”
  • value : List of all matching RecordsRadType::Alpha

Note this will accept a collection of Nuclides or any &str, String, or &String that will parse into a Nuclide.

Use fetch_csv() to inspect the raw CSV data returned form the IAEA.

For example:

// Try to get the records for Sodium-22 and Cesium-137
let nuclide_data = fetch_nuclides(&["na22", "cs137"], RadType::Gamma);

for (name, records) in nuclide_data {
    println!("{name}:");
    for r in records {
        println!(" - {} keV", r.energy.display())
    }
}
Cs137:
 - 283.5 keV
 - 661.657 keV
 - 4.966 keV
 - 31.816 keV
 - 32.193 keV
 - 36.482 keV
 - 36.827 keV
 - 37.255 keV
Na22:
 - 1274.537 keV
 - 511 keV
 - 0.848 keV
 - 0.848 keV

For details of the data structure and associated convenience methods see the Record type.