Bases: pyfits.verify._Verify
Construct a card from key, value, and (optionally) comment. Any specifed arguments, except defaults, must be compliant to FITS standard.
Parameters: | |
---|---|
key : str, optional
value : str, optional
comment : str, optional
|
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).
Execute the verification with selected option.
Verify all values in the instance.
Parameters: | |
---|---|
option : str
|
Card comment
Card keyword
Card value
Bases: pyfits.card.Card
Class to manage record-valued keyword cards as described in the FITS WCS Paper IV proposal for representing a more general distortion model.
Record-valued keyword cards are string-valued cards where the string is interpreted as a definition giving a record field name, and its floating point value. In a FITS header they have the following syntax:
keyword = 'field-specifier: float'
where keyword is a standard eight-character FITS keyword name, float is the standard FITS ASCII representation of a floating point number, and these are separated by a colon followed by a single blank. The grammar for field-specifier is:
field-specifier:
field
field-specifier.field
field:
identifier
identifier.index
where identifier is a sequence of letters (upper or lower case), underscores, and digits of which the first character must not be a digit, and index is a sequence of digits. No blank characters may occur in the field-specifier. The index is provided primarily for defining array elements though it need not be used for that purpose.
Multiple record-valued keywords of the same name but differing values may be present in a FITS header. The field-specifier may be viewed as part of the keyword name.
Some examples follow:
DP1 = 'NAXIS: 2'
DP1 = 'AXIS.1: 1'
DP1 = 'AXIS.2: 2'
DP1 = 'NAUX: 2'
DP1 = 'AUX.1.COEFF.0: 0'
DP1 = 'AUX.1.POWER.0: 1'
DP1 = 'AUX.1.COEFF.1: 0.00048828125'
DP1 = 'AUX.1.POWER.1: 1'
Parameters: | |
---|---|
key : str, optional
value : str, optional
comment : str, optional
|
Coerces an input Card object to a RecordValuedKeywordCard object if the value of the card meets the requirements of this type of card.
Parameters: | |
---|---|
card : Card object
|
|
Returns: | |
card :
|
Create a card given the input key, value, and comment. If the input key and value qualify for a RecordValuedKeywordCard then that is the object created. Otherwise, a standard Card object is created.
Parameters: | |
---|---|
key : str, optional
value : str, optional
comment : str, optional
|
|
Returns: | |
card :
|
Create a card given the input key, value, and comment. If the input key and value qualify for a RecordValuedKeywordCard then that is the object created. Otherwise, a standard Card object is created.
Parameters: | |
---|---|
key : str, optional
value : str, optional
comment : str, optional
|
|
Returns: | |
card :
|
Create a card given the input string. If the input string can be parsed into a key and value that qualify for a RecordValuedKeywordCard then that is the object created. Otherwise, a standard Card object is created.
Parameters: | |
---|---|
input : str
|
|
Returns: | |
card :
|
Create a card given the input string. If the input string can be parsed into a key and value that qualify for a RecordValuedKeywordCard then that is the object created. Otherwise, a standard Card object is created.
Parameters: | |
---|---|
input : str
|
|
Returns: | |
card :
|
Execute the verification with selected option.
Method to extract the field specifier and value from the card image. This is what is reported to the user when requesting the value of the Card using either an integer index or the card key without any field specifier.
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 : int or str
|
|
Returns: | |
Integer input :
String input :
|
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 : int or str
|
|
Returns: | |
Integer input :
String input :
|
Determine if the input key and value can be used to form a valid RecordValuedKeywordCard object. The key parameter may contain the key only or both the key and field-specifier. The value may be the value only or the field-specifier and the value together. The value parameter is optional, in which case the key parameter must contain both the key and the field specifier.
Parameters: | |
---|---|
key : str
value : str or float-like, optional
|
|
Returns: | |
valid input : A list containing the key, field-specifier, value invalid input : An empty list |
Examples
>>> valid_key_value('DP1','AXIS.1: 2')
>>> valid_key_value('DP1.AXIS.1', 2)
>>> valid_key_value('DP1.AXIS.1')
Determine if the input key and value can be used to form a valid RecordValuedKeywordCard object. The key parameter may contain the key only or both the key and field-specifier. The value may be the value only or the field-specifier and the value together. The value parameter is optional, in which case the key parameter must contain both the key and the field specifier.
Parameters: | |
---|---|
key : str
value : str or float-like, optional
|
|
Returns: | |
valid input : A list containing the key, field-specifier, value invalid input : An empty list |
Examples
>>> valid_key_value('DP1','AXIS.1: 2')
>>> valid_key_value('DP1.AXIS.1', 2)
>>> valid_key_value('DP1.AXIS.1')
Verify all values in the instance.
Parameters: | |
---|---|
option : str
|
Card comment
Card keyword
Return this card as a normal Card object not parsed as a record-valued keyword card. Note that this returns a copy, so that modifications to it do not update the original record-valued keyword card.
Card value
Create a card given the input key, value, and comment. If the input key and value qualify for a RecordValuedKeywordCard then that is the object created. Otherwise, a standard Card object is created.
Parameters: | |
---|---|
key : str, optional
value : str, optional
comment : str, optional
|
|
Returns: | |
card :
|
Create a card given the input string. If the input string can be parsed into a key and value that qualify for a RecordValuedKeywordCard then that is the object created. Otherwise, a standard Card object is created.
Parameters: | |
---|---|
input : str
|
|
Returns: | |
card :
|
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 : int or str
|
|
Returns: | |
Integer input :
String input :
|