{ } Raw JSON

bundles / astropy 7.0.1 / astropy / io / fits / header / Header / tofile

function

astropy.io.fits.header:Header.tofile

source: /astropy/io/fits/header.py :711

Signature

def   tofile ( self fileobj sep = '' endcard = True padding = True overwrite = False )

Summary

Writes the header to file or file-like object.

Extended Summary

By default this writes the header exactly as it would be written to a FITS file, with the END card included and padding to the next multiple of 2880 bytes. However, aspects of this may be controlled.

Parameters

fileobj : path-like or file-like, optional

Either the pathname of a file, or an open file handle or file-like object.

sep : str, optional

The character or string with which to separate cards. By default there is no separator, but one could use '\\n', for example, to separate each card with a new line

endcard : bool, optional

If True (default) adds the END card to the end of the header string

padding : bool, optional

If True (default) pads the string with spaces out to the next multiple of 2880 characters

overwrite : bool, optional

If True, overwrite the output file if it exists. Raises an OSError if False and the output file exists. Default is False.

Aliases

  • astropy.io.fits.Header.tofile