Skip to main content
`Ctrl`+`K`

# CosmologyWrite

class astropy.cosmology.io.CosmologyWrite(instance, cls)

  Bases: `UnifiedReadWrite`

  Write this Cosmology object out in the specified format.

  This function provides the Cosmology interface to the astropy unified I/O layer. This allows easily writing a file in supported data formats using syntax such as:

      >>> from astropy.cosmology import Planck18
      >>> Planck18.write('<file name>')

  Get help on the available writers for `Cosmology` using the `help()` method:

      >>> Cosmology.write.help()  # Get help writing and list supported formats
      >>> Cosmology.write.help(format='<format>')  # Get detailed help on format
      >>> Cosmology.write.list_formats()  # Print list of available formats

  Parameters:
    *args

      Positional arguments passed through to data writer. If supplied the first argument is the output filename.

    format `python:str` (optional, keyword-only)

      File format specifier.

    **kwargs

      Keyword arguments passed through to data writer.

  Notes

  The available built-in formats are:

  Format | Read | Write | Auto-identify
  --- | --- | --- | ---
  astropy.cosmology | Yes | Yes | Yes
  astropy.model | Yes | Yes | Yes
  astropy.row | Yes | Yes | Yes
  astropy.table | Yes | Yes | Yes
  mapping | Yes | Yes | Yes
  yaml | Yes | Yes | No

  Methods Summary

  `__call__`(*args, **kwargs) | Call self as a function.

  Methods Documentation

  __call__(*args, **kwargs)

    Call self as a function.