Skip to contents

In a cps_spct object with multiple columns of CPS data, each acquired using a different integration time, merge columns into a single column.

Usage

merge_cps(
  x,
  tolerance = 0.05,
  verbose = getOption("photobiology.verbose", default = FALSE)
)

Arguments

x

cps_spct object

tolerance

numeric Tolerance for mean deviation among cps columns as a fraction of one.

verbose

Logical indicating the level of warnings and messages wanted.

Value

a copy of x with values replaced as needed in all counts columns present.

Details

Pixels affected directly, or by neighbourhood, by clipping, should be set to NA in each variable of CPS values, before passing the spectrum as argument to parameter x of this function.

The merging of the CPS variables starts from the one corresponding to the longest integration time, expected to contain the largest number of NA values, by replacing NA values by cps values from the variable corresponding to the next shorter integration. The procedure is repeated until no NA remains or until no shorter integration time data are available. The process stops when all NAs have been replaced, and, even when available, CPS values for unnecesarilly short integration times discarded.

When measuring daylight different exposures for HDR are taken sequentially, and if light conditions change rapidly the cps values may be inconsistent. If the mean ratio of cps values is outside plus/minus the tolerance, instead of merging, the data for the longer of the two exposures is discarded instead of merged (or spliced) with the longer exposure, in which case a message is emitted. Ratio is computed after discarding low signal pixels as these readings are affected by noise, distorting the ratio when the light source-spectrum has only narrow peaks of emission.