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, ...)

# S3 method for default
clip_wl(x, range, ...)

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

# S3 method for generic_mspct
clip_wl(x, range = NULL, ...)

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

# S3 method for 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).

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 
#> Time unit 1s
#> 
#> # 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 
#> Time unit 1s
#> 
#> # 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 
#> Time unit 1s
#> 
#> # 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