The basic interface routines described previously are recommended for most uses, but the routines described in this chapter are also available if necessary. Some of these routines perform more specialized function that cannot easily be done with the basic interface routines while others duplicate the functionality of the basic routines but have a slightly different calling sequence. See Appendix B for the definition of each function parameter.
int fits_open_memfile / ffomem
(fitsfile **fptr, const char *filename, int mode, void **memptr,
size_t *memsize, size_t deltasize,
void *(*mem_realloc)(void *p, size_t newsize), int *status)
int fits_create_memfile / ffimem
(fitsfile **fptr, void **memptr,
size_t *memsize, size_t deltasize,
void *(*mem_realloc)(void *p, size_t newsize), int *status)
int fits_reopen_file / ffreopen
(fitsfile *openfptr, fitsfile **newfptr, > int *status)
int fits_create_template / fftplt
(fitsfile **fptr, char *filename, char *tpltfile > int *status)
int fits_parse_input_url / ffiurl
(char *filename, > char *filetype, char *infile, char *outfile, char
*extspec, char *filter, char *binspec, char *colspec, int *status)
int fits_parse_input_filename / ffifile
(char *filename, > char *filetype, char *infile, char *outfile, char
*extspec, char *filter, char *binspec, char *colspec, char *pixspec,
int *status)
int fits_parse_extnum / ffextn
(char *filename, > int *hdunum, int *status)
int fits_parse_rootname / ffrtnm
(char *filename, > char *rootname, int *status);
2: the file does not exist, but a compressed version does exist
1: the disk file does exist
0: neither the file nor a compressed version of the file exist
-1: the input file name is not a disk file (could be a ftp, http,
smem, or mem file, or a file piped in on the STDIN stream)
int fits_file_exists / ffexist
(char *filename, > int *exists, int *status);
A typical use of these routines would be to flush the state of a FITS table to disk after each row of the table is written. It is recommend that fits_flush_file be called after the first row is written, then fits_flush_buffer may be called after each subsequent row is written. Note that this latter routine will not automatically update the NAXIS2 keyword which records the number of rows of data in the table, so this keyword must be explicitly updated by the application program after each row is written.
int fits_flush_file / ffflus
(fitsfile *fptr, > int *status)
int fits_flush_buffer / ffflsh
(fitsfile *fptr, 0, > int *status)
(Note: The second argument must be 0).
int fits_init_https / ffihtps
()
int fits_cleanup_https / ffchtps
()
These routines do not need to be called for normal file accessing. They are primarily intended to help with debugging and diagnosing issues which occur during file downloads. These routines are NOT THREAD-SAFE.
void fits_verbose_https / ffvhtps
(int flag)
void fits_show_download_progress / ffshdwn
(int flag)
int fits_get_timeout / ffgtmo
()
int fits_set_timeout / ffstmo
(int seconds, > int *status)
int fits_get_hduaddr / ffghad (only supports files up to 2.1 GB in size)
(fitsfile *fptr, > long *headstart, long *datastart, long *dataend,
int *status)
int fits_get_hduaddrll / ffghadll (supports large files)
(fitsfile *fptr, > LONGLONG *headstart, LONGLONG *datastart,
LONGLONG *dataend, int *status)
int fits_create_hdu / ffcrhd
(fitsfile *fptr, > int *status)
int fits_insert_img / ffiimg
(fitsfile *fptr, int bitpix, int naxis, long *naxes, > int *status)
int fits_insert_imgll / ffiimgll
(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, > int *status)
int fits_insert_atbl / ffitab
(fitsfile *fptr, LONGLONG rowlen, LONGLONG nrows, int tfields, char *ttype[],
long *tbcol, char *tform[], char *tunit[], char *extname, > int *status)
int fits_insert_btbl / ffibin
(fitsfile *fptr, LONGLONG nrows, int tfields, char **ttype,
char **tform, char **tunit, char *extname, long pcount, > int *status)
int fits_resize_img / ffrsim
(fitsfile *fptr, int bitpix, int naxis, long *naxes, > int *status)
int fits_resize_imgll / ffrsimll
(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, > int *status)
int fits_copy_data / ffcpdt
(fitsfile *infptr, fitsfile *outfptr, > int *status)
int fits_read_ext / ffgextn
(fitsfile *fptr, LONGLONG offset, LONGLONG nbytes, void *buffer)
int fits_write_ext / ffpextn
(fitsfile *fptr, LONGLONG offset, LONGLONG nbytes, void *buffer)
int fits_set_hdustruc / ffrdef
(fitsfile *fptr, > int *status) (DEPRECATED)
int fits_set_hdrsize / ffhdef
(fitsfile *fptr, int morekeys, > int *status)
int fits_get_hdrpos / ffghps
(fitsfile *fptr, > int *keysexist, int *keynum, int *status)
The simpler fits_write_imghdr routine is equivalent to calling fits_write_grphdr with the default values of simple = TRUE, pcount = 0, gcount = 1, and extend = TRUE. The PCOUNT, GCOUNT and EXTEND keywords are not required in the primary header and are only written if pcount is not equal to zero, gcount is not equal to zero or one, and if extend is TRUE, respectively. When writing to an IMAGE extension, the SIMPLE and EXTEND parameters are ignored. It is recommended that fits_create_image or fits_create_tbl be used instead of these routines to write the required header keywords. The general fits_write_exthdr routine may be used to write the header of any conforming FITS extension.
int fits_write_imghdr / ffphps
(fitsfile *fptr, int bitpix, int naxis, long *naxes, > int *status)
int fits_write_imghdrll / ffphpsll
(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, > int *status)
int fits_write_grphdr / ffphpr
(fitsfile *fptr, int simple, int bitpix, int naxis, long *naxes,
LONGLONG pcount, LONGLONG gcount, int extend, > int *status)
int fits_write_grphdrll / ffphprll
(fitsfile *fptr, int simple, int bitpix, int naxis, LONGLONG *naxes,
LONGLONG pcount, LONGLONG gcount, int extend, > int *status)
int fits_write_exthdr /ffphext
(fitsfile *fptr, char *xtension, int bitpix, int naxis, long *naxes,
LONGLONG pcount, LONGLONG gcount, > int *status)
int fits_write_atblhdr / ffphtb
(fitsfile *fptr, LONGLONG rowlen, LONGLONG nrows, int tfields, char **ttype,
long *tbcol, char **tform, char **tunit, char *extname, > int *status)
int fits_write_btblhdr / ffphbn
(fitsfile *fptr, LONGLONG nrows, int tfields, char **ttype,
char **tform, char **tunit, char *extname, LONGLONG pcount, > int *status)
int fits_read_imghdr / ffghpr
(fitsfile *fptr, int maxdim, > int *simple, int *bitpix, int *naxis,
long *naxes, long *pcount, long *gcount, int *extend, int *status)
int fits_read_imghdrll / ffghprll
(fitsfile *fptr, int maxdim, > int *simple, int *bitpix, int *naxis,
LONGLONG *naxes, long *pcount, long *gcount, int *extend, int *status)
int fits_read_atblhdr / ffghtb
(fitsfile *fptr,int maxdim, > long *rowlen, long *nrows,
int *tfields, char **ttype, LONGLONG *tbcol, char **tform, char **tunit,
char *extname, int *status)
int fits_read_atblhdrll / ffghtbll
(fitsfile *fptr,int maxdim, > LONGLONG *rowlen, LONGLONG *nrows,
int *tfields, char **ttype, long *tbcol, char **tform, char **tunit,
char *extname, int *status)
int fits_read_btblhdr / ffghbn
(fitsfile *fptr, int maxdim, > long *nrows, int *tfields,
char **ttype, char **tform, char **tunit, char *extname,
long *pcount, int *status)
int fits_read_btblhdrll / ffghbnll
(fitsfile *fptr, int maxdim, > LONGLONG *nrows, int *tfields,
char **ttype, char **tform, char **tunit, char *extname,
long *pcount, int *status)
These routines simply append a new keyword to the header and do not check to see if a keyword with the same name already exists. In general it is preferable to use the fits_update_key routine to ensure that the same keyword is not written more than once to the header. See Appendix B for the definition of the parameters used in these routines.
int fits_write_key_str / ffpkys
(fitsfile *fptr, char *keyname, char *value, char *comment,
> int *status)
int fits_write_key_[log, lng] / ffpky[lj]
(fitsfile *fptr, char *keyname, DTYPE numval, char *comment,
> int *status)
int fits_write_key_[flt, dbl, fixflg, fixdbl] / ffpky[edfg]
(fitsfile *fptr, char *keyname, DTYPE numval, int decimals,
char *comment, > int *status)
int fits_write_key_[cmp, dblcmp, fixcmp, fixdblcmp] / ffpk[yc,ym,fc,fm]
(fitsfile *fptr, char *keyname, DTYPE *numval, int decimals,
char *comment, > int *status)
int fits_write_key_longstr / ffpkls
(fitsfile *fptr, char *keyname, char *longstr, char *comment,
> int *status)
int fits_write_key_longwarn / ffplsw
(fitsfile *fptr, > int *status)
int fits_write_keys_str / ffpkns
(fitsfile *fptr, char *keyroot, int nstart, int nkeys,
char **value, char **comment, > int *status)
int fits_write_keys_[log, lng] / ffpkn[lj]
(fitsfile *fptr, char *keyroot, int nstart, int nkeys,
DTYPE *numval, char **comment, int *status)
int fits_write_keys_[flt, dbl, fixflg, fixdbl] / ffpkne[edfg]
(fitsfile *fptr, char *keyroot, int nstart, int nkey,
DTYPE *numval, int decimals, char **comment, > int *status)
int fits_copy_key / ffcpky
(fitsfile *infptr, fitsfile *outfptr, int innum, int outnum,
char *keyroot, > int *status)
int fits_write_key_triple / ffpkyt
(fitsfile *fptr, char *keyname, long intval, double frac,
char *comment, > int *status)
int fits_write_key_template / ffpktp
(fitsfile *fptr, const char *filename, > int *status)
These insert routines are somewhat less efficient than the ‘update’ or ‘write’ keyword routines because the following keywords in the header must be shifted down to make room for the inserted keyword. See Appendix B for the definition of the parameters used in these routines.
int fits_insert_record / ffirec
(fitsfile *fptr, int keynum, char *card, > int *status)
int fits_insert_card / ffikey
(fitsfile *fptr, char *card, > int *status)
int fits_insert_key_[str, longstr] / ffi[kys, kls]
(fitsfile *fptr, char *keyname, char *value, char *comment,
> int *status)
int fits_insert_key_[log, lng] / ffiky[lj]
(fitsfile *fptr, char *keyname, DTYPE numval, char *comment,
> int *status)
int fits_insert_key_[flt, fixflt, dbl, fixdbl] / ffiky[edfg]
(fitsfile *fptr, char *keyname, DTYPE numval, int decimals,
char *comment, > int *status)
int fits_insert_key_[cmp, dblcmp, fixcmp, fixdblcmp] / ffik[yc,ym,fc,fm]
(fitsfile *fptr, char *keyname, DTYPE *numval, int decimals,
char *comment, > int *status)
int fits_insert_key_null / ffikyu
(fitsfile *fptr, char *keyname, char *comment, > int *status)
Wild card characters may be used when specifying the name of the keyword to be read.
int fits_read_key_str / ffgkys
(fitsfile *fptr, char *keyname, > char *value, char *comment,
int *status);
NOTE: after calling the following routine, programs must explicitly free
the memory allocated for 'longstr' after it is no longer needed by
calling fits_free_memory.
int fits_read_key_longstr / ffgkls
(fitsfile *fptr, char *keyname, > char **longstr, char *comment,
int *status)
int fits_free_memory / fffree
(char *longstr, > int *status);
int fits_read_key_[log, lng, flt, dbl, cmp, dblcmp] / ffgky[ljedcm]
(fitsfile *fptr, char *keyname, > DTYPE *numval, char *comment,
int *status)
int fits_read_key_lnglng / ffgkyjj
(fitsfile *fptr, char *keyname, > LONGLONG *numval, char *comment,
int *status)
int fits_read_keys_str / ffgkns
(fitsfile *fptr, char *keyname, int nstart, int nkeys,
> char **value, int *nfound, int *status)
int fits_read_keys_[log, lng, flt, dbl] / ffgkn[ljed]
(fitsfile *fptr, char *keyname, int nstart, int nkeys,
> DTYPE *numval, int *nfound, int *status)
int fits_read_key_triple / ffgkyt
(fitsfile *fptr, char *keyname, > long *intval, double *frac,
char *comment, int *status)
These routines modify the value of an existing keyword. An error is returned if the keyword does not exist. Wild card characters may be used when specifying the name of the keyword to be modified. See Appendix B for the definition of the parameters used in these routines.
int fits_modify_record / ffmrec
(fitsfile *fptr, int keynum, char *card, > int *status)
int fits_modify_card / ffmcrd
(fitsfile *fptr, char *keyname, char *card, > int *status)
int fits_modify_key_[str, longstr] / ffm[kys, kls]
(fitsfile *fptr, char *keyname, char *value, char *comment,
> int *status);
int fits_modify_key_[log, lng] / ffmky[lj]
(fitsfile *fptr, char *keyname, DTYPE numval, char *comment,
> int *status)
int fits_modify_key_[flt, dbl, fixflt, fixdbl] / ffmky[edfg]
(fitsfile *fptr, char *keyname, DTYPE numval, int decimals,
char *comment, > int *status)
int fits_modify_key_[cmp, dblcmp, fixcmp, fixdblcmp] / ffmk[yc,ym,fc,fm]
(fitsfile *fptr, char *keyname, DTYPE *numval, int decimals,
char *comment, > int *status)
int fits_modify_key_null / ffmkyu
(fitsfile *fptr, char *keyname, char *comment, > int *status)
int fits_update_key_[str, longstr] / ffu[kys, kls]
(fitsfile *fptr, char *keyname, char *value, char *comment,
> int *status)
int fits_update_key_[log, lng] / ffuky[lj]
(fitsfile *fptr, char *keyname, DTYPE numval, char *comment,
> int *status)
int fits_update_key_[flt, dbl, fixflt, fixdbl] / ffuky[edfg]
(fitsfile *fptr, char *keyname, DTYPE numval, int decimals,
char *comment, > int *status)
int fits_update_key_[cmp, dblcmp, fixcmp, fixdblcmp] / ffuk[yc,ym,fc,fm]
(fitsfile *fptr, char *keyname, DTYPE *numval, int decimals,
char *comment, > int *status)
These routines set or modify the internal parameters used by CFITSIO to either scale the data or to represent undefined pixels. Generally CFITSIO will scale the data according to the values of the BSCALE and BZERO (or TSCALn and TZEROn) keywords, however these routines may be used to override the keyword values. This may be useful when one wants to read or write the raw unscaled values in the FITS file. Similarly, CFITSIO generally uses the value of the BLANK or TNULLn keyword to signify an undefined pixel, but these routines may be used to override this value. These routines do not create or modify the corresponding header keyword values. See Appendix B for the definition of the parameters used in these routines.
int fits_set_bscale / ffpscl
(fitsfile *fptr, double scale, double zero, > int *status)
int fits_set_tscale / fftscl
(fitsfile *fptr, int colnum, double scale, double zero,
> int *status)
int fits_set_imgnull / ffpnul
(fitsfile *fptr, LONGLONG nulval, > int *status)
int fits_set_atblnull / ffsnul
(fitsfile *fptr, int colnum, char *nulstr, > int *status)
int fits_set_btblnull / fftnul
(fitsfile *fptr, int colnum, LONGLONG nulval, > int *status)
These routines read or write data values in the primary data array (i.e., the first HDU in the FITS file) or an IMAGE extension. Automatic data type conversion is performed for if the data type of the FITS array (as defined by the BITPIX keyword) differs from the data type of the array in the calling routine. The data values are automatically scaled by the BSCALE and BZERO header values as they are being written or read from the FITS array. Unlike the basic routines described in the previous chapter, most of these routines specifically support the FITS random groups format. See Appendix B for the definition of the parameters used in these routines.
The more primitive reading and writing routines (i. e., ffppr_, ffppn_, ffppn, ffgpv_, or ffgpf_) simply treat the primary array as a long 1-dimensional array of pixels, ignoring the intrinsic dimensionality of the array. When dealing with a 2D image, for example, the application program must calculate the pixel offset in the 1-D array that corresponds to any particular X, Y coordinate in the image. C programmers should note that the ordering of arrays in FITS files, and hence in all the CFITSIO calls, is more similar to the dimensionality of arrays in Fortran rather than C. For instance if a FITS image has NAXIS1 = 100 and NAXIS2 = 50, then a 2-D array just large enough to hold the image should be declared as array[50][100] and not as array[100][50].
For convenience, higher-level routines are also provided to specifically deal with 2D images (ffp2d_ and ffg2d_) and 3D data cubes (ffp3d_ and ffg3d_). The dimensionality of the FITS image is passed by the naxis1, naxis2, and naxis3 parameters and the declared dimensions of the program array are passed in the dim1 and dim2 parameters. Note that the dimensions of the program array may be larger than the dimensions of the FITS array. For example if a FITS image with NAXIS1 = NAXIS2 = 400 is read into a program array which is dimensioned as 512 x 512 pixels, then the image will just fill the lower left corner of the array with pixels in the range 1 - 400 in the X an Y directions. This has the effect of taking a contiguous set of pixel value in the FITS array and writing them to a non-contiguous array in program memory (i.e., there are now some blank pixels around the edge of the image in the program array).
The most general set of routines (ffpss_, ffgsv_, and ffgsf_) may be used to transfer a rectangular subset of the pixels in a FITS N-dimensional image to or from an array which has been declared in the calling program. The fpixel and lpixel parameters are integer arrays which specify the starting and ending pixel coordinate in each dimension (starting with 1, not 0) of the FITS image that is to be read or written. It is important to note that these are the starting and ending pixels in the FITS image, not in the declared array in the program. The array parameter in these routines is treated simply as a large one-dimensional array of the appropriate data type containing the pixel values; The pixel values in the FITS array are read/written from/to this program array in strict sequence without any gaps; it is up to the calling routine to correctly interpret the dimensionality of this array. The two FITS reading routines (ffgsv_ and ffgsf_ ) also have an ‘inc’ parameter which defines the data sampling interval in each dimension of the FITS array. For example, if inc[0]=2 and inc[1]=3 when reading a 2-dimensional FITS image, then only every other pixel in the first dimension and every 3rd pixel in the second dimension will be returned to the ’array’ parameter.
Two types of routines are provided to read the data array which differ in the way undefined pixels are handled. The first type of routines (e.g., ffgpv_) simply return an array of data elements in which undefined pixels are set equal to a value specified by the user in the ‘nulval’ parameter. An additional feature of these routines is that if the user sets nulval = 0, then no checks for undefined pixels will be performed, thus reducing the amount of CPU processing. The second type of routines (e.g., ffgpf_) returns the data element array and, in addition, a char array that indicates whether the value of the corresponding data pixel is undefined (= 1) or defined (= 0). The latter type of routines may be more convenient to use in some circumstances, however, it requires an additional array of logical values which can be unwieldy when working with large data arrays.
int fits_write_img / ffppr
(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelements,
DTYPE *array, int *status);
int fits_write_img_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffppr[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelements,
DTYPE *array, > int *status);
int fits_write_imgnull / ffppn
(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelements,
DTYPE *array, DTYPE *nulval, > int *status);
int fits_write_imgnull_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffppn[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, LONGLONG firstelem,
LONGLONG nelements, DTYPE *array, DTYPE nulval, > int *status);
int fits_write_img_null / ffppru
(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelements,
> int *status)
int fits_write_grppar_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffpgp[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, long firstelem, long nelements,
> DTYPE *array, int *status)
int fits_write_2d_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffp2d[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, LONGLONG dim1, LONGLONG naxis1,
LONGLONG naxis2, DTYPE *array, > int *status)
int fits_write_3d_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffp3d[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, LONGLONG dim1, LONGLONG dim2, LONGLONG naxis1,
LONGLONG naxis2, LONGLONG naxis3, DTYPE *array, > int *status)
int fits_write_subset_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffpss[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, long naxis, long *naxes,
long *fpixel, long *lpixel, DTYPE *array, > int *status)
int fits_read_img / ffgpv
(fitsfile *fptr, int datatype, long firstelem, long nelements,
DTYPE *nulval, > DTYPE *array, int *anynul, int *status)
int fits_read_img_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffgpv[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, long firstelem, long nelements,
DTYPE nulval, > DTYPE *array, int *anynul, int *status)
int fits_read_imgnull / ffgpf
(fitsfile *fptr, int datatype, long firstelem, long nelements,
> DTYPE *array, char *nullarray, int *anynul, int *status)
int fits_read_imgnull_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffgpf[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, long firstelem, long nelements,
> DTYPE *array, char *nullarray, int *anynul, int *status)
int fits_read_grppar_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffggp[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, long firstelem, long nelements,
> DTYPE *array, int *status)
int fits_read_2d_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffg2d[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, DTYPE nulval, LONGLONG dim1, LONGLONG naxis1,
LONGLONG naxis2, > DTYPE *array, int *anynul, int *status)
int fits_read_3d_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffg3d[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, long group, DTYPE nulval, LONGLONG dim1,
LONGLONG dim2, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
> DTYPE *array, int *anynul, int *status)
int fits_read_subset_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffgsv[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, int group, int naxis, long *naxes,
long *fpixel, long *lpixel, long *inc, DTYPE nulval,
> DTYPE *array, int *anynul, int *status)
int fits_read_subsetnull_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffgsf[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, int group, int naxis, long *naxes,
long *fpixel, long *lpixel, long *inc, > DTYPE *array,
char *nullarray, int *anynul, int *status)
int fits_get_acolparms / ffgacl
(fitsfile *fptr, int colnum, > char *ttype, long *tbcol,
char *tunit, char *tform, double *scale, double *zero,
char *nulstr, char *tdisp, int *status)
int fits_get_bcolparms / ffgbcl
(fitsfile *fptr, int colnum, > char *ttype, char *tunit,
char *typechar, long *repeat, double *scale, double *zero,
long *nulval, char *tdisp, int *status)
int fits_get_bcolparmsll / ffgbclll
(fitsfile *fptr, int colnum, > char *ttype, char *tunit,
char *typechar, LONGLONG *repeat, double *scale, double *zero,
LONGLONG *nulval, char *tdisp, int *status)
int fits_get_rowsize / ffgrsz
(fitsfile *fptr, long *nrows, *status)
int fits_write_theap / ffpthp
(fitsfile *fptr, long theap, > int *status)
int fits_test_heap / fftheap
(fitsfile *fptr, > LONGLONG *heapsize, LONGLONG *unused, LONGLONG *overlap,
int *validheap, int *status)
int fits_compress_heap / ffcmph
(fitsfile *fptr, > int *status)
The following 2 routines provide low-level access to the data in ASCII or binary tables and are mainly useful as an efficient way to copy all or part of a table from one location to another. These routines simply read or write the specified number of consecutive bytes in an ASCII or binary table, without regard for column boundaries or the row length in the table. These routines do not perform any machine dependent data conversion or byte swapping. See Appendix B for the definition of the parameters used in these routines.
int fits_read_tblbytes / ffgtbb
(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars,
> unsigned char *values, int *status)
int fits_write_tblbytes / ffptbb
(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars,
unsigned char *values, > int *status)
This subsection describes specialized routines for writing data to FITS tables. Please see section 9.6.4 (“Read Column Data Routines”) for more information about how values are stored in C.
int fits_write_col_str / ffpcls
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
LONGLONG nelements, char **array, > int *status)
int fits_write_col_[log,byt,sht,usht,int,uint,lng,ulng,lnglng,ulnglng,flt,dbl,cmp,dblcmp] /
ffpcl[l,b,i,ui,k,uk,j,uj,jj,ujj,e,d,c,m]
(fitsfile *fptr, int colnum, LONGLONG firstrow,
LONGLONG firstelem, LONGLONG nelements, DTYPE *array, > int *status)
int fits_write_colnull_[log, byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffpcn[l,b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
LONGLONG nelements, DTYPE *array, DTYPE nulval, > int *status)
int fits_write_colnull_str / ffpcns
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
LONGLONG nelements, char **array, char *nulstr, > int *status)
int fits_write_col_bit / ffpclx
(fitsfile *fptr, int colnum, LONGLONG firstrow, long firstbit,
long nbits, char *larray, > int *status)
int fits_write_descript / ffpdes
(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG repeat,
LONGLONG offset, > int *status)
Two types of routines are provided to get the column data which differ in the way undefined pixels are handled. The first set of routines (ffgcv) simply return an array of data elements in which undefined pixels are set equal to a value specified by the user in the ’nullval’ parameter. If nullval = 0, then no checks for undefined pixels will be performed, thus increasing the speed of the program. The second set of routines (ffgcf) returns the data element array and in addition a logical array of flags which defines whether the corresponding data pixel is undefined. See Appendix B for the definition of the parameters used in these routines.
Any column, regardless of it’s intrinsic data type, may be read as a string. It should be noted however that reading a numeric column as a string is 10 - 100 times slower than reading the same column as a number due to the large overhead in constructing the formatted strings. The display format of the returned strings will be determined by the TDISPn keyword, if it exists, otherwise by the data type of the column. The length of the returned strings (not including the null terminating character) can be determined with the fits_get_col_display_width routine. The following TDISPn display formats are currently supported:
Iw.m Integer
Ow.m Octal integer
Zw.m Hexadecimal integer
Fw.d Fixed floating point
Ew.d Exponential floating point
Dw.d Exponential floating point
Gw.d General; uses Fw.d if significance not lost, else Ew.d
where w is the width in characters of the displayed values, m is the minimum number of digits displayed, and d is the number of digits to the right of the decimal. The .m field is optional.
array before calling. Undefined
array elements will be returned with a value = nulval, unless nulval = 0
(or = ’ ’ for ffgcvs) in which case no checking for undefined values will
be performed. The anynul parameter is set to true if any of the returned
elements are undefined. For the _log (logical) variant, the C storage type is a
char single-byte character. A FITS value of ‘T’rue
reads as 1 and ‘F’ reads as 0; other non-FITS characters
are preserved untranslated.
For the _str (string) variant the number
of elements is the number of strings, and the caller must allocate storage
for both the array of pointers array and the character array data
itself (use fits_get_col_display_width or fits_get_coltype to
determine the number of characters). See section 4.5
(“Dealing with Character Strings”) for more information. Also, when
the _byt variant is used to read a column stored in the file as
string data (TFORMn = ’nA’), the subroutine will read the character
bytes (instead of attempting to perform a numerical conversion as other
integer variants would do), with no attempt at null termination.
For the _cmp and _dblcmp
(complex and double complex) variants, nelements is the number
of numerical pairs; the number of floats or doubles that must be
pre-allocated is 2*nelements.
int fits_read_col_str / ffgcvs
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
LONGLONG nelements, char *nulstr, > char **array, int *anynul,
int *status)
int fits_read_col_[log,byt,sht,usht,int,uint,lng,ulng, lnglng, ulnglng, flt, dbl, cmp, dblcmp] /
ffgcv[l,b,i,ui,k,uk,j,uj,jj,ujj,e,d,c,m]
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
LONGLONG nelements, DTYPE nulval, > DTYPE *array, int *anynul,
int *status)
int fits_read_colnull_str / ffgcfs
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
LONGLONG nelements, > char **array, char *nullarray, int *anynul,
int *status)
int fits_read_colnull_[log,byt,sht,usht,int,uint,lng,ulng,lnglng,ulnglng,flt,dbl,cmp,dblcmp] /
ffgcf[l,b,i,ui,k,uk,j,uj,jj,ujj,e,d,c,m]
(fitsfile *fptr, int colnum, LONGLONG firstrow,
LONGLONG firstelem, LONGLONG nelements, > DTYPE *array,
char *nullarray, int *anynul, int *status)
int fits_read_subset_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffgsv[b,i,ui,k,uk,j,uj,jj,ull,e,d]
(fitsfile *fptr, int colnum, int naxis, long *naxes, long *fpixel,
long *lpixel, long *inc, DTYPE nulval, > DTYPE *array, int *anynul,
int *status)
int fits_read_subsetnull_[byt, sht, usht, int, uint, lng, ulng, lnglng, ulnglng, flt, dbl] /
ffgsf[b,i,ui,k,uk,j,uj,jj,ujj,e,d]
(fitsfile *fptr, int colnum, int naxis, long *naxes,
long *fpixel, long *lpixel, long *inc, > DTYPE *array,
char *nullarray, int *anynul, int *status)
int fits_read_col_bit / ffgcx
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstbit,
LONGLONG nbits, > char *larray, int *status)
int fits_read_col_bit_[usht, uint] / ffgcx[ui,uk]
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG, nrows,
long firstbit, long nbits, > DTYPE *array, int *status)
int fits_read_descript / ffgdes
(fitsfile *fptr, int colnum, LONGLONG rownum, > long *repeat,
long *offset, int *status)
int fits_read_descriptll / ffgdesll
(fitsfile *fptr, int colnum, LONGLONG rownum, > LONGLONG *repeat,
LONGLONG *offset, int *status)
int fits_read_descripts / ffgdess
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows
> long *repeat, long *offset, int *status)
int fits_read_descriptsll / ffgdessll
(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows
> LONGLONG *repeat, LONGLONG *offset, int *status)