FlatFLRWMixin

class astropy.cosmology.FlatFLRWMixin(*args, **kw)[source]

Bases: FlatCosmologyMixin

Mixin class for flat FLRW cosmologies. Do NOT instantiate directly. Must precede the base class in the multiple-inheritance so that this mixin’s __init__ proceeds the base class’. Note that all instances of FlatFLRWMixin are flat, but not all flat cosmologies are instances of FlatFLRWMixin. As example, LambdaCDM may be flat (for the a specific set of parameter values), but FlatLambdaCDM will be flat.

Attributes Summary

Ode0

Omega dark energy; dark energy density/critical density at z=0.

Otot0

Omega total; the total density/critical density at z=0.

is_flat

Return True, the cosmology is flat.

nonflat

Return the equivalent non-flat-class instance of this cosmology.

Methods Summary

Otot(z)

The total density parameter at redshift z.

clone(*[, meta, to_nonflat])

Returns a copy of this object with updated parameters, as specified.

Attributes Documentation

Ode0

Omega dark energy; dark energy density/critical density at z=0.

Otot0

Omega total; the total density/critical density at z=0.

is_flat

Return True, the cosmology is flat.

nonflat

Methods Documentation

Otot(z)[source]

The total density parameter at redshift z.

Parameters:
zQuantity-like [‘redshift’], numpy:array_like, or Number

Input redshifts.

Returns:
Ototndarray or python:float

Returns float if input scalar. Value of 1.

clone(*, meta: Optional[Mapping] = None, to_nonflat: bool = None, **kwargs: Any)[source]

Returns a copy of this object with updated parameters, as specified.

This cannot be used to change the type of the cosmology, except for changing to the non-flat version of this cosmology.

Parameters:
metapython:mapping or python:None (optional, keyword-only)

Metadata that will update the current metadata.

to_nonflatbool or python:None, optional keyword-only

Whether to change to the non-flat version of this cosmology.

**kwargs

Cosmology parameter (and name) modifications. If any parameter is changed and a new name is not given, the name will be set to “[old name] (modified)”.

Returns:
newcosmoCosmology subclass instance

A new instance of this class with updated parameters as specified. If no arguments are given, then a reference to this object is returned instead of copy.

Examples

To make a copy of the Planck13 cosmology with a different matter density (Om0), and a new name:

>>> from astropy.cosmology import Planck13
>>> Planck13.clone(name="Modified Planck 2013", Om0=0.35)
FlatLambdaCDM(name="Modified Planck 2013", H0=67.77 km / (Mpc s),
  Om0=0.35, ...

If no name is specified, the new name will note the modification.

>>> Planck13.clone(Om0=0.35).name
'Planck13 (modified)'

The keyword ‘to_nonflat’ can be used to clone on the non-flat equivalent cosmology.

>>> Planck13.clone(to_nonflat=True)
LambdaCDM(name="Planck13", ...
>>> Planck13.clone(H0=70, to_nonflat=True)
LambdaCDM(name="Planck13 (modified)", H0=70.0 km / (Mpc s), ...

With ‘to_nonflat’ True, Ode0 can be modified.

>>> Planck13.clone(to_nonflat=True, Ode0=1)
LambdaCDM(name="Planck13 (modified)", H0=67.77 km / (Mpc s),
          Om0=0.30712, Ode0=1.0, ...