{ } Raw JSON

bundles / astropy latest / astropy / io / fits / hdu / hdulist / HDUList / writeto

function

astropy.io.fits.hdu.hdulist:HDUList.writeto

source: /astropy/io/fits/hdu/hdulist.py :975

Signature

def   writeto ( self fileobj output_verify = exception overwrite = False checksum = False )

Summary

Write the HDUList to a new file.

Parameters

fileobj : str, file-like or `pathlib.Path`

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 astropy:verify for more info.

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.

checksum : bool

When True adds both DATASUM and CHECKSUM cards 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.HDUList.writeto