File-level OIFITS I/O

This module provides routines for reading and writing entire OIFITS files. More...


Data Structures

struct  oi_fits
 Data for OIFITS file. More...

Files

file  oifile.h
 Data structure definitions and function prototypes for file-level operations on OIFITS data.
file  oifile.c
 Implementation of file-level API for OIFITS data.

Defines

#define MEMDUP(dest, src, size)   { (dest) = malloc((size)); memcpy((dest), (src), (size)); }

Functions

void init_oi_fits (oi_fits *)
 Initialise empty oi_fits struct.
STATUS write_oi_fits (const char *, oi_fits, STATUS *)
 Write OIFITS tables to new FITS file.
STATUS read_oi_fits (const char *, oi_fits *, STATUS *)
 Read all OIFITS tables from FITS file.
void free_oi_fits (oi_fits *)
 Free storage used for OIFITS data.
oi_arrayoi_fits_lookup_array (const oi_fits *, const char *)
 Return oi_array corresponding to specified ARRNAME.
elementoi_fits_lookup_element (const oi_fits *, const char *, int)
 Lookup array element corresponding to specified ARRNAME & STA_INDEX.
oi_wavelengthoi_fits_lookup_wavelength (const oi_fits *, const char *)
 Lookup oi_wavelength corresponding to specified INSNAME.
targetoi_fits_lookup_target (const oi_fits *, int)
 Lookup target record corresponding to specified TARGET_ID.
const char * format_oi_fits_summary (const oi_fits *)
 Generate file summary string.
void print_oi_fits_summary (const oi_fits *)
 Print file summary to stdout.
oi_targetdup_oi_target (const oi_target *)
 Make deep copy of a OI_TARGET table.
oi_arraydup_oi_array (const oi_array *)
 Make deep copy of a OI_ARRAY table.
oi_wavelengthdup_oi_wavelength (const oi_wavelength *)
 Make deep copy of a OI_WAVELENGTH table.
oi_visdup_oi_vis (const oi_vis *)
 Make deep copy of a OI_VIS table.
oi_vis2dup_oi_vis2 (const oi_vis2 *)
 Make deep copy of a OI_VIS2 table.
oi_t3dup_oi_t3 (const oi_t3 *)
 Make deep copy of a OI_T3 table.


Detailed Description

This module provides routines for reading and writing entire OIFITS files.

Use read_oi_fits() to read a file. free_oi_fits() will free the storage allocated by read_oi_fits(). Use init_oi_fits() to initialise an empty dataset, then after filling in the contents call write_oi_fits() to write the dataset to a file.

Functions to format and display strings summarising the file contents are provided: format_oi_fits_summary() and print_oi_fits_summary()

A set of functions oi_fits_lookup_*() (e.g. oi_fits_lookup_array())) are also provided, to facilitate following cross-references between OI_FITS tables.


Define Documentation

#define MEMDUP ( dest,
src,
size   )     { (dest) = malloc((size)); memcpy((dest), (src), (size)); }


Function Documentation

void init_oi_fits ( oi_fits pOi  ) 

STATUS write_oi_fits ( const char *  filename,
oi_fits  oi,
STATUS pStatus 
)

Write OIFITS tables to new FITS file.

Parameters:
filename name of file to create
oi file data struct, see oifile.h
pStatus pointer to status variable
Returns:
On error, returns non-zero cfitsio error code (also assigned to *pStatus)

References oi_fits::arrayList, oi_hush_errors, oi_fits::t3List, oi_fits::targets, oi_fits::vis2List, oi_fits::visList, oi_fits::wavelengthList, write_oi_array(), WRITE_OI_LIST, write_oi_t3(), write_oi_target(), write_oi_vis(), write_oi_vis2(), and write_oi_wavelength().

STATUS read_oi_fits ( const char *  filename,
oi_fits pOi,
STATUS pStatus 
)

Read all OIFITS tables from FITS file.

Parameters:
filename name of file to read
pOi pointer to uninitialised file data struct, see oifile.h
pStatus pointer to status variable
Returns:
On error, returns non-zero cfitsio error code (also assigned to *pStatus). Contents of file data struct are undefined

References oi_fits::arrayHash, oi_fits::arrayList, oi_t3::arrname, oi_vis2::arrname, oi_vis::arrname, oi_t3::insname, oi_vis2::insname, oi_vis::insname, oi_fits::numArray, oi_fits::numT3, oi_fits::numVis, oi_fits::numVis2, oi_fits::numWavelength, oi_hush_errors, read_next_oi_array(), read_next_oi_t3(), read_next_oi_vis(), read_next_oi_vis2(), read_next_oi_wavelength(), read_oi_target(), oi_fits::t3List, oi_fits::targets, oi_fits::vis2List, oi_fits::visList, oi_fits::wavelengthHash, and oi_fits::wavelengthList.

void free_oi_fits ( oi_fits pOi  ) 

oi_array* oi_fits_lookup_array ( const oi_fits pOi,
const char *  arrname 
)

Return oi_array corresponding to specified ARRNAME.

Parameters:
pOi pointer to file data struct, see oifile.h
arrname value of ARRNAME keyword
Returns:
pointer to oi_array matching arrname, or NULL if no match

References oi_fits::arrayHash.

Referenced by oi_fits_lookup_element().

element* oi_fits_lookup_element ( const oi_fits pOi,
const char *  arrname,
int  staIndex 
)

Lookup array element corresponding to specified ARRNAME & STA_INDEX.

Parameters:
pOi pointer to file data struct, see oifile.h
arrname value of ARRNAME keyword
staIndex value of STA_INDEX from data table
Returns:
ptr to 1st target struct matching targetId, or NULL if no match

References oi_array::elem, oi_array::nelement, oi_fits_lookup_array(), and element::sta_index.

Referenced by check_elements_present().

oi_wavelength* oi_fits_lookup_wavelength ( const oi_fits pOi,
const char *  insname 
)

Lookup oi_wavelength corresponding to specified INSNAME.

Parameters:
pOi pointer to file data struct, see oifile.h
insname value of INSNAME keyword
Returns:
pointer to oi_wavelength matching insname, or NULL if no match

References oi_fits::wavelengthHash.

target* oi_fits_lookup_target ( const oi_fits pOi,
int  targetId 
)

Lookup target record corresponding to specified TARGET_ID.

Parameters:
pOi pointer to file data struct, see oifile.h
targetId value of TARGET_ID from data table
Returns:
ptr to 1st target struct matching targetId, or NULL if no match

References oi_target::ntarget, oi_target::targ, target::target_id, and oi_fits::targets.

Referenced by check_targets_present().

const char* format_oi_fits_summary ( const oi_fits pOi  ) 

Generate file summary string.

Parameters:
pOi pointer to oi_fits struct
Returns:
String summarising supplied dataset

References oi_fits::arrayList, FORMAT_OI_LIST_SUMMARY, oi_fits::numArray, oi_fits::numT3, oi_fits::numVis, oi_fits::numVis2, oi_fits::numWavelength, oi_fits::t3List, oi_fits::vis2List, oi_fits::visList, and oi_fits::wavelengthList.

Referenced by print_oi_fits_summary().

void print_oi_fits_summary ( const oi_fits pOi  ) 

Print file summary to stdout.

Parameters:
pOi pointer to oi_fits struct

References format_oi_fits_summary().

oi_target* dup_oi_target ( const oi_target pInTab  ) 

Make deep copy of a OI_TARGET table.

Parameters:
pInTab pointer to input table
Returns:
Pointer to newly-allocated copy of input table

References MEMDUP, oi_target::ntarget, and oi_target::targ.

oi_array* dup_oi_array ( const oi_array pInTab  ) 

Make deep copy of a OI_ARRAY table.

Parameters:
pInTab pointer to input table
Returns:
Pointer to newly-allocated copy of input table

References oi_array::elem, MEMDUP, and oi_array::nelement.

Referenced by filter_all_oi_array().

oi_wavelength* dup_oi_wavelength ( const oi_wavelength pInTab  ) 

Make deep copy of a OI_WAVELENGTH table.

Parameters:
pInTab pointer to input table
Returns:
Pointer to newly-allocated copy of input table

References oi_wavelength::eff_band, oi_wavelength::eff_wave, MEMDUP, and oi_wavelength::nwave.

Referenced by merge_all_oi_wavelength().

oi_vis* dup_oi_vis ( const oi_vis pInTab  ) 

Make deep copy of a OI_VIS table.

Parameters:
pInTab pointer to input table
Returns:
Pointer to newly-allocated copy of input table

References oi_vis_record::flag, MEMDUP, oi_vis::numrec, oi_vis::nwave, oi_vis::record, oi_vis_record::visamp, oi_vis_record::visamperr, oi_vis_record::visphi, and oi_vis_record::visphierr.

Referenced by merge_all_oi_vis().

oi_vis2* dup_oi_vis2 ( const oi_vis2 pInTab  ) 

Make deep copy of a OI_VIS2 table.

Parameters:
pInTab pointer to input table
Returns:
Pointer to newly-allocated copy of input table

References oi_vis2_record::flag, MEMDUP, oi_vis2::numrec, oi_vis2::nwave, oi_vis2::record, oi_vis2_record::vis2data, and oi_vis2_record::vis2err.

Referenced by merge_all_oi_vis2().

oi_t3* dup_oi_t3 ( const oi_t3 pInTab  ) 

Make deep copy of a OI_T3 table.

Parameters:
pInTab pointer to input table
Returns:
Pointer to newly-allocated copy of input table

References oi_t3_record::flag, MEMDUP, oi_t3::numrec, oi_t3::nwave, oi_t3::record, oi_t3_record::t3amp, oi_t3_record::t3amperr, oi_t3_record::t3phi, and oi_t3_record::t3phierr.

Referenced by merge_all_oi_t3().


Generated on Mon Jun 8 12:45:08 2009 for OIFITSlib by  doxygen 1.5.7.1