write_fits_to¶
-
mpdaf.tools.
write_fits_to
(filename, data, overwrite=False, **kwargs)[source]¶ Wrapper function for
astropy.io.fits.writeto
.The aim of this function is to provide a compatible way to overwrite a file, with
clobber
for Astropy < 1.3 andoverwrite
for Astropy >= 1.3.Original docstring follows:
Create a new FITS file using the supplied data/header.
Parameters: filename : file path, file object, or file like object
File to write to. If opened, must be opened in a writeable binary mode such as ‘wb’ or ‘ab+’.
data : array, record array, or groups data object
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 : str
Output 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"
). See Verification options for more info.overwrite : bool, optional
If
True
, overwrite the output file if it exists. Raises anOSError
(IOError
for Python 2) ifFalse
and the output file exists. Default isFalse
.Changed in version 1.3:
overwrite
replaces the deprecatedclobber
argument.checksum : bool, optional
If
True
, adds bothDATASUM
andCHECKSUM
cards to the headers of all HDU’s written to the file.