Cards

Card

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

Bases: astropy.io.fits.verify._Verify

ascardimage(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use the image attribute instead.

cardimage

Deprecated since version 3.1: Use the image attribute instead.

comment

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

field_specifier

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

classmethod fromstring(image) [edit on github]

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).

image
key

Deprecated since version 3.1: Use the keyword attribute instead.

keyword

Returns the keyword name parsed from the card image.

length = 80
classmethod normalize_keyword(keyword) [edit on github]

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 :

key : or str

A keyword value or a keyword.field-specifier value

Returns :

The converted string :

rawvalue
run_option(option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True) [edit on github]

Execute the verification with selected option.

value
verify(option='warn') [edit on github]

Verify all values in the instance.

Parameters :

option : str

Output verification option. Must be one of "fix", "silentfix", "ignore", "warn", or "exception". See Verification options for more info.

Deprecated Interfaces

The following classes and functions are deprecated as of the PyFITS 3.1 header refactoring, though they are currently still available for backwards-compatibility.

class astropy.io.fits.CardList(cards=[], keylist=None) [edit on github]

Bases: list

Deprecated since version 3.1: CardList used to provide the list-like functionality for manipulating a header as a list of cards. This functionality is now subsumed into the Header class itself, so it is no longer necessary to create or use CardLists.

append(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.append() instead.

Append a Card to the CardList.

Parameters :

card : Card object

The Card to be appended.

useblanks : bool, optional

Use any extra blank cards?

If useblanks is True, and if there are blank cards directly before END, it will use this space first, instead of appending after these blank cards, so the total space will not increase. When useblanks is False, the card will be appended at the end, even if there are blank cards in front of END.

bottom : bool, optional

If False the card will be appended after the last non-commentary card. If True the card will be appended after the last non-blank card.

copy(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.copy() instead.

Make a (deep)copy of the CardList.

count(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.count() instead.

count_blanks(*args, **kwargs) [edit on github]

Deprecated since version 3.1: The count_blanks function is deprecated and may be removed in a future version.

Returns how many blank cards are directly before the END card.

extend(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.extend() instead.

filterList(*args, **kwargs) [edit on github]

Deprecated since version 3.0: Use filter_list() instead.

filter_list(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use header[<wildcard_pattern>] instead.

Construct a CardList that contains references to all of the cards in this CardList that match the input key value including any special filter keys (*, ?, and ...).

Parameters :

key : str

key value to filter the list with

Returns :

cardlist : :

A CardList object containing references to all the requested cards.

index(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.index() instead.

index_of(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.index() instead.

Get the index of a keyword in the CardList.

Parameters :

key : str or int

The keyword name (a string) or the index (an integer).

backward : bool, (optional)

When True, search the index from the END, i.e., backward.

Returns :

index : int

The index of the Card with the given keyword.

insert(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.insert() instead.

Insert a Card to the CardList.

Parameters :

pos : int

The position (index, keyword name will not be allowed) to insert. The new card will be inserted before it.

card : Card object

The card to be inserted.

useblanks : bool, optional

If useblanks is True, and if there are blank cards directly before END, it will use this space first, instead of appending after these blank cards, so the total space will not increase. When useblanks is False, the card will be appended at the end, even if there are blank cards in front of END.

keys(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.keys() instead.

Return a list of all keywords from the CardList.

pop(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.pop() instead.

remove(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.remove() instead.

values(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Header.values() instead.

Return a list of the values of all cards in the CardList.

For RecordValuedKeywordCard objects, the value returned is the floating point value, exclusive of the field_specifier.

astropy.io.fits.create_card(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Card.__init__() instead.

astropy.io.fits.create_card_from_string(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Card.fromstring() instead.

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).

astropy.io.fits.upper_key(*args, **kwargs) [edit on github]

Deprecated since version 3.1: Use Card.normalize_keyword() instead.

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 :

key : or str

A keyword value or a keyword.field-specifier value

Returns :

The converted string :