galapy.Cosmology

The Cosmology module defines a Cosmology class whose just a wrapper for interpolation on grid of Luminosity Distances and Ages

Classes

CSM(cosmo)

Class for cosmological computations.

class galapy.Cosmology.CSM(cosmo)

Class for cosmological computations. It is built using pre-computed redshift-dependent quantities useful for transforming energies radiated per unit wavelength into fluxes from objects at a given distance.

Parameters:

cosmo (string or dictionary) – If a string is passed, it should name one of the pre-computed cosmologies available in the database. Available cosmologies are ('WMAP7', 'WMAP9', 'Planck15', 'Planck18'). If a dictionary is passed, the class expects to find 3 key-value couples: (i) key = ‘redshift’, value = an array of redshift values; (ii) key = ‘luminosity_distance’, value = an array of luminosity distances corresponding to the redshift values of the first key-value couple; (iii) key = ‘age’, value = an array of ages of the Universe corresponding to the redshift values of the first key-value couple. All these arrays should have the same length.

DL

interpolator interface to luminosity distance

Type:

galapy.internal.interp.lin_interp

UA

interpolator interface to age of the universe

Type:

galapy.internal.interp.lin_interp

Examples

Interpolator attributes can be called as functions that take as input a redshift value (or an array of redshift values):

>>> from galapy.Cosmology import CSM
>>> csm = CSM('Planck18')
>>> csm.DL(1.0)
6791.26894

The returned value is in MegaParsecs for the luminosity distance and in years for the age.

to_flux(redshift, restframe_wavelength, luminosity)

Converts a restframe luminosity to the flux received at a given redshift.

\[S_{\lambda_O} = \lambda_R^2 L_\text{tot}(\lambda_R) (1+z) / (4 \pi c D_L^2 )\]
Parameters:
  • redshift (float) – redshift of the source

  • restframe_wavelength (array-like) – rest-frame wavelength grid

  • luminosity (array-like) – rest-frame luminosity grid

Returns:

a flux in milliJansky

Return type:

array-like