I/O Functions

Input and output (I/O) functions for the three encodings used by MOC are located in a separate part of the package. This is to allow you to use the MOC class itself without needing the requirements of the I/O routines.

For general file handling, the giving the filename argument to the MOC constructor, or using the read() and write() methods may be sufficient. The dedicated I/O functions described here can be used in more specialized situations, such as interacting with FITS HDU objects or reading and writing already-open file objects.

pymoc.io.ascii

pymoc.io.ascii.write_moc_ascii(moc, filename=None, file=None)

Write a MOC to an ASCII file.

Either a filename, or an open file object can be specified.

pymoc.io.ascii.read_moc_ascii(moc, filename=None, file=None)

Read from an ASCII file into a MOC.

Either a filename, or an open file object can be specified.

pymoc.io.fits

pymoc.io.fits.write_moc_fits_hdu(moc)

Create a FITS table HDU representation of a MOC.

pymoc.io.fits.write_moc_fits(moc, filename, **kwargs)

Write a MOC as a FITS file.

Any additional keyword arguments are passed to the astropy.io.fits.HDUList.writeto method.

pymoc.io.fits.read_moc_fits(moc, filename, include_meta=False, **kwargs)

Read data from a FITS file into a MOC.

Any additional keyword arguments are passed to the astropy.io.fits.open method.

pymoc.io.fits.read_moc_fits_hdu(moc, hdu, include_meta=False)

Read data from a FITS table HDU into a MOC.

pymoc.io.json

pymoc.io.json.write_moc_json(moc, filename=None, file=None)

Write a MOC in JSON encoding.

Either a filename, or an open file object can be specified.

pymoc.io.json.read_moc_json(moc, filename=None, file=None)

Read JSON encoded data into a MOC.

Either a filename, or an open file object can be specified.