write_hdulist_to

mpdaf.tools.write_hdulist_to(hdulist, fileobj, overwrite=False, **kwargs)[source]

Wrapper function for astropy.io.fits.HDUList.writeto.

The aim of this function is to provide a compatible way to overwrite a file, with clobber for Astropy < 1.3 and overwrite for Astropy >= 1.3.

Original docstring follows:

Write the HDUList to a new file.

Parameters:

fileobj : file path, file object or file-like object

File to write to. If a file object, must be opened in a writeable mode.

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 an OSError (IOError for Python 2) if False and the output file exists. Default is False.

Changed in version 1.3: overwrite replaces the deprecated clobber argument.

checksum : bool

When True adds both DATASUM and CHECKSUM cards to the headers of all HDU’s written to the file.