drivers – Drivers utilities and implemations

Driver implementations

libvhc.drivers.DRIVER_FILE = 'v_driver.txt'

Name of the default driver file

libvhc.drivers.DRIVER_FILE_COUNTER = 'v_driver_{0}.txt'

Name of the driver file written when executing vhc

libvhc.drivers.get_drivers(path, recipe, conf, log, out_driver_file=None)[source]

Load the drivers and try to read the driver names, get the default ones for the recipe or use the list of drivers from the configuration file

Parameters:
path : string

path where to look for the driver file

recipe : string

name of the recipe in use

conf : instance of pyhetdex.tools.configuration.ConfigParser

configuration object

log : logging.Logger

logger to use

out_driver_file : string, optional

if given, the drivers are written to this file.

Returns:
drivers : list of strings

name of the drivers to execute

drivers_dict : dictionary

map between driver names and callable implementing them

libvhc.drivers.driver_file(path)[source]

Return the name of the driver file

Parameters:
path : string

path where the recipe file leaves

Returns:
string

name of the driver file

libvhc.drivers.default_drivers(path, recipe, log)[source]

Get the default drivers.

Parameters:
path : string

path provided to the vhc executable

recipe : string

recipe name

Returns:
drivers : list of string

default drivers for the given recipe

libvhc.drivers.driver_signature(vcheck, path, argv, *args, **kwargs)[source]

Prototype of a function implementing a VHC driver.

Parameters:
vcheck : instance of VCheck

store the recipe name and the check currently executing

path : string

path provided to the vhc executable.

argv : list of strings

remaining of the command line

args : list

positional arguments. Not used when calling from vhc

kwargs : dictionary

keyword arguments. Not used when calling from vhc

libvhc.drivers.find_peaks(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check that at least one fiber has the correct number of arc peaks and that they look like peaks. The files with the lines position and the maximum shift in peaks allowed come from the arcs reference file parser; the reference distortion file comes from distortion reference file parser; the maximum number of missing fibers comes from n_fibers reference file parser.

libvhc.drivers.compare(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the bias in the files. The expected value of the bias mean and variance, as well as their maximum allowed fractional shift come from bias reference file parser. If the fits files have the BIASTRGT header keyword, use its value instead of the bias mean from the reference file.

libvhc.drivers.flatbias(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the flatness of the bias in the files. The maximum fractional deviations from flatness comes from bias reference file parser.

libvhc.drivers.line_bias(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the bias for line structure in the files. Calculates the clipped mean of each line of the bias, and then the stddev of the resulting 1-D array. The maximum allowed value of the stddev comes from bias reference file parser.

libvhc.drivers.fft_bias(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the bias for wave structure in the files. Checks for a signal in the fast fourier transform. The maximum allowed signal comes from bias reference file parser.

libvhc.drivers.n_files(vcheck, path, argv)[source]

Check the number of exposures and, for each exposure, the number of files.

If argv is an empty list, the number of exposures is taken from the ‘n_exposures’ option of the given recipe and compared with the number of exposure directories found. Otherwise the existence of path + argv[0] is checked. The pattern for the exposure directory is taken from the exposure_dir option in the [common] section.

Afterwards, all the fits files are searched for and compared with the expected number: FILES_IFU * number of IFUS in the fplane file.

Parameters:
vcheck : instance of VCheck

store the recipe name and the check currently executing

path : string

path provided to the vhc executable.

argv : list of strings

remaining of the command line

libvhc.drivers.n_pixels(vcheck, path, argv) = <libvhc.factories.command_line_factory object>

Check the number of pixels in the files

libvhc.drivers.exptime(vcheck, path, argv) = <libvhc.factories.command_line_factory object>

Check the exposure time in the files

libvhc.drivers.check_overscan(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the overscan in the files. The expected value of the overscan mean and variance, as well as their maximum allowed fractional shift come from overscan reference file parser. If the combination of spectrograph ID, channel and amplifier is not found on the file falls back to the bias reference file parser. If the fits files have the BIASTRGT header keyword, use its value instead of the overscan mean from the reference file.

libvhc.drivers.check_line_overscan(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the overscan in the files. Calculates the clipped mean of each line of the overscan, and then the stddev of the resulting 1-D array. The maximum allowed value of the stddev comes from overscan reference file parser.

libvhc.drivers.check_dettemp(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the detector temperature in the files. The maximum allowed temperature and the difference between the set and the measured temperature come from dettemp reference file parser

libvhc.drivers.check_headerkeys(vcheck, path, argv) = <libvhc.factories.command_line_factory object>

Check the required header keywords in the files

libvhc.drivers.check_bitstat(vcheck, path, argv) = <libvhc.factories.command_line_factory object>

Check for stuck bits in the files

libvhc.drivers.check_nullpix(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the number of null in the files. The maximum allowed number of null pixels comes from nullpixel reference file parser

libvhc.drivers.check_repeat(vcheck, path, argv) = <libvhc.factories.command_line_factory object>

Check that the REPEAT header keyword, if found, is not true.

libvhc.drivers.saturation(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the saturation is below a given threshold. The saturation level and the maximum allowed number of pixels above this level come from saturation reference file parser

libvhc.drivers.n_fibers(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the number of fibers in the files. The expected number of fibers and the maximum allowed deviation come from n_fibers reference file parser

libvhc.drivers.min_flux(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the flux in the flat files is above a given threshold for all the fibers. The threshold value comes from min_flux reference file parser, while the expected number of fibers and the maximum allowed number of fibers below the threashold come from n_fibers reference file parser

libvhc.drivers.row_cte(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check the images for row shift problems. This is done by running yoda and checking the distribution of the position angles of the detected sources. This check only makes sense running on science frames, since it relies on cosmics in the images. It flags the images if the count of the 90 degree bins of the position angle histogram exceed n_hist times the mean of the remaining histogram. The n_hist value comes from n_hist reference file parser. If yoda is not found, the driver is marked as NOTRUN.

libvhc.drivers.col_cte(vcheck, path, argv) = <libvhc.factories.command_line_factory object>

Check for column shift cte issues in the files

libvhc.drivers.n_dithers(vcheck, path, argv)[source]

Check the number of dithers for a shot, with the following criteria:

  • there must be the correct number of exposure directories;
  • all the files in a directory must have the same value of the DITHER header keyword;
  • if dithering is performed using the dithering mechanism, in total there must be as many values of DITHER as there are dither, otherwise the values of DITHER must be the same across all the exposures; the dither_with_probe option of the [hetdex_dithers] configuration section instructs the driver whether the dithering is done offsetting the fiducial position in the drive probes (true) or using the dithering mechanism (false).

Each of the three steps is logged independently

If argv is an empty list, the number of exposures is taken from the ‘n_exposures’ option of the given recipe and compared with the number of exposure directories found. Otherwise the existence of path + argv[0] is checked. The pattern for the exposure directory is taken from the exposure_dir option in the [common] section.

Parameters:
vcheck : instance of VCheck

store the recipe name and the check currently executing

path : string

path provided to the vhc executable.

argv : list of strings

remaining of the command line

libvhc.drivers.sky_level(vcheck, path, argv) = <libvhc.factories.command_func_factory object>

Check that some sky is found in the fibers. This is achieved by comparing the average value of a central region of the chip against the overscan. The minimum expected skylevel above overscan is read from sky_level reference file parser