swiftsimio.conversions module

Convert between SWIFT internal values and astropy cosmologies.

swiftsimio.conversions.swift_neutrinos_to_astropy(N_eff: float, N_ur: float, M_nu_eV: ndarray[float], deg_nu: ndarray[float]) Quantity[source]

Convert SWIFT metadata to the neutrino information needed by astropy.

Parameters:
  • N_eff (float) – Fractional number of effective massless neutrinos at high redshift.

  • N_ur (float) – Fractional number of massless neutrino species.

  • M_nu_eV (array of floats) – Masses in eV of massive species only, up to degeneracy.

  • deg_nu (array of floats) – Fractional degeneracies of the massive neutrino species.

Returns:

out – Array of neutrino masses in eV, replicated according to degeneracy, including massless species, as desired by astropy.

Return type:

ap_m_nu

swiftsimio.conversions.swift_cosmology_to_astropy(cosmo: dict, units: SWIFTUnits) Cosmology[source]

Convert SWIFT metadata to an astropy cosmology.

Parameters:
  • cosmo (dict) – Cosmology dictionary ready straight out of the SWIFT snapshot.

  • units (SWIFTUnits) – The SWIFT Units instance associated with this snapshot.

Returns:

out – An instance of astropy.cosmology.Cosmology filled with the correct parameters.

Return type:

Cosmology