astropy 5.0

NotesParametersBackRef
req_cards(self, keyword, pos, test, fix_value, option, errlist)

Notes

If pos=None , the card can be anywhere in the header. If the card does not exist, the new card will have the fix_value as its value when created. Also check the card's value by using the test argument.

Parameters

keyword : str

The keyword to validate

pos : int, callable

If an int , this specifies the exact location this card should have in the header. Remember that Python is zero-indexed, so this means pos=0 requires the card to be the first card in the header. If given a callable, it should take one argument--the actual position of the keyword--and return :None:None:`True` or :None:None:`False`. This can be used for custom evaluation. For example if pos=lambda idx: idx > 10 this will check that the keyword's index is greater than 10.

test : callable

This should be a callable (generally a function) that is passed the value of the given keyword and returns :None:None:`True` or :None:None:`False`. This can be used to validate the value associated with the given keyword.

fix_value : str, int, float, complex, bool, None

A valid value for a FITS keyword to to use if the given test fails to replace an invalid value. In other words, this provides a default value to use as a replacement if the keyword's current value is invalid. If :None:None:`None`, there is no replacement value and the keyword is unfixable.

option : 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.

errlist : list

A list of validation errors already found in the FITS file; this is used primarily for the validation system to collect errors across multiple HDUs and multiple calls to req_cards .

Check the existence, location, and value of a required Card .

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

astropy.io.fits.hdu.base._ValidHDU.req_cards

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/hdu/base.py#1093
type: <class 'function'>
Commit: