CosmologyWrite

class astropy.cosmology.connect.CosmologyWrite(instance, cls)[source]

Bases: astropy.io.registry.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

Note

write() and to_format() currently access the same registry. This will be deprecated and formats intended for to_format should not be used here. Use Cosmology.write.help() to confirm that the format may be used to write to a file.

Parameters
*args

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

formatstr (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

mapping

Yes

Yes

No

Methods Summary

__call__(*args, **kwargs)

Call self as a function.

Methods Documentation

__call__(*args, **kwargs)[source]

Call self as a function.