Cards

Card

class astropy.io.fits.Card(keyword=None, value=None, comment=None, **kwargs)[source]

Bases: _Verify

property comment

Get the comment attribute from the card image if not already set.

property field_specifier

The field-specifier of record-valued keyword cards; always None on normal cards.

classmethod fromstring(image)[source]

Construct a Card object from a (raw) string. It will pad the string if it is not the length of a card image (80 columns). If the card image is longer than 80 columns, assume it contains CONTINUE card(s).

property image

The card “image”, that is, the 80 byte character string that represents this card in an actual FITS header.

property is_blank

True if the card is completely blank–that is, it has no keyword, value, or comment. It appears in the header as 80 spaces.

Returns False otherwise.

property keyword

Returns the keyword name parsed from the card image.

length = 80

The length of a Card image; should always be 80 for valid FITS files.

classmethod normalize_keyword(keyword)[source]

classmethod to convert a keyword value that may contain a field-specifier to uppercase. The effect is to raise the key to uppercase and leave the field specifier in its original case.

Parameters:
keywordor python:str

A keyword value or a keyword.field-specifier value

property rawkeyword

On record-valued keyword cards this is the name of the standard <= 8 character FITS keyword that this RVKC is stored in. Otherwise it is the card’s normal keyword.

property rawvalue

On record-valued keyword cards this is the raw string value in the <field-specifier>: <value> format stored in the card in order to represent a RVKC. Otherwise it is the card’s normal value.

run_option(option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True)

Execute the verification with selected option.

property value

The value associated with the keyword stored in this card.

verify(option='warn')

Verify all values in the instance.

Parameters:
optionpython: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 Verification Options for more info.