fitsmgmt.header.hedit

fitsmgmt.header.hedit(
    item,
    keys,
    values,
    comments=None,
    befores=None,
    afters=None,
    add=False,
    output=None,
    overwrite=False,
    output_verify='fix',
    verbose=True,
)

Edit FITS header keyword values.

Parameters

item : astropy header, path-like, ~astropy.nddata.CCDData-like

The FITS file or header to edit. If ~astropy.io.fits.Header, it is updated inplace.

keys : str, list-like of str

The key to edit.

values : str, numeric, or list-like of such

The new value. To pass one single iterable (e.g., [1, 2, 3]) for one single key, use a list of it (e.g., [[1, 2, 3]]) to circumvent the problem.

comments : str, list-like of str = None

Comments to add.

add : bool, optional. = False

Whether to add the key if it is not in the header. Default: False.

befores : str, int, list-like of such = None

Name of the keyword, or index of the Card before which this card should be located in the header, or after which this card should be located. The argument before takes precedence over after if both specified. Default: None.

afters : str, int, list-like of such = None

Name of the keyword, or index of the Card before which this card should be located in the header, or after which this card should be located. The argument before takes precedence over after if both specified. Default: None.

output : StrPathLike | None = None

The output file. Default: None.

Returns

ccd : ~astropy.nddata.CCDData

The header-updated ~astropy.nddata.CCDData. None if item was pure ~astropy.io.fits.Header.