astropy 5.0

Parameters
setval(filename, keyword, *args, value=None, comment=None, before=None, after=None, savecomment=False, **kwargs)

If the keyword already exists, it's value/comment will be updated. If it does not exist, a new card will be created and it will be placed before or after the specified location. If no before or after is specified, it will be appended at the end.

When updating more than one keyword in a file, this convenience function is a much less efficient approach compared with opening the file for update, modifying the header, and closing the file.

Parameters

filename : path-like or file-like

Name of the FITS file, or file object If opened, mode must be update (rb+). An opened file object or GzipFile object will be closed upon return.

keyword : str

Keyword name

value : str, int, float, optional

Keyword value (default: :None:None:`None`, meaning don't modify)

comment : str, optional

Keyword comment, (default: :None:None:`None`, meaning don't modify)

before : str, int, optional

Name of the keyword, or index of the card before which the new card will be placed. The argument before takes precedence over after if both are specified (default: :None:None:`None`).

after : str, int, optional

Name of the keyword, or index of the card after which the new card will be placed. (default: :None:None:`None`).

savecomment : bool, optional

When :None:None:`True`, preserve the current comment for an existing keyword. The argument savecomment takes precedence over comment if both specified. If comment is not specified then the current comment will automatically be preserved (default: :None:None:`False`).

ext, extname, extver :

The rest of the arguments are for extension specification. See getdata for explanations/examples.

kwargs :

Any additional keyword arguments to be passed to astropy.io.fits.open . Note: This function automatically specifies do_not_scale_image_data = True when opening the file so that values can be retrieved from the unmodified header.

Set a keyword's value from a header in a FITS file.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /astropy/io/fits/convenience.py#296
type: <class 'function'>
Commit: