Functions | |
| qfits_header * | qfits_header_new (void) |
| FITS header constructor. | |
| qfits_header * | qfits_header_default (void) |
| FITS header default constructor. | |
| void | qfits_header_add (qfits_header *hdr, const char *key, const char *val, const char *com, const char *lin) |
| Add a new card to a FITS header. | |
| void | qfits_header_add_after (qfits_header *hdr, const char *after, const char *key, const char *val, const char *com, const char *lin) |
| add a new card to a FITS header | |
| void | qfits_header_append (qfits_header *hdr, const char *key, const char *val, const char *com, const char *lin) |
| Append a new card to a FITS header. | |
| void | qfits_header_del (qfits_header *hdr, const char *key) |
| Delete a card in a FITS header. | |
| void | qfits_header_mod (qfits_header *hdr, const char *key, const char *val, const char *com) |
| Modifies a FITS card. | |
| int | qfits_header_sort (qfits_header **hdr) |
| Sort a FITS header. | |
| qfits_header * | qfits_header_copy (const qfits_header *src) |
| Copy a FITS header. | |
| void | qfits_header_destroy (qfits_header *hdr) |
| qfits_header destructor | |
| char * | qfits_header_getstr (const qfits_header *hdr, const char *key) |
| Return the value associated to a key, as a string. | |
| int | qfits_header_getitem (const qfits_header *hdr, int idx, char *key, char *val, char *com, char *lin) |
| Return the i-th key/val/com/line tuple in a header. | |
| char * | qfits_header_getcom (const qfits_header *hdr, const char *key) |
| Return the comment associated to a key, as a string. | |
| int | qfits_header_getint (const qfits_header *hdr, const char *key, int errval) |
| Return the value associated to a key, as an int. | |
| double | qfits_header_getdouble (const qfits_header *hdr, const char *key, double errval) |
| Return the value associated to a key, as a double. | |
| int | qfits_header_getboolean (const qfits_header *hdr, const char *key, int errval) |
| Return the value associated to a key, as a boolean (int). | |
| int | qfits_header_dump (const qfits_header *hdr, FILE *out) |
| Dump a FITS header to an opened file. | |
The 'keytuple' type is strictly internal to this module. It describes FITS cards as tuples (key,value,comment,line), where key is always a non-NULL character string, value and comment are allowed to be NULL. 'line' is a string containing the line as it has been read from the input FITS file (raw). It is set to NULL if the card is modified later. This allows in output two options: either reconstruct the FITS lines by printing key = value / comment in a FITS-compliant way, or output the lines as they were found in input, except for the modified ones.
The following functions are associated methods to this data structure:
| void qfits_header_add | ( | qfits_header * | hdr, | |
| const char * | key, | |||
| const char * | val, | |||
| const char * | com, | |||
| const char * | lin | |||
| ) |
Add a new card to a FITS header.
| hdr | qfits_header object to modify | |
| key | FITS key | |
| val | FITS value | |
| com | FITS comment | |
| lin | FITS original line if exists |
| void qfits_header_add_after | ( | qfits_header * | hdr, | |
| const char * | after, | |||
| const char * | key, | |||
| const char * | val, | |||
| const char * | com, | |||
| const char * | lin | |||
| ) |
add a new card to a FITS header
| hdr | qfits_header object to modify | |
| after | Key to specify insertion place | |
| key | FITS key | |
| val | FITS value | |
| com | FITS comment | |
| lin | FITS original line if exists |
| void qfits_header_append | ( | qfits_header * | hdr, | |
| const char * | key, | |||
| const char * | val, | |||
| const char * | com, | |||
| const char * | lin | |||
| ) |
Append a new card to a FITS header.
| hdr | qfits_header object to modify | |
| key | FITS key | |
| val | FITS value | |
| com | FITS comment | |
| lin | FITS original line if exists |
| qfits_header* qfits_header_copy | ( | const qfits_header * | src | ) |
Copy a FITS header.
| src | Header to replicate |
| qfits_header* qfits_header_default | ( | void | ) |
FITS header default constructor.
| void qfits_header_del | ( | qfits_header * | hdr, | |
| const char * | key | |||
| ) |
Delete a card in a FITS header.
| hdr | qfits_header to modify | |
| key | specifies which card to remove |
| void qfits_header_destroy | ( | qfits_header * | hdr | ) |
qfits_header destructor
| hdr | qfits_header to deallocate |
| int qfits_header_dump | ( | const qfits_header * | hdr, | |
| FILE * | out | |||
| ) |
Dump a FITS header to an opened file.
| hdr | FITS header to dump | |
| out | Opened file pointer |
| int qfits_header_getboolean | ( | const qfits_header * | hdr, | |
| const char * | key, | |||
| int | errval | |||
| ) |
Return the value associated to a key, as a boolean (int).
| hdr | qfits_header to parse | |
| key | key to find | |
| errval | default value to return if nothing is found |
errval is returned if no matching key is found or no value is attached.
A true value is any character string beginning with a 'y' (yes), a 't' (true) or the digit '1'. A false value is any character string beginning with a 'n' (no), a 'f' (false) or the digit '0'.
| char* qfits_header_getcom | ( | const qfits_header * | hdr, | |
| const char * | key | |||
| ) |
Return the comment associated to a key, as a string.
| hdr | qfits_header to parse | |
| key | key to find |
Returns NULL if no matching key is found or no comment is attached.
| double qfits_header_getdouble | ( | const qfits_header * | hdr, | |
| const char * | key, | |||
| double | errval | |||
| ) |
Return the value associated to a key, as a double.
| hdr | qfits_header to parse | |
| key | key to find | |
| errval | default value to return if nothing is found |
| int qfits_header_getint | ( | const qfits_header * | hdr, | |
| const char * | key, | |||
| int | errval | |||
| ) |
Return the value associated to a key, as an int.
| hdr | qfits_header to parse | |
| key | key to find | |
| errval | default value to return if nothing is found |
| int qfits_header_getitem | ( | const qfits_header * | hdr, | |
| int | idx, | |||
| char * | key, | |||
| char * | val, | |||
| char * | com, | |||
| char * | lin | |||
| ) |
Return the i-th key/val/com/line tuple in a header.
| hdr | Header to consider | |
| idx | Index of the requested card | |
| key | Output key | |
| val | Output value | |
| com | Output comment | |
| lin | Output initial line |
int i ; char key[FITS_LINESZ+1] ; char val[FITS_LINESZ+1] ; char com[FITS_LINESZ+1] ; char lin[FITS_LINESZ+1] ; for (i=0 ; i<hdr->n ; i++) { qfits_header_getitem(hdr, i, key, val, com, lin); printf("card[%d] key[%s] val[%s] com[%s]\n", i, key, val, com); }
This function has primarily been written to interface a qfits_header object to other languages (C++/Python). If you are working within a C program, you should use the other header manipulation routines available in this module.
| char* qfits_header_getstr | ( | const qfits_header * | hdr, | |
| const char * | key | |||
| ) |
Return the value associated to a key, as a string.
| hdr | qfits_header to parse | |
| key | key to find |
Returns NULL if no matching key is found or no value is attached.
| void qfits_header_mod | ( | qfits_header * | hdr, | |
| const char * | key, | |||
| const char * | val, | |||
| const char * | com | |||
| ) |
Modifies a FITS card.
| hdr | qfits_header to modify | |
| key | FITS key | |
| val | FITS value | |
| com | FITS comment |
| qfits_header* qfits_header_new | ( | void | ) |
FITS header constructor.
| int qfits_header_sort | ( | qfits_header ** | hdr | ) |
Sort a FITS header.
| hdr | Header to sort (modified) |