fshift: Shift the scale of a spectrum using a summary function

View source: R/spct.fshift.r

fshiftR Documentation

Shift the scale of a spectrum using a summary function

Description

The fshift() methods return a spectral object of the same class as the one supplied as argument but with the spectral data on a zero-shifted scale. A range of wavelengths is taken as a zero reference and the summary calculated with f for this waveband is substracted. This results in a zero shift (= additive correction) to the values in the returned object. Metadata attributes are retained unchanged.

Usage

fshift(x, ...)

## Default S3 method:
fshift(x, ...)

## S3 method for class 'source_spct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "mean",
  unit.out = getOption("photobiology.radiation.unit", default = "energy"),
  ...
)

## S3 method for class 'response_spct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "mean",
  unit.out = getOption("photobiology.radiation.unit", default = "energy"),
  ...
)

## S3 method for class 'filter_spct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "min",
  qty.out = getOption("photobiology.filter.qty", default = "transmittance"),
  ...
)

## S3 method for class 'reflector_spct'
fshift(x, range = c(wl_min(x), wl_min(x) + 10), f = "min", qty.out = NULL, ...)

## S3 method for class 'source_mspct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "mean",
  unit.out = getOption("photobiology.radiation.unit", default = "energy"),
  ...
)

## S3 method for class 'raw_spct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "mean",
  qty.out = NULL,
  ...
)

## S3 method for class 'cps_spct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "mean",
  qty.out = NULL,
  ...
)

## S3 method for class 'generic_spct'
fshift(x, range = c(wl_min(x), wl_min(x) + 10), f = "mean", col.names, ...)

## S3 method for class 'response_mspct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "mean",
  unit.out = getOption("photobiology.radiation.unit", default = "energy"),
  ...,
  .parallel = FALSE,
  .paropts = NULL
)

## S3 method for class 'filter_mspct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "min",
  qty.out = getOption("photobiology.filter.qty", default = "transmittance"),
  ...,
  .parallel = FALSE,
  .paropts = NULL
)

## S3 method for class 'reflector_mspct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "min",
  qty.out = NULL,
  ...,
  .parallel = FALSE,
  .paropts = NULL
)

## S3 method for class 'raw_mspct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "min",
  ...,
  .parallel = FALSE,
  .paropts = NULL
)

## S3 method for class 'cps_mspct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "min",
  ...,
  .parallel = FALSE,
  .paropts = NULL
)

## S3 method for class 'generic_mspct'
fshift(
  x,
  range = c(wl_min(x), wl_min(x) + 10),
  f = "min",
  col.names,
  ...,
  .parallel = FALSE,
  .paropts = NULL
)

Arguments

x

An R object

...

additional named arguments passed down to f.

range

An R object on which range() returns a numeric vector of length 2 with the limits of a range of wavelengths in nm, with min and max wavelengths (nm)

f

character string "mean", "min" or "max" for scaling so that this summary value becomes the origin of the spectral data scale in the returned object, or the name of a function taking x as first argument and returning a numeric value.

unit.out

character Allowed values "energy", and "photon", or its alias "quantum"

qty.out

character Allowed values "transmittance", and "absorbance"

col.names

character vector containing the names of columns or variables to which to apply the scale shift.

.parallel

if TRUE, apply function in parallel, using parallel backend provided by foreach

.paropts

a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing.

Value

A copy of x with the spectral data values replaced with values zero-shifted.

a new object of the same class as x.

Methods (by class)

  • fshift(default): Default for generic function

  • fshift(source_spct):

  • fshift(response_spct):

  • fshift(filter_spct):

  • fshift(reflector_spct):

  • fshift(source_mspct):

  • fshift(raw_spct):

  • fshift(cps_spct):

  • fshift(generic_spct):

  • fshift(response_mspct):

  • fshift(filter_mspct):

  • fshift(reflector_mspct):

  • fshift(raw_mspct):

  • fshift(cps_mspct):

  • fshift(generic_mspct):

Note

Method fshift is not implemented for solute_spct objects as the spectral data stored in them are a description of an intensive property of a substance. To represent solutions of specific concentrations of solutes, filter_spct objects can be used.

See Also

Other rescaling functions: fscale(), getNormalized(), getScaled(), is_normalized(), is_scaled(), normalize(), setNormalized(), setScaled()


photobiology documentation built on Oct. 21, 2023, 1:06 a.m.