VirusHealth Class Reference

Virus Health check routines.

Public Member Functions

Private Member Functions

Private Attributes


Constructor & Destructor Documentation

VirusHealth::VirusHealth ( const string &  filename,
unsigned int  recipe,
const CommonCheckOptions copts 
)

Initialize the VirusHealth class with the opened fits image, the recipe type (one of the vh() enum), and the optional verbose flag.

Parameters:
fitsfile ltl::FitsIn() of the opened fits image.
recipe integer specifying the recipe.
verbose boolean, if true write extened output to stdout.

References fitsfile_, get_string_key_(), n_checks_, n_passed_, opts_, recipe_, response_, unknown, CommonCheckOptions::verbose, and verbose_.

VirusHealth::~VirusHealth (  ) 

Member Function Documentation

void VirusHealth::write_file (  ) 
void VirusHealth::check_header (  ) 
void VirusHealth::validate_size (  ) 

Validate the image size. Check that the number of pixels along NAXIS1 is 1064 pixels (2064 / 2 + 32 pixels overscan) and along NAXIS2 is 1032 pixels (2064 binned 2 for 1).

References finish_check_(), fitsfile_, and log_test_().

Referenced by check_header().

void VirusHealth::validate_keywords (  ) 

Validate the presence of various header keywords, keywords checked are:

  • `AIRMASS`
  • `DITHER`
  • `IMAGETYP`

References finish_check_(), get_float_key_(), get_int_key_(), get_string_key_(), and log_test_().

Referenced by check_header().

void VirusHealth::validate_overscan ( const float  mean,
const float  stddev,
const float  maxdev_mean,
const float  maxdev_rms 
)

Validate the rms of the overscan by checking that the standard deviation of the overscan region is below the given maximum. The overscan region is read from the `BIASSEC` header keyword.

Parameters:
mean float expected mean.
stddev float expected standard deviation.
maxdev_mean float maximum allowed fractional difference of the mean.
maxdev_mean float maximum allowed fractional difference of the standard deviation.

References finish_check_(), log_test_(), and read_overscan_().

Referenced by check_header().

void VirusHealth::validate_exptime (  ) 

Validate the exposure time depending on the image type recipe. For bias frames, the exposure time must be zero seconds, for other images it must be not zero. For HETDEX observations the exposure time must be at least 3600 seconds.

References bias, finish_check_(), get_float_key_(), log_test_(), and recipe_.

Referenced by check_header().

void VirusHealth::validate_flatbias ( const float  maxdiff  ) 

Validate the overall flatness of the bias frame, by comparing the standard deviation and average of different sub images at 250:500,500:1000, 250:500,1500:2000, 750:1000,500:1000, 750:1000,1500:2000, and the overcan. If any of the differences exceeds the difference allowed by the relative difference given by maxdiff.

Parameters:
maxdiff float giving the maximum difference relative to the average / rms.

References finish_check_(), log_test_(), read_image_(), and read_overscan_().

Referenced by main().

void VirusHealth::validate_refbias ( const float  mean,
const float  stddev,
const float  maxdev_mean,
const float  maxdev_rms 
)

Validate that the bias and the reference bias frame are not too deviant. Check that the average image flux of the bias frame and the reference bias frame or the standard deviation of bias frame and the reference bias frame do not differ more than the maximum given by maxdiff.

Parameters:
mean float expected mean.
stddev float expected standard deviation.
maxdev_mean float maximum allowed fractional difference of the mean.
maxdev_mean float maximum allowed fractional difference of the standard deviation.

References finish_check_(), log_test_(), and read_image_().

Referenced by main().

void VirusHealth::validate_saturation ( const float  saturation  ) 

Validate that the image fluxes are below saturation limit.

Parameters:
saturation The saturation limit of the chip.

References finish_check_(), log_test_(), and read_image_().

Referenced by main().

void VirusHealth::validate_min_flux ( const float  minflux,
const int  nfibers,
const int  maxbad 
)

Validate the flux in all fibers is above the required minimum flux.

Parameters:
minflux The expected minimum flux

References finish_check_(), log_test_(), read_image_(), read_overscan_(), and Measure::search().

Referenced by main().

void VirusHealth::validate_n_fibers ( const int  nfibers,
const int  maxbad 
)

Validate that all expected fibers are lit.

Parameters:
nfibers Expected number of active fibers.
maxbad Maximum number of fibers allowed to go dark with only a warning raised. If more fibers fail an error is logged.

References finish_check_(), log_test_(), read_image_(), read_overscan_(), and Measure::search().

Referenced by main().

void VirusHealth::validate_throughput (  ) 

Validate the throughput.

Not yet implemented, the check always succeeds.

References finish_check_(), and log_test_().

Referenced by main().

void VirusHealth::validate_distortion ( const string &  distname  ) 

Validate the position of the fibers on the chip against a reference distortion.

Parameters:
distname The name of the reference distortion

Not yet implemented, the check always succeeds.

References finish_check_(), and log_test_().

Referenced by main().

void VirusHealth::validate_peaks ( const string &  linelist,
const string &  distname,
int  peak_tolerance,
int  max_missing 
)

Validate the arc peaks are at the expected positions and actual peaks.

Parameters:
linelist string The name of the arc line lists.
distname string The name of the reference distortion
peak_tolerance int maximum pixel offset from the expected position and half size of the patch used to perform the arc peak fit
max_missing int maximum number of missing fibers before giving up

References finish_check_(), gauss2Dfit(), Distortion::get_numfibers(), Distortion::get_reference_f(), get_string_key_(), ArcLineList::getActiveWLs(), ArcLineList::getNumActiveLines(), header_to_region_(), log_test_(), log_warning_(), Distortion::map_wf_x(), Distortion::map_wf_y(), read_image_(), read_overscan_(), and verbose_.

Referenced by main().

void VirusHealth::validate_sky ( float  skylevel  ) 

Validate the sky level is above the minimum sky level.

Parameters:
skylevel The minimum expected sky level.

Not yet implemented, the check always succeeds.

References finish_check_(), and log_test_().

Referenced by main().

int VirusHealth::get_n_checks (  )  [inline]

Get the number of checks run.

Returns:
Number of checks run

References n_checks_.

Referenced by main().

int VirusHealth::get_n_passed (  )  [inline]

Get the number of checks passed.

Returns:
Number of checks passed.

References n_passed_.

Referenced by main().

string& VirusHealth::get_response (  )  [inline]

Get the string with all the error messages.

Returns:
The error message string.

References response_.

Referenced by main().

MArray<float,2> VirusHealth::read_overscan_ ( void   )  [inline, private]
MArray<float,2> VirusHealth::read_image_ ( void   )  [inline, private]
MArray< float, 2 > VirusHealth::read_region_ ( FitsIn &  in,
const util::Region &  reg 
) [private]

Read a region from the fits file.

Parameters:
in The ltl::FitIn() object to read the region from.
reg The util::Region to read.
Returns:
ltl::MArray() the read image region.

Referenced by read_image_(), and read_overscan_().

util::Region VirusHealth::header_to_region_ ( const string &  key  )  throw (ltl::IOException) [private]

Convert a header region to a ltl Region. Read the region string from the header, and convert it to a util::Region object.

Parameters:
key The header key from which to read the region string
Returns:
util::Region() object.
Exceptions:
ltl::IOException Thrown if the header key cannot be found.

Referenced by read_image_(), read_overscan_(), and validate_peaks().

float VirusHealth::get_float_key_ ( const string  key  )  throw (ltl::IOException) [private]

Get a float header keyword.

Parameters:
key The keyword to read from the checked image.
Returns:
float The read and converted keyword
Exceptions:
util::IOException() Thrown if the keyword cannot be found

Referenced by validate_exptime(), and validate_keywords().

int VirusHealth::get_int_key_ ( const string  key  )  throw (ltl::IOException) [private]

Get a integer header keyword.

Parameters:
key The keyword to read from the checked image.
Returns:
int The read and converted keyword
Exceptions:
util::IOException() Thrown if the keyword cannot be found

Referenced by validate_keywords().

string VirusHealth::get_string_key_ ( const string  key  )  throw (ltl::IOException) [private]

Get a string header keyword.

Parameters:
key The keyword to read from the checked image.
Returns:
string The read and converted keyword
Exceptions:
util::IOException() Thrown if the keyword cannot be found

Referenced by read_image_(), read_overscan_(), validate_keywords(), validate_peaks(), and VirusHealth().

bool VirusHealth::get_bool_key_ ( const string  key  )  throw (ltl::IOException) [private]

Get a boolean header keyword.

Parameters:
key The keyword to read from the checked image.
Returns:
bool The read and converted keyword
Exceptions:
util::IOException() Thrown if the keyword cannot be found
void VirusHealth::set_keyword ( const string &  key,
bool  passed 
) [private]
void VirusHealth::add_error_ ( const string &  str  )  [inline, private]

Add an error message to the response string, prepending the current filename.

Parameters:
str The string to add.

References filename_, and response_.

Referenced by finish_check_().

void VirusHealth::log_test_ ( const string &  str  )  [inline, private]
void VirusHealth::log_warning_ ( const string &  str  )  [inline, private]

References filename_.

Referenced by validate_peaks().

void VirusHealth::finish_check_ ( const string &  hkey,
const string &  error,
const string &  warn = "" 
) [private]

Finish a check.

Parameters:
hkey The keyword to be set in the header
error The check error message. If it is "", the check is considered passed.
warn Optional warning generated by the test, placed into the key comment.

References add_error_(), fitsfile_, n_checks_, and n_passed_.

Referenced by validate_distortion(), validate_exptime(), validate_flatbias(), validate_keywords(), validate_min_flux(), validate_n_fibers(), validate_overscan(), validate_peaks(), validate_refbias(), validate_saturation(), validate_size(), validate_sky(), and validate_throughput().


Field Documentation

FitsIn VirusHealth::fitsfile_ [private]
string VirusHealth::filename_ [private]
unsigned int VirusHealth::recipe_ [private]

Referenced by validate_exptime(), and VirusHealth().

string VirusHealth::response_ [private]
int VirusHealth::n_checks_ [private]
int VirusHealth::n_passed_ [private]
bool VirusHealth::verbose_ [private]

Referenced by validate_peaks(), and VirusHealth().


Generated on 4 Nov 2015 for CURE by  doxygen 1.6.1