snf_simulations.data.iaea#

Module for loading antineutrino spectrum data from the IAEA database.

Module Contents#

Functions#

_copy_packaged_spectrum_to_cache

Copy an included spectrum file for a nuclide into the package cache.

_download_spectrum_data

Download the antineutrino spectrum for a given nuclide from the IAEA database.

_get_cache_dir

Return the writable directory used for downloaded spectrum data.

_get_cache_file

Return the writable cache file path for an isotope.

_load_spectrum_file

Load in antineutrino spectrum data from a CSV file in the cache.

_parse_nuclide

Parse an isotope name into the nuclide format expected by the IAEA database.

get_antineutrino_spectrum

Load in antineutrino spectrum data for a given isotope.

Data#

API#

snf_simulations.data.iaea._CACHE_DIR_ENV_VAR#

‘SNF_SIMULATIONS_CACHE_DIR’

snf_simulations.data.iaea._copy_packaged_spectrum_to_cache(isotope_name: str) bool[source]#

Copy an included spectrum file for a nuclide into the package cache.

Parameters:

isotope_name – Name of the isotope to get the cache file for. Format should be ‘ElementMass’ (e.g. Ru106) or ‘MassElement’ (e.g. 106Ru).

Returns:

True if a bundled file exists and was copied, otherwise False.

snf_simulations.data.iaea._download_spectrum_data(isotope_name: str, timeout: float = 20.0) str[source]#

Download the antineutrino spectrum for a given nuclide from the IAEA database.

Parameters:
  • isotope_name – Name of the isotope to download data for. Format should be ‘ElementMass’ (e.g. Ru106) or ‘MassElement’ (e.g. 106Ru).

  • timeout – Timeout for the HTTP request in seconds.

Returns:

Path to the downloaded spectrum data file in the cache.

snf_simulations.data.iaea._get_cache_dir() pathlib.Path[source]#

Return the writable directory used for downloaded spectrum data.

Returns:

Path to the cache directory.

snf_simulations.data.iaea._get_cache_file(isotope_name: str) pathlib.Path[source]#

Return the writable cache file path for an isotope.

Parameters:

isotope_name – Name of the isotope to get the cache file for. Format should be ‘ElementMass’ (e.g. Ru106) or ‘MassElement’ (e.g. 106Ru).

Returns:

Path to the cache file for the isotope.

snf_simulations.data.iaea._load_spectrum_file(isotope_name: str) numpy.ndarray[source]#

Load in antineutrino spectrum data from a CSV file in the cache.

Parameters:

isotope_name – Name of the isotope to load data for. Format should be ‘ElementMass’ (e.g. Ru106) or ‘MassElement’ (e.g. 106Ru).

Returns:

Array containing energy, flux, and uncertainty.

snf_simulations.data.iaea._parse_nuclide(isotope_name: str) str[source]#

Parse an isotope name into the nuclide format expected by the IAEA database.

Parameters:

isotope_name – Name of the isotope to parse. Format should be ‘ElementMass’ (e.g. Ru106) or ‘MassElement’ (e.g. 106Ru).

Returns:

Nuclide name in the format ‘masselement’ (e.g. ‘106ru’). Note that the element symbol is converted to lowercase.

Return type:

nuclide

snf_simulations.data.iaea.get_antineutrino_spectrum(isotope_name: str) numpy.ndarray[source]#

Load in antineutrino spectrum data for a given isotope.

If the spectrum data is not already in the cache, it is downloaded from the IAEA database and saved locally before loading.

Parameters:

isotope_name – Isotope name to load the spectrum for. Format should be ‘ElementMass’ (e.g. Ru106) or ‘MassElement’ (e.g. 106Ru).

Returns:

Array containing energy, flux, and uncertainty.