Cards¶
Card¶
-
class
pyfits.Card(keyword=None, value=None, comment=None, **kwargs)¶ Bases:
pyfits.verify._Verify-
classmethod
fromstring(image)¶ Construct a
Cardobject 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 containsCONTINUEcard(s).
-
classmethod
normalize_keyword(keyword)¶ classmethodto 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-specifiervalue
-
run_option(option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True)¶ Execute the verification with selected option.
-
verify(option='warn')¶ 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.
-
comment¶ Get the comment attribute from the card image if not already set.
-
image¶ The card “image”, that is, the 80 byte character string that represents this card in an actual FITS header.
-
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.
-
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.
-
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.
-
value¶ The value associated with the keyword stored in this card.
-
classmethod
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
pyfits.CardList(cards=[], keylist=None)¶ Bases:
listDeprecated since version 3.1:
CardListused to provide the list-like functionality for manipulating a header as a list of cards. This functionality is now subsumed into theHeaderclass itself, so it is no longer necessary to create or useCardLists.Construct the
CardListobject from a list ofCardobjects.CardListis now merely a thin wrapper aroundHeaderto provide backwards compatibility for the old API. This should not be used for any new code.Parameters: cards
A list of
Cardobjects.-
append(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.append()instead.Append a
Cardto theCardList.Parameters: card :
CardobjectThe
Cardto be appended.useblanks : bool, optional
Use any extra blank cards?
If
useblanksisTrue, and if there are blank cards directly beforeEND, it will use this space first, instead of appending after these blank cards, so the total space will not increase. WhenuseblanksisFalse, the card will be appended at the end, even if there are blank cards in front ofEND.bottom : bool, optional
-
copy(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.copy()instead.Make a (deep)copy of the
CardList.
-
count(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.count()instead.
-
count_blanks(*args, **kwargs)¶ 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
ENDcard.
-
extend(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.extend()instead.
-
filter_list(*args, **kwargs)¶ Deprecated since version 3.1: Use
header[<wildcard_pattern>]instead.Construct a
CardListthat contains references to all of the cards in thisCardListthat match the input key value including any special filter keys (*,?, and...).Parameters: key : str
key value to filter the list with
Returns: cardlist
A
CardListobject containing references to all the requested cards.
-
index(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.index()instead.
-
index_of(*args, **kwargs)¶ 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 theEND, i.e., backward.Returns: index : int
The index of the
Cardwith the given keyword.
-
insert(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.insert()instead.Insert a
Cardto theCardList.Parameters: pos : int
The position (index, keyword name will not be allowed) to insert. The new card will be inserted before it.
card :
CardobjectThe card to be inserted.
useblanks : bool, optional
-
keys(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.keys()instead.Return a list of all keywords from the
CardList.
-
pop(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.pop()instead.
-
remove(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.remove()instead.
-
values(*args, **kwargs)¶ Deprecated since version 3.1: Use
Header.values()instead.Return a list of the values of all cards in the
CardList.For
RecordValuedKeywordCardobjects, the value returned is the floating point value, exclusive of thefield_specifier.
-
-
pyfits.create_card(*args, **kwargs)¶ Deprecated since version 3.1: Use
Card.__init__instead.
-
pyfits.create_card_from_string(*args, **kwargs)¶ Deprecated since version 3.1: Use
Card.fromstring()instead.Construct a
Cardobject 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 containsCONTINUEcard(s).
-
pyfits.upper_key(*args, **kwargs)¶ Deprecated since version 3.1: Use
Card.normalize_keyword()instead.classmethodto 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-specifiervalue