Skip to contents

Clip head and tail of a spectrum based on wavelength limits, no interpolation used at range boundaries.

Usage

clip_wl(x, range, ...)

# Default S3 method
clip_wl(x, range, ...)

# S3 method for class 'generic_spct'
clip_wl(x, range = NULL, ...)

# S3 method for class 'generic_mspct'
clip_wl(x, range = NULL, expand = TRUE, ...)

# S3 method for class 'waveband'
clip_wl(x, range = NULL, ...)

# S3 method for class 'list'
clip_wl(x, range = NULL, ...)

Arguments

x

an R object.

range

a numeric vector of length two, or any other object for which function range() will return range of wavelengths expressed in nanometres.

...

ignored (possibly used by derived methods).

expand

logical Expand or not members containing spectra in long form.

Value

a spectrum object or a collection of spectral objects of the same class as x with wavelength heads and tails clipped.

Methods (by class)

  • clip_wl(default): Default for generic function

  • clip_wl(generic_spct): Clip an object of class "generic_spct" or derived.

  • clip_wl(generic_mspct): Clip an object of class "generic_mspct" or derived.

  • clip_wl(waveband): Clip an object of class "waveband".

  • clip_wl(list): Clip a list (of objects of class "waveband").

Note

The condition tested is wl >= range[1] & wl < (range[2] + 1e-13).

See also

Other trim functions: trim_spct(), trim_waveband(), trim_wl()

Examples

clip_wl(sun.spct, range = c(400, 500))
#> Object: source_spct [101 x 3]
#> Wavelength range 400-500 nm, step 1 nm 
#> Label: sunlight, simulated 
#> Measured on 2010-06-22 09:51:00 UTC 
#> Measured at 60.20911 N, 24.96474 E; Kumpula, Helsinki, FI 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#>  s.q.irrad: Spectral photon irradiance [mol s-1 m-2 nm-1] 
#> --
#> # A tibble: 101 × 3
#>    w.length s.e.irrad  s.q.irrad
#>       <dbl>     <dbl>      <dbl>
#>  1      400     0.608 0.00000203
#>  2      401     0.626 0.00000210
#>  3      402     0.650 0.00000218
#>  4      403     0.621 0.00000209
#>  5      404     0.637 0.00000215
#>  6      405     0.626 0.00000212
#>  7      406     0.600 0.00000204
#>  8      407     0.595 0.00000202
#>  9      408     0.626 0.00000213
#> 10      409     0.662 0.00000226
#> # ℹ 91 more rows
clip_wl(sun.spct, range = c(NA, 500))
#> Object: source_spct [222 x 3]
#> Wavelength range 280-500 nm, step 0.9230769-1 nm 
#> Label: sunlight, simulated 
#> Measured on 2010-06-22 09:51:00 UTC 
#> Measured at 60.20911 N, 24.96474 E; Kumpula, Helsinki, FI 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#>  s.q.irrad: Spectral photon irradiance [mol s-1 m-2 nm-1] 
#> --
#> # A tibble: 222 × 3
#>    w.length s.e.irrad s.q.irrad
#>       <dbl>     <dbl>     <dbl>
#>  1     280          0         0
#>  2     281.         0         0
#>  3     282.         0         0
#>  4     283.         0         0
#>  5     284.         0         0
#>  6     285.         0         0
#>  7     286.         0         0
#>  8     286.         0         0
#>  9     287.         0         0
#> 10     288.         0         0
#> # ℹ 212 more rows
clip_wl(sun.spct, range = c(400, NA))
#> Object: source_spct [401 x 3]
#> Wavelength range 400-800 nm, step 1 nm 
#> Label: sunlight, simulated 
#> Measured on 2010-06-22 09:51:00 UTC 
#> Measured at 60.20911 N, 24.96474 E; Kumpula, Helsinki, FI 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#>  s.q.irrad: Spectral photon irradiance [mol s-1 m-2 nm-1] 
#> --
#> # A tibble: 401 × 3
#>    w.length s.e.irrad  s.q.irrad
#>       <dbl>     <dbl>      <dbl>
#>  1      400     0.608 0.00000203
#>  2      401     0.626 0.00000210
#>  3      402     0.650 0.00000218
#>  4      403     0.621 0.00000209
#>  5      404     0.637 0.00000215
#>  6      405     0.626 0.00000212
#>  7      406     0.600 0.00000204
#>  8      407     0.595 0.00000202
#>  9      408     0.626 0.00000213
#> 10      409     0.662 0.00000226
#> # ℹ 391 more rows