bundles / astropy 7.0.1 / astropy / io / fits / hdu / base / _ValidHDU / req_cards
function
astropy.io.fits.hdu.base:_ValidHDU.req_cards
source: /astropy/io/fits/hdu/base.py :1107
Signature
def req_cards ( self , keyword , pos , test , fix_value , option , errlist ) Summary
Check the existence, location, and value of a required Card.
Parameters
keyword: strThe keyword to validate
pos: int, callableIf an
int, this specifies the exact location this card should have in the header. Remember that Python is zero-indexed, so this meanspos=0requires 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 returnTrueorFalse. This can be used for custom evaluation. For example ifpos=lambda idx: idx > 10this will check that the keyword's index is greater than 10.test: callableThis should be a callable (generally a function) that is passed the value of the given keyword and returns
TrueorFalse. This can be used to validate the value associated with the given keyword.fix_value: str, int, float, complex, bool, NoneA valid value for a FITS keyword to use if the given
testfails 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. IfNone, there is no replacement value and the keyword is unfixable.option: strOutput 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"). Seeastropy:verifyfor more info.errlist: listA 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.
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.
Aliases
-
astropy.io.fits.convenience._ValidHDU.req_cards