next up previous
Next: 3. Usages and examples Up: Librdsmafits.a : a C Previous: 1. Introduction

2. Description of librdsmafits.a

An SMA FITS file contains, at least, five FITS binary tables: array geometry(AG), frequency(FQ), source(SU), antenna(AN), and UV data(UV) tables. The librdsmafits.a contains a set of routines written in C, which can read each of binary tables in SMA FITS files. In actual applications, the header files, fits_reader.h and smadb.h need to be included to use librdsmafits.a. These header files contain definitions of C structures for storing the FITS header and data. Also, complete FITS header information for each table in the file is written out to a log file.

Individual routines in librdsmafits.a are described below.

int read_BasicHdr (int fd, FILE *flist, struct run_log)


Read the basic header information that is contained in the beginning of a FITS file. The integer fd is a identification of an opened FITS file. The pointer *flist is a FILE pointer for a log file. The header parameters related to RUN_LOG table in the SMADB1 are stored in a structure, run_log. Returns a number of the rows read.



int readAG (int fd, FILE *flist, int nbytes_read, struct tbl_header *p_tblhd,
struct fits_key *p_fkey, struct arr_geo *p_arr_geo, struct ag_FITS *p_ag)



Read the array geometry (AG) table. The integer nbytes_read is a number of the bytes already read. The common FITS keywords are stored in tbl_header. Structures fits_key and arr_geo is designed to store the parameters used in the SMADB tables, FITS_KEY and ARR_GEO. A structure, ag_FITS is used for storing the binary data in the array geometrical table. Returns a number of the rows read.



int readFQ (int fd, FILE *flist, int nbytes_read, struct tbl_header *p_tblhd, struct fq_FITS *p_fq, struct freq *p_freq)


Read the frequency (FQ) table. The binary table data are stored in a structure, fq_FITS. A structure, freq is to store the parameters for the FREQ table in SMADB. Returns a number of the rows read.



int readSU (int fd, FILE *flist, int nbytes_read, struct tbl_header *p_tblhd, struct su_FITS *p_su)


Read the source(SU) table. The binary table data are stored in a structure, su_FITS. Returns a number of the rows read.



int readAN (int fd, FILE *flist, int nbytes_read, struct tbl_header *p_tblhd, struct an_FITS *p_an)


Read the antenna(AN) table. The binary table data are stored in a structure, an_FITS. Returns a number of the rows read.



int readUV (int fd, FILE *flist, int nbytes_read, struct tbl_header *p_tblhd)


Read uv data (UV) table. Returns a number of the rows to be read. At this moment, this routine reads uv data into two structures, UV1 and UV2 but it does not pass these data as arguments.



int fitsRead (int fd, char *p_out, int n_bytes)


Read n_bytes from a file, fd and copy it to *p_out. This is a basic routine called from other routines in librdsmafits.a. fits_reader.h contains structures for storing FITS binary tables.

smadb.h contains the structures for storing SMADB table entries.

These are the basic utility routines that can read the tables consisting of the current SMA FITS files. As the SMA correlator and real-time software system come on line, more ancillary tables, such as flag table, interferometer model table and etc. will be developed and added into the SMA FITS files. The librdsmafits.a will need to be updated along with the real-time software development. In addition, the current version of librdsmafits.a is designed based on the process converting SMA FITS-IDI files to the data structure for SMADB in Sybase. It is useful to update this library for a more generalized purpose.

1 SMADB is the on-line database for SMA astronomical data. The database manage system is Sybase. The current design for the structure of SMADB utilizes eight entry tables RUN_LOG, SOUR, VELO, CORR, FITS_KEY, FREQ, VIS and DFILE. The information for each observing run and the location of each SMA FITS file are stored in SMADB, which can be retrieved on line with a web browser.


next up previous
Next: 3. Usages and examples Up: Librdsmafits.a : a C Previous: 1. Introduction
Takahiro (Tak) Tsutsumi
9/30/1999