bundles / astropy latest / astropy / io / fits / convenience / writeto
function
astropy.io.fits.convenience:writeto
source: /astropy/io/fits/convenience.py :413
Signature
def writeto ( filename , data , header = None , output_verify = exception , overwrite = False , checksum = False ) Summary
Create a new FITS file using the supplied data/header.
Parameters
filename: path-like or file-likeFile to write to. If opened, must be opened in a writable binary mode such as 'wb' or 'ab+'.
data: array or `~numpy.recarray` or `~astropy.io.fits.Group`data to write to the new file
header: `Header` object, optionalthe header associated with
data. IfNone, a header of the appropriate type is created for the supplied data. This argument is optional.output_verify: strOutput verification option. Must be one of
"fix","silentfix","ignore","warn", or"exception". May also be any combination of"fix"or"silentfix"with"+ignore",+warn, or+exception" (e.g. ``"fix+warn"). Seeastropy:verifyfor more info.overwrite: bool, optionalIf
True, overwrite the output file if it exists. Raises anOSErrorifFalseand the output file exists. Default isFalse.checksum: bool, optionalIf
True, adds bothDATASUMandCHECKSUMcards to the headers of all HDU's written to the file.
Notes
gzip, zip and bzip2 compression algorithms are natively supported. Compression mode is determined from the filename extension ('.gz', '.zip' or '.bz2' respectively). It is also possible to pass a compressed file object, e.g. gzip.GzipFile.
Aliases
-
astropy.io.fits.writeto