Skip to contents

Recompute spectral irradiance in source_spct objects stored in .rda files created with acq_irrad_interactive() from earlier versions of 'ooacquire' using the calibrations and methods in the current version of 'ooacquire'.

Usage

files_s_irrad_update(
  path = ".",
  pattern = "\\.spct\\.[Rr]da",
  recursive = TRUE,
  date.limit = NULL,
  spct.names = c(light = "light", filter = "filter", dark = "dark"),
  correction.method = NULL,
  hdr.tolerance = getOption("ooacquire.hdr.tolerance", default = 0.05),
  return.cps = NULL,
  trim.descriptor = TRUE,
  which = NULL,
  which.not = NULL,
  save.files = FALSE,
  verbose = getOption("photobiology.verbose", default = FALSE)
)

Arguments

path

character Vector of full path names; the default corresponds to the working directory. Tilde expansion (see path.expand()) is performed. See list.files() for details.

pattern

character An optional regular expression. Only file names which match the regular expression will be returned. See list.files() for details.

recursive

logical Should the listing recurse into directories?

date.limit

POSIXct Files with more recent creation dates are skipped assuming they have been created with 'ooacquire' (>= 0.2.5 2022-09-30).

spct.names

named list of character vectors, with one, two or three members, named "light", "dark" and "filter", used to map names in x to the measuring protocol; for time series, "light" is a vector of length > 1, while "dark" and "filter" have always length = 1 if present.

correction.method

A named list of constants and functions defining the method to be used for stray light and dark signal corrections.

hdr.tolerance

numeric Tolerance for mean deviation among cps columns as a fraction of one. Used in check of HDR consistency. A negative value disables merging using only the data for the shortest integration time.

return.cps

logical Useful when there is no need to apply a calibration, such as when computing new calibration multipliers.

trim.descriptor

logical Passed to s_irrad_update(). If TRUE the spectrometer calibration constants, pixel wavelengths, slit-function "tail-correction" function code and other calibration-related information is deleted.

which, which.not

character Names of attributes to copy or not to copy.

save.files

logical If FALSE skip saving of files. Useful to test what files would be modified.

verbose

logical Issue messages when unsupported objects or spectral objects already free of the problematic Java wrapper are encountered.

Value

A character vector with the paths to the updated files, returned silently. As a side effect files can be saved containing updated objects while keeping original files renamed as backups. By default no files are saved.

Details

Spectral data objects acquired directly from a connected spectrometer with 'ooacquire' contain embedded calibration data and correction algorithms that by default are used when spectral irradiance is computed. In addition, quality control of raw counts data has been enhanced. Function s_irrad_update() uses the current matching descriptor, quality control and conversion default settings.

This function, searches folders for files with names matching pattern, loads them one by one if modified before the date.limit, removes the Java wrapper if present and recomputes spectral irradiance with s_irrad_update() and saves the updated objects into a file with the original name after renaming the original file. If the "raw_mspct" object is not accompanied by a "source_spct" object with a matching name, the file is skipped.

The defaults match the defaults of s_irrad_corrected() and acq_irrad_interactive() in the current version of 'ooacquire'. Field w containing the jwrapper is deleted from all spectral objects, and for objects containing spectral data expressed in physical units, also fields related to instrument calibration are also deleted by default. If trim.descriptor = FALSE is passed in the call, deleting the w is the action applied to all objects.

The date-based file selection uses file modification time as Windows has an unusual logic for file creation time, resulting in creation times being later than modification time when a file is copied. When attached files are downloaded or when files are downloaded they may get the creation and modification times set to the time of downloading. This is only a speed up for avoiding loading of files. Files containing objects that do not need updating will not be modified even if they are loaded.

Warning!

It is strongly recommended that before committing changes a test is first done to check which files will be updated.

See also

ls(), list.files(), s_irrad_update() which are used to list objects and files, and to update spectral irradiance, respectively.

Use function s_irrad_update() for individual objects in the R workspace.

Other Functions and methods related to instrument descriptors.: files_rm_jwrapper(), instr_defaults(), rm_jwrapper(), update_bad_pixs()