OIFITS Conformity Checker

This module provides a set of checks that a OIFITS dataset conforms to the OIFITS standard. More...


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.


Detailed Description

This module provides a set of checks that a OIFITS dataset conforms to the OIFITS standard.

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 Documentation

#define MAX_REPORT   10

Maximum times to report same class of breach.

Referenced by format_check_result(), and init_check_result().


Typedef Documentation

Standard interface to checking function.


Enumeration Type Documentation

Severity of a check failure.

Enumerator:
OI_BREACH_NONE  No problem.
OI_BREACH_WARNING  Valid OIFITS, but may cause problems.
OI_BREACH_NOT_OIFITS  Does not conform to the OIFITS standard.
OI_BREACH_NOT_FITS  Does not conform to the FITS standard.


Function Documentation

void init_check_result ( oi_check_result pResult  ) 

void free_check_result ( oi_check_result pResult  ) 

Free dynamically-allocated storage within check result struct.

Parameters:
pResult pointer to check result struct

References oi_check_result::chunk.

char* format_check_result ( oi_check_result pResult  ) 

Return string describing check result.

Parameters:
pResult pointer to check result struct
Returns:
String describing result of check, or NULL if no error

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.

Parameters:
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.

Parameters:
pOi pointer to oi_fits struct to check
pResult pointer to oi_check_result struct to store result in
Returns:
oi_breach level indicating overall test result

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.

Parameters:
pOi pointer to oi_fits struct to check
pResult pointer to oi_check_result struct to store result in
Returns:
oi_breach level indicating overall test result

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.

Parameters:
pOi pointer to oi_fits struct to check
pResult pointer to oi_check_result struct to store result in
Returns:
oi_breach level indicating overall test result

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 
)

oi_breach_level check_t3amp ( oi_fits pOi,
oi_check_result pResult 
)

Check for unnormalised (i.e.

significantly > 1) T3AMP values.

Parameters:
pOi pointer to oi_fits struct to check
pResult pointer to oi_check_result struct to store result in
Returns:
oi_breach level indicating overall test result

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.

Parameters:
pOi pointer to oi_fits struct to check
pResult pointer to oi_check_result struct to store result in
Returns:
oi_breach level indicating overall test result

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.


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