Select from a list of instrument descriptors which one to use based on date of measurement.

which_descriptor(
  date = lubridate::now(tzone = "UTC"),
  descriptors = ooacquire::MAYP11278_descriptors,
  verbose = getOption("photobiology.verbose", TRUE),
  strict.calib = getOption("photobiology.strict.calib", FALSE),
  entrance.optics = NULL,
  ...
)

Arguments

date

Any object that anytime::anydate() will decode as a date or convert to a date. Used to select a descriptor containing calibration data valid for a given day.

descriptors

A named list of descriptors of the characteristics of the spectrometer including calibration data.

verbose

Logical indicating the level of warnings wanted.

strict.calib

Logical indicating the level of validity checks.

entrance.optics

character The name or geometry of the diffuser or entrance optics to select. Only required when there are calibration with multiple entrance optics for the same spectrometer.

...

Currently ignored.

Details

Calibrations for instruments stored in a list and passed as argument to descriptors, also store the dates between which they are valid. This function walks the list searching for a calibration valid for date. If no valid calibration is found and strict.calib = FALSE, the calibration valid closest in time is returned with a warning while if no valid calibration is found and strict.calib = TRUE an error is triggered.

If a character string is passed as argument to date, it must be in a format suitable for anytime::anydate(). One needs to be careful with months and days of the month when supplying them as numbers, so using months names or their abbreviations can be safer.

Note

The default argument for verbose is for this function TRUE as conversion of other objects to a date may fail.