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 ofFlatCosmologyMixin
. As example,LambdaCDM
may be flat (for the a specific set of parameter values), butFlatLambdaCDM
will be flat.Attributes Summary
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
Methods Documentation
- clone(*, meta: Mapping | None = 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:
- metamapping or
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)”.
- metamapping or
- Returns:
- newcosmo
Cosmology
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.
- newcosmo
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=<Quantity 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. For
FLRW
cosmologies this meansOde0
can be modified:>>> Planck13.clone(to_nonflat=True, Ode0=1) LambdaCDM(name='Planck13 (modified)', H0=<Quantity 67.77 km / (Mpc s)>, Om0=0.30712, Ode0=1.0, ...