Table Of Contents

Previous topic

Header Data Units

Next topic

Cards

This Page

Headers

Inheritance diagram of Header, CardList

CardList

class pyfits.CardList(cards=[], keylist=None)

Bases: list

FITS header card list class.

Construct the CardList object from a list of Card objects.

Parameters:
 

cards :

A list of Card objects.

append(card, useblanks=True, bottom=False)

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

Make a (deep)copy of the CardList.

count_blanks()

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

filterList(key)

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.

filter_list(key)

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_of(key, backward=False)

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(pos, card, useblanks=True)

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

Return a list of all keywords from the CardList.

Keywords include field_specifier for RecordValuedKeywordCard objects.

values()

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.