# creating an equal energy spectrum of value 1
spd <- data.frame(wl = 380:780, values = 1)
#integrating over the full spectrum
spectral_integration(spd)
#integrating over wavelengths 400-500 nm
spectral_integration(spd, wavelength.range = c(400, 500))
#calculating the photopic illuminance of an equal energy spectrum with 1 W/(m^2*nm)
spectral_integration(spd, action.spectrum = "photopic", general.weight = "auto")
#calculating the melanopic EDI of an equal energy spectrum with 1 W/(m^2*nm)
spectral_integration(spd, action.spectrum = "melanopic", general.weight = "auto")
# Custom action spectrum
custom_act <- data.frame(wavelength = 400:700, weight = 0.5)
spectral_integration(spd, wavelength.range = c(400,700),
action.spectrum = custom_act, general.weight = 2)
#using a spectrum that is broader then the action spectrum will not change the
#output, as the action spectrum will use zeros beyond its range
Run the code above in your browser using DataLab