Skip to main content
`Ctrl`+`K`

# FlatCosmologyMixin

class astropy.cosmology.FlatCosmologyMixin

  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.
  `nonflat` | Return the equivalent non-flat-class instance of this cosmology.

  Methods Summary

  `clone`(*[, meta, to_nonflat]) | Returns a copy of this object with updated parameters, as specified.

  Attributes Documentation

  is_flat

    Return `True`, the cosmology is flat.

  nonflat

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

  Methods Documentation

  clone(*, meta=None, to_nonflat=False, **kwargs)

    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:
      meta python:mapping or `python:None` (optional, keyword-only)

        Metadata that will update the current metadata.

      to_nonflat bool, 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:
      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.

    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 means `Ode0` 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, ...