kstars
User callable functions of the FITS-library.
Functions | |
int | fits_add_card (FITS_HDU_LIST *hdulist, char *card) |
FITS_HDU_LIST * | fits_add_hdu (FITS_FILE *ff) |
void | fits_close (FITS_FILE *ff) |
FITS_DATA * | fits_decode_card (const char *card, FITS_DATA_TYPES data_type) |
char * | fits_get_error (void) |
FITS_HDU_LIST * | fits_image_info (FITS_FILE *ff, int picind, int *hdupicind) |
FITS_FILE * | fits_open (const char *filename, const char *openmode) |
void | fits_print_header (FITS_HDU_LIST *hdr) |
int | fits_read_pixel (FITS_FILE *ff, FITS_HDU_LIST *hdulist, int npix, FITS_PIX_TRANSFORM *trans, void *buf) |
char * | fits_search_card (FITS_RECORD_LIST *rl, const char *keyword) |
FITS_HDU_LIST * | fits_seek_image (FITS_FILE *ff, int picind) |
int | fits_write_header (FITS_FILE *ff, FITS_HDU_LIST *hdulist) |
Function Documentation
int fits_add_card | ( | FITS_HDU_LIST * | hdulist, | |
char * | card | |||
) |
add a card to the HDU.
The card must follow the standards of FITS. The card must not use a keyword that is written using *hdulist itself.
- Parameters:
-
hdulist HDU listr. card card to add.
- Returns:
- On success 0 is returned. On failure -1 is returned.
FITS_HDU_LIST* fits_add_hdu | ( | FITS_FILE * | ff | ) |
add a HDU to the file.
- Parameters:
-
ff FITS file pointer.
- Returns:
- Adds a new HDU to the list kept in ff. A pointer to the new HDU is returned. On failure, a NULL-pointer is returned.
void fits_close | ( | FITS_FILE * | ff | ) |
close a FITS file.
- Parameters:
-
ff FITS file pointer.
FITS_DATA* fits_decode_card | ( | const char * | card, | |
FITS_DATA_TYPES | data_type | |||
) |
decode a card Decodes a card and returns a pointer to the union, keeping the data.
- Parameters:
-
card pointer to card image. data_type datatype to decode.
- Returns:
- If card is NULL or on failure, a NULL-pointer is returned. If the card does not have the value indicator, an error is generated, but its tried to decode the card. The data is only valid up to the next call of the function.
char* fits_get_error | ( | void | ) |
get an error message.
- Returns:
- If an error message has been set, a pointer to the message is returned. Otherwise a NULL pointer is returned. An inquired error message is removed from the error FIFO.
FITS_HDU_LIST* fits_image_info | ( | FITS_FILE * | ff, | |
int | picind, | |||
int * | hdupicind | |||
) |
get information about an image.
- Parameters:
-
ff FITS-file pointer. picind Index of picture in file (1,2,...) hdupicind Index of picture in HDU (1,2,...)
- Returns:
- The function returns on success a pointer to a FITS_HDU_LIST. hdupicind then gives the index of the image within the HDU. On failure, NULL is returned.
FITS_FILE* fits_open | ( | const char * | filename, | |
const char * | openmode | |||
) |
open a FITS file.
- Parameters:
-
filename name of file to open openmode mode to open the file ("r", "w")
- Returns:
- On success, a FITS_FILE-pointer is returned. On failure, a NULL-pointer is returned. The functions scans through the file loading each header and analyzing them.
void fits_print_header | ( | FITS_HDU_LIST * | hdr | ) |
print the internal representation of a single header.
- Parameters:
-
hdr pointer to the header
int fits_read_pixel | ( | FITS_FILE * | ff, | |
FITS_HDU_LIST * | hdulist, | |||
int | npix, | |||
FITS_PIX_TRANSFORM * | trans, | |||
void * | buf | |||
) |
read pixel values from a file The function reads npix pixel values from the file, transforms them checking for blank/NaN pixels and stores the transformed values in buf.
hdulist must be a pointer returned by fits_seek_image(). Before starting to read an image, fits_seek_image() must be called. Even for successive images.
- Parameters:
-
ff FITS file structure. hdulist pointer to hdulist that describes image. npix number of pixel values to read. trans pixel transformation. buf buffer where to place transformed pixels.
- Returns:
- The number of transformed pixels is returned. If the returned value is less than npix (or even -1), an error has occured.
char* fits_search_card | ( | FITS_RECORD_LIST * | rl, | |
const char * | keyword | |||
) |
search a card in the record list.
A card is searched in the reord list. Only the first eight characters of keyword are significant. If keyword is less than 8 characters, its filled with blanks.
- Parameters:
-
rl record list to search. keyword keyword identifying the card.
- Returns:
- If the card is found, a pointer to the card is returned. The pointer does not point to a null-terminated string. Only the next 80 bytes are allowed to be read. On failure a NULL-pointer is returned.
FITS_HDU_LIST* fits_seek_image | ( | FITS_FILE * | ff, | |
int | picind | |||
) |
position to a specific image.
The function positions the file pointer to a specified image.
- Parameters:
-
ff FITS-file pointer. picind Index of picture to seek (1,2,...)
- Returns:
- The function returns on success a pointer to a FITS_HDU_LIST. This pointer must also be used when reading data from the image. On failure, NULL is returned.
int fits_write_header | ( | FITS_FILE * | ff, | |
FITS_HDU_LIST * | hdulist | |||
) |
write a FITS header to the file.
- Parameters:
-
ff FITS-file pointer. hdulist pointer to header.
- Returns:
- On success, 0 is returned. On failure, -1 is returned.