Data Structures | |
struct | oi_check_result |
Result of checking for a particular class of standard breach. More... | |
Files | |
file | oicheck.h |
Definitions for OIFITS conformity checker. | |
file | oicheck.c |
Implementation of OIFITS conformity checker. | |
Defines | |
#define | MAX_REPORT 10 |
Maximum times to report same class of breach. | |
Typedefs | |
typedef oi_breach_level(* | check_func )(oi_fits *, oi_check_result *) |
Standard interface to checking function. | |
Enumerations | |
enum | oi_breach_level { OI_BREACH_NONE, OI_BREACH_WARNING, OI_BREACH_NOT_OIFITS, OI_BREACH_NOT_FITS } |
Severity of a check failure. More... | |
Functions | |
void | init_check_result (oi_check_result *) |
Initialise check result struct. | |
void | free_check_result (oi_check_result *) |
Free dynamically-allocated storage within check result struct. | |
char * | format_check_result (oi_check_result *) |
Return string describing check result. | |
void | print_check_result (oi_check_result *) |
Print check result to stdout. | |
oi_breach_level | check_unique_targets (oi_fits *, oi_check_result *) |
Check targets have unique identifiers. | |
oi_breach_level | check_targets_present (oi_fits *, oi_check_result *) |
Check all referenced targets are present in OI_TARGET. | |
oi_breach_level | check_elements_present (oi_fits *, oi_check_result *) |
Check all referenced array elements are present. | |
oi_breach_level | check_flagging (oi_fits *, oi_check_result *) |
Check for negative error bars. | |
oi_breach_level | check_t3amp (oi_fits *, oi_check_result *) |
Check for unnormalised (i.e. | |
oi_breach_level | check_waveorder (oi_fits *, oi_check_result *) |
Check for un-ordered wavelength values in OI_WAVELENGTH. |
The list of checks is not exhaustive, but goes beyond the level of conformity needed for read_oi_fits() to succeed.
Separate functions are provided to check different aspects of the dataset, so that an application can perform only those checks that are relevant to the tasks it performs. The available checking functions are:
Each checking function is passed a pointer to a oi_fits struct containing the data to check (except check_unique_targets()), and a pointer to an unintialised oi_check_result struct. The latter will contain the detailed results of the check (including a truncated list of the places in the file where problems were detected) when the function returns.
The checking function returns a oi_breach_level giving the severity of the worst problem found. The caller may use this value to decide whether to report the problems to the user, which it should do by calling format_check_result() or print_check_result().
Before reusing a oi_check_result for another check, you should pass its address to free_check_result() to avoid memory leaks.
#define MAX_REPORT 10 |
Maximum times to report same class of breach.
Referenced by format_check_result(), and init_check_result().
typedef oi_breach_level(* check_func)(oi_fits *, oi_check_result *) |
Standard interface to checking function.
enum oi_breach_level |
void init_check_result | ( | oi_check_result * | pResult | ) |
Initialise check result struct.
pResult | pointer to check result struct to initialise |
References oi_check_result::chunk, oi_check_result::description, oi_check_result::level, oi_check_result::location, MAX_REPORT, oi_check_result::numBreach, and OI_BREACH_NONE.
Referenced by check_elements_present(), check_flagging(), check_t3amp(), check_targets_present(), check_unique_targets(), and check_waveorder().
void free_check_result | ( | oi_check_result * | pResult | ) |
Free dynamically-allocated storage within check result struct.
pResult | pointer to check result struct |
References oi_check_result::chunk.
char* format_check_result | ( | oi_check_result * | pResult | ) |
Return string describing check result.
pResult | pointer to check result struct |
References oi_check_result::description, oi_check_result::level, oi_check_result::location, MAX_REPORT, oi_check_result::numBreach, oi_breach_level_desc, OI_BREACH_NONE, and pGStr.
Referenced by print_check_result().
void print_check_result | ( | oi_check_result * | pResult | ) |
Print check result to stdout.
pResult | pointer to check result struct |
References format_check_result().
oi_breach_level check_unique_targets | ( | oi_fits * | pOi, | |
oi_check_result * | pResult | |||
) |
Check targets have unique identifiers.
pOi | pointer to oi_fits struct to check | |
pResult | pointer to oi_check_result struct to store result in |
References init_check_result(), oi_check_result::level, oi_target::ntarget, OI_BREACH_WARNING, oi_target::targ, target::target, target::target_id, and oi_fits::targets.
oi_breach_level check_targets_present | ( | oi_fits * | pOi, | |
oi_check_result * | pResult | |||
) |
Check all referenced targets are present in OI_TARGET.
pOi | pointer to oi_fits struct to check | |
pResult | pointer to oi_check_result struct to store result in |
References init_check_result(), oi_check_result::level, oi_t3::numrec, oi_vis2::numrec, oi_vis::numrec, OI_BREACH_NOT_OIFITS, oi_fits_lookup_target(), oi_t3::record, oi_vis2::record, oi_vis::record, oi_fits::t3List, oi_t3_record::target_id, oi_vis2_record::target_id, oi_vis_record::target_id, oi_fits::vis2List, and oi_fits::visList.
oi_breach_level check_elements_present | ( | oi_fits * | pOi, | |
oi_check_result * | pResult | |||
) |
Check all referenced array elements are present.
pOi | pointer to oi_fits struct to check | |
pResult | pointer to oi_check_result struct to store result in |
References oi_t3::arrname, oi_vis2::arrname, oi_vis::arrname, init_check_result(), oi_check_result::level, oi_t3::numrec, oi_vis2::numrec, oi_vis::numrec, OI_BREACH_NOT_OIFITS, oi_fits_lookup_element(), oi_t3::record, oi_vis2::record, oi_vis::record, oi_t3_record::sta_index, oi_vis2_record::sta_index, oi_vis_record::sta_index, oi_fits::t3List, oi_fits::vis2List, and oi_fits::visList.
oi_breach_level check_flagging | ( | oi_fits * | pOi, | |
oi_check_result * | pResult | |||
) |
Check for negative error bars.
pOi | pointer to oi_fits struct to check | |
pResult | pointer to oi_check_result struct to store result in |
References oi_t3_record::flag, oi_vis2_record::flag, oi_vis_record::flag, init_check_result(), oi_check_result::level, oi_t3::numrec, oi_vis2::numrec, oi_vis::numrec, oi_t3::nwave, oi_vis2::nwave, oi_vis::nwave, OI_BREACH_NOT_OIFITS, oi_t3::record, oi_vis2::record, oi_vis::record, oi_t3_record::t3amperr, oi_fits::t3List, oi_t3_record::t3phierr, oi_vis2_record::vis2err, oi_fits::vis2List, oi_vis_record::visamperr, oi_fits::visList, and oi_vis_record::visphierr.
oi_breach_level check_t3amp | ( | oi_fits * | pOi, | |
oi_check_result * | pResult | |||
) |
Check for unnormalised (i.e.
significantly > 1) T3AMP values.
pOi | pointer to oi_fits struct to check | |
pResult | pointer to oi_check_result struct to store result in |
References oi_t3_record::flag, init_check_result(), oi_check_result::level, oi_t3::numrec, oi_t3::nwave, OI_BREACH_NOT_OIFITS, oi_t3::record, oi_t3_record::t3amp, oi_t3_record::t3amperr, and oi_fits::t3List.
oi_breach_level check_waveorder | ( | oi_fits * | pOi, | |
oi_check_result * | pResult | |||
) |
Check for un-ordered wavelength values in OI_WAVELENGTH.
pOi | pointer to oi_fits struct to check | |
pResult | pointer to oi_check_result struct to store result in |
References oi_wavelength::eff_wave, init_check_result(), oi_wavelength::insname, oi_check_result::level, oi_wavelength::nwave, OI_BREACH_WARNING, and oi_fits::wavelengthList.