FlatCosmologyMixin

class astropy.cosmology.FlatCosmologyMixin[source]

Bases: object

Mixin class for flat cosmologies. Do NOT instantiate directly. Note that all instances of FlatCosmologyMixin are flat, but not all flat cosmologies are instances of FlatCosmologyMixin. As example, LambdaCDM may be flat (for the a specific set of parameter values), but FlatLambdaCDM will be flat.

Attributes Summary

is_flat

Return True, the cosmology is flat.

Methods Summary

clone(*[, meta, to_nonflat])

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

nonflat()

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

Attributes Documentation

is_flat

Return True, the cosmology is flat.

Methods Documentation

clone(*, meta: Optional[Mapping] = None, to_nonflat: bool = False, **kwargs)[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, 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), ...
abstract nonflat() _CosmoT[source]

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