Data Structures | |
struct | oi_filter_spec |
Filter specification for OIFITS data. More... | |
Files | |
file | oifilter.h |
Definitions for OIFITS filter. | |
file | oifilter.c |
Implementation of OIFITS filter. | |
Functions | |
void | init_oi_filter (oi_filter_spec *) |
Initialise filter specification to accept all data. | |
const char * | format_oi_filter (oi_filter_spec *) |
Generate string representation of filter spec. | |
void | print_oi_filter (oi_filter_spec *) |
Print filter spec to stdout. | |
void | apply_oi_filter (const oi_fits *, const oi_filter_spec *, oi_fits *) |
Filter OIFITS data. | |
void | filter_oi_target (const oi_target *, const oi_filter_spec *, oi_target *) |
Filter OI_TARGET table. | |
void | filter_all_oi_array (const oi_fits *, const oi_filter_spec *, oi_fits *) |
Filter OI_ARRAY tables. | |
GHashTable * | filter_all_oi_wavelength (const oi_fits *, const oi_filter_spec *, oi_fits *) |
Filter all OI_WAVELENGTH tables, remembering which wavelength channels have been accepted for each. | |
void | filter_oi_wavelength (const oi_wavelength *, const float[2], oi_wavelength *, char *) |
Filter specified OI_WAVELENGTH table. | |
void | filter_all_oi_vis (const oi_fits *, const oi_filter_spec *, GHashTable *, oi_fits *) |
Filter all OI_VIS tables. | |
void | filter_oi_vis (const oi_vis *, const oi_filter_spec *, const char *, oi_vis *) |
Filter specified OI_VIS table by TARGET_ID, MJD, and wavelength. | |
void | filter_all_oi_vis2 (const oi_fits *, const oi_filter_spec *, GHashTable *, oi_fits *) |
Filter all OI_VIS tables. | |
void | filter_oi_vis2 (const oi_vis2 *, const oi_filter_spec *, const char *, oi_vis2 *) |
Filter specified OI_VIS2 table by TARGET_ID, MJD, and wavelength. | |
void | filter_all_oi_t3 (const oi_fits *, const oi_filter_spec *, GHashTable *, oi_fits *) |
Filter all OI_T3 tables. | |
void | filter_oi_t3 (const oi_t3 *, const oi_filter_spec *, const char *, oi_t3 *) |
Filter specified OI_T3 table by TARGET_ID, MJD, and wavelength. |
The criteria by which data are accepted or rejected are specified by an oi_filter_spec struct. A pointer to this struct is passed to apply_oi_filter() along with pointers to two oi_fits structs, one containing the input data. The second oi_fits should be uninitialised on calling apply_oi_filter(); when the function returns this will contain the filtered (output) data.
In most cases, empty tables are not included in the filtered output.
The module also implements a parser for command-line options that may be used to specify the filter. To support these options, an application must use the GLib commandline option parser described at http://library.gnome.org/devel/glib/stable/glib-Commandline-option-parser.html Typically support for filtering command-line options would be implemented as follows:
Functions to return and to display string representations of a filter are also provided: format_oi_filter() and print_oi_filter()
Applications should not normally need to call the lower-level functions that filter subsets of the OIFITS tables (such as filter_oi_target() and filter_all_oi_vis2())
void init_oi_filter | ( | oi_filter_spec * | pFilter | ) |
Initialise filter specification to accept all data.
pFilter | pointer to filter specification |
References oi_filter_spec::accept_flagged, oi_filter_spec::accept_t3amp, oi_filter_spec::accept_t3phi, oi_filter_spec::accept_vis, oi_filter_spec::accept_vis2, oi_filter_spec::arrname, oi_filter_spec::bas_range, oi_filter_spec::insname, oi_filter_spec::mjd_range, oi_filter_spec::snr_range, oi_filter_spec::target_id, and oi_filter_spec::wave_range.
const char* format_oi_filter | ( | oi_filter_spec * | pFilter | ) |
Generate string representation of filter spec.
pFilter | pointer to filter specification |
References oi_filter_spec::accept_flagged, oi_filter_spec::accept_t3amp, oi_filter_spec::accept_t3phi, oi_filter_spec::accept_vis, oi_filter_spec::accept_vis2, oi_filter_spec::arrname, oi_filter_spec::bas_range, oi_filter_spec::insname, oi_filter_spec::mjd_range, pGStr, oi_filter_spec::snr_range, oi_filter_spec::target_id, and oi_filter_spec::wave_range.
Referenced by print_oi_filter().
void print_oi_filter | ( | oi_filter_spec * | pFilter | ) |
Print filter spec to stdout.
pFilter | pointer to filter specification |
References format_oi_filter().
void apply_oi_filter | ( | const oi_fits * | pInput, | |
const oi_filter_spec * | pFilter, | |||
oi_fits * | pOutput | |||
) |
Filter OIFITS data.
Makes a deep copy.
pInput | pointer to input file data struct, see oifile.h | |
pFilter | pointer to filter specification | |
pOutput | pointer to uninitialised output data struct |
References filter_all_oi_array(), filter_all_oi_t3(), filter_all_oi_vis(), filter_all_oi_vis2(), filter_all_oi_wavelength(), filter_oi_target(), init_oi_fits(), and oi_fits::targets.
void filter_oi_target | ( | const oi_target * | pInTargets, | |
const oi_filter_spec * | pFilter, | |||
oi_target * | pOutTargets | |||
) |
Filter OI_TARGET table.
pInTargets | pointer to input oi_target | |
pFilter | pointer to filter specification | |
pOutTargets | pointer to oi_target to write filtered records to |
References MEMDUP, oi_target::ntarget, oi_target::revision, oi_target::targ, target::target_id, and oi_filter_spec::target_id.
Referenced by apply_oi_filter().
void filter_all_oi_array | ( | const oi_fits * | pInput, | |
const oi_filter_spec * | pFilter, | |||
oi_fits * | pOutput | |||
) |
Filter OI_ARRAY tables.
pInput | pointer to input dataset | |
pFilter | pointer to filter specification | |
pOutput | pointer to oi_fits struct to write filtered tables to |
References ACCEPT_ARRNAME, oi_fits::arrayHash, oi_fits::arrayList, oi_array::arrname, dup_oi_array(), and oi_fits::numArray.
Referenced by apply_oi_filter().
GHashTable* filter_all_oi_wavelength | ( | const oi_fits * | pInput, | |
const oi_filter_spec * | pFilter, | |||
oi_fits * | pOutput | |||
) |
Filter all OI_WAVELENGTH tables, remembering which wavelength channels have been accepted for each.
pInput | pointer to input dataset | |
pFilter | pointer to filter specification | |
pOutput | pointer to oi_fits struct to write filtered tables to |
References ACCEPT_INSNAME, filter_oi_wavelength(), oi_wavelength::insname, oi_fits::numWavelength, oi_wavelength::nwave, oi_filter_spec::wave_range, oi_fits::wavelengthHash, and oi_fits::wavelengthList.
Referenced by apply_oi_filter().
void filter_oi_wavelength | ( | const oi_wavelength * | pInWave, | |
const float | waveRange[2], | |||
oi_wavelength * | pOutWave, | |||
char * | useWave | |||
) |
Filter specified OI_WAVELENGTH table.
pInWave | pointer to input oi_wavelength | |
waveRange | minimum and maximum wavelengths to accept /m | |
pOutWave | pointer to output oi_wavelength (uninitialised) | |
useWave | on output, boolean array giving wavelength channels that were accepted by the filter |
References oi_wavelength::eff_band, oi_wavelength::eff_wave, oi_wavelength::insname, oi_wavelength::nwave, and oi_wavelength::revision.
Referenced by filter_all_oi_wavelength().
void filter_all_oi_vis | ( | const oi_fits * | pInput, | |
const oi_filter_spec * | pFilter, | |||
GHashTable * | useWaveHash, | |||
oi_fits * | pOutput | |||
) |
Filter all OI_VIS tables.
pInput | pointer to input dataset | |
pFilter | pointer to filter specification | |
useWaveHash | hash table with INSAME values as keys and char[] specifying wavelength channels to accept as values | |
pOutput | pointer to output oi_fits struct |
References ACCEPT_ARRNAME, ACCEPT_INSNAME, oi_filter_spec::accept_vis, filter_oi_vis(), oi_vis::insname, oi_vis::numrec, oi_fits::numVis, oi_vis::nwave, and oi_fits::visList.
Referenced by apply_oi_filter().
void filter_oi_vis | ( | const oi_vis * | pInTab, | |
const oi_filter_spec * | pFilter, | |||
const char * | useWave, | |||
oi_vis * | pOutTab | |||
) |
Filter specified OI_VIS table by TARGET_ID, MJD, and wavelength.
pInTab | pointer to input oi_vis | |
pFilter | pointer to filter specification | |
useWave | boolean array giving wavelength channels to accept | |
pOutTab | pointer to output oi_vis |
References oi_filter_spec::accept_flagged, oi_filter_spec::bas_range, oi_vis_record::flag, oi_vis_record::mjd, oi_filter_spec::mjd_range, oi_vis::numrec, oi_vis::nwave, RAD2DEG, oi_vis::record, oi_filter_spec::snr_range, oi_vis_record::target_id, oi_filter_spec::target_id, oi_vis_record::ucoord, oi_vis_record::vcoord, oi_vis_record::visamp, oi_vis_record::visamperr, oi_vis_record::visphi, and oi_vis_record::visphierr.
Referenced by filter_all_oi_vis().
void filter_all_oi_vis2 | ( | const oi_fits * | pInput, | |
const oi_filter_spec * | pFilter, | |||
GHashTable * | useWaveHash, | |||
oi_fits * | pOutput | |||
) |
Filter all OI_VIS tables.
pInput | pointer to input dataset | |
pFilter | pointer to filter specification | |
useWaveHash | hash table with INSAME values as keys and char[] specifying wavelength channels to accept as values | |
pOutput | pointer to output oi_fits struct |
References ACCEPT_ARRNAME, ACCEPT_INSNAME, oi_filter_spec::accept_vis2, filter_oi_vis2(), oi_vis2::insname, oi_vis2::numrec, oi_fits::numVis2, oi_vis2::nwave, and oi_fits::vis2List.
Referenced by apply_oi_filter().
void filter_oi_vis2 | ( | const oi_vis2 * | pInTab, | |
const oi_filter_spec * | pFilter, | |||
const char * | useWave, | |||
oi_vis2 * | pOutTab | |||
) |
Filter specified OI_VIS2 table by TARGET_ID, MJD, and wavelength.
pInTab | pointer to input oi_vis2 | |
pFilter | pointer to filter specification | |
useWave | boolean array giving wavelength channels to accept | |
pOutTab | pointer to output oi_vis2 |
References oi_filter_spec::accept_flagged, oi_filter_spec::bas_range, oi_vis2_record::flag, oi_vis2_record::mjd, oi_filter_spec::mjd_range, oi_vis2::numrec, oi_vis2::nwave, oi_vis2::record, oi_filter_spec::snr_range, oi_vis2_record::target_id, oi_filter_spec::target_id, oi_vis2_record::ucoord, oi_vis2_record::vcoord, oi_vis2_record::vis2data, and oi_vis2_record::vis2err.
Referenced by filter_all_oi_vis2().
void filter_all_oi_t3 | ( | const oi_fits * | pInput, | |
const oi_filter_spec * | pFilter, | |||
GHashTable * | useWaveHash, | |||
oi_fits * | pOutput | |||
) |
Filter all OI_T3 tables.
pInput | pointer to input dataset | |
pFilter | pointer to filter specification | |
useWaveHash | hash table with INSAME values as keys and char[] specifying wavelength channels to accept as values | |
pOutput | pointer to output oi_fits struct |
References ACCEPT_ARRNAME, ACCEPT_INSNAME, oi_filter_spec::accept_t3amp, oi_filter_spec::accept_t3phi, filter_oi_t3(), oi_t3::insname, oi_t3::numrec, oi_fits::numT3, oi_t3::nwave, and oi_fits::t3List.
Referenced by apply_oi_filter().
void filter_oi_t3 | ( | const oi_t3 * | pInTab, | |
const oi_filter_spec * | pFilter, | |||
const char * | useWave, | |||
oi_t3 * | pOutTab | |||
) |
Filter specified OI_T3 table by TARGET_ID, MJD, and wavelength.
pInTab | pointer to input oi_t3 | |
pFilter | pointer to filter specification | |
useWave | boolean array giving wavelength channels to accept | |
pOutTab | pointer to output oi_t3 |
References oi_filter_spec::accept_flagged, oi_filter_spec::accept_t3amp, oi_filter_spec::accept_t3phi, oi_filter_spec::bas_range, oi_t3_record::flag, oi_t3_record::mjd, oi_filter_spec::mjd_range, oi_t3::numrec, oi_t3::nwave, RAD2DEG, oi_t3::record, oi_filter_spec::snr_range, oi_t3_record::t3amp, oi_t3_record::t3amperr, oi_t3_record::t3phi, oi_t3_record::t3phierr, oi_t3_record::target_id, oi_filter_spec::target_id, oi_t3_record::u1coord, oi_t3_record::u2coord, oi_t3_record::v1coord, and oi_t3_record::v2coord.
Referenced by filter_all_oi_t3().