{ } Raw JSON

bundles / astropy 7.0.1 / astropy / io / fits / convenience / update

function

astropy.io.fits.convenience:update

source: /astropy/io/fits/convenience.py :745

Signature

def   update ( filename data * args ** kwargs )

Summary

Update the specified HDU with the input data/header.

Parameters

filename : path-like or file-like

File to update. If opened, mode must be update (rb+). An opened file object or GzipFile object will be closed upon return.

data : array, `~astropy.table.Table`, or `~astropy.io.fits.Group`

The new data used for updating.

header : `Header` object, optional

The header associated with data. If None, an appropriate header will be created for the data object supplied.

ext, extname, extver

The rest of the arguments are flexible: the 3rd argument can be the header associated with the data. If the 3rd argument is not a Header, it (and other positional arguments) are assumed to be the HDU specification(s). Header and HDU specs can also be keyword arguments. For example

update(file, dat, hdr, 'sci')  # update the 'sci' extension
update(file, dat, 3)  # update the 3rd extension HDU
update(file, dat, hdr, 3)  # update the 3rd extension HDU
update(file, dat, 'sci', 2)  # update the 2nd extension HDU named 'sci'
update(file, dat, 3, header=hdr)  # update the 3rd extension HDU
update(file, dat, header=hdr, ext=5)  # update the 5th extension HDU
**kwargs

Any additional keyword arguments to be passed to astropy.io.fits.open.

Aliases

  • astropy.io.fits.update