photobiology v0.9.30


Monthly downloads



Photobiological Calculations

Definitions of classes, methods, operators and functions for use in photobiology and radiation meteorology and climatology. Calculation of effective (weighted) and not-weighted irradiances/doses, fluence rates, transmittance, reflectance, absorptance, absorbance and diverse ratios and other derived quantities from spectral data. Local maxima and minima. Conversion between energy- and photon-based units. Wavelength interpolation. Astronomical calculations related solar angles and day length. Colours and vision. This package is part of the 'r4photobiology' suite, Aphalo P. J. (2015) <doi:10.19232/uv4pb.2015.1.14>.



version cran

Package ‘photobiology’ defines a system of classes for storing spectral data and accompanying metadata. For each of these classes specialised summary methods, maths operators and functions are provided. In addition, classes for storing collections of objects of the classes for individual spectra are defined as well as ‘apply’ functions. Extraction and replacement operators are also implemented. Functions for calculation of the position of the sun, times of sunrise and sunset, day length and night length are also provided.

The package supports storage and manipulation of data for radiation quantities and for optical properties of objects.

This package is the core of a suite of R packages for photobiological calculations described at the r4photobiology web site.


The first example shows you how to estimate solar irradiance in W/m2 under a filter. We use a measured solar spectrum and a measured filter transmission spectrum.

e_irrad(sun.spct * yellow_gel.spct)
#>    Total 
#> 146.5044 
#> attr(,"time.unit")
#> [1] "second"
#> attr(,"radiation.unit")
#> [1] "energy irradiance total"

The second example shows some simple astronomical calculations for the sun.

geocode <- data.frame(lon = 0, lat = 55)
date <- lubridate::today(tzone = "UTC")
sunrise_time(date, tz = "UTC", geocode = geocode)
#> [1] "2020-01-06 08:23:09 UTC"
day_length(date, tz = "UTC", geocode = geocode)
#> [1] 7.415046


Installation of the most recent stable version from CRAN:


Installation of the current unstable version from Bitbucket:

# install.packages("devtools")


HTML documentation is available at (, including a User Guide.

News on updates to the different packages of the ‘r4photobiology’ suite are regularly posted at (

Two articles introduce the basic ideas behind the design of the suite and describe its use: Aphalo P. J. (2015) ( and Aphalo P. J. (2016) (

A book is under preparation, and the draft is currently available at (

A handbook written before the suite was developed contains useful information on the quantification and manipulation of ultraviolet and visible radiation: Aphalo, P. J., Albert, A., Björn, L. O., McLeod, A. R., Robson, T. M., & Rosenqvist, E. (Eds.) (2012) Beyond the Visible: A handbook of best practice in plant UV photobiology (1st ed., p. xxx + 174). Helsinki: University of Helsinki, Department of Biosciences, Division of Plant Biology. ISBN 978-952-10-8363-1 (PDF), 978-952-10-8362-4 (paperback). PDF file available from (


Pull requests, bug reports, and feature requests are welcome at (


If you use this package to produce scientific or commercial publications, please cite according to:

#> To cite package 'photobiology' in publications, please use:
#>   Aphalo, Pedro J. (2015) The r4photobiology suite. UV4Plants Bulletin,
#>   2015:1, 21-29. DOI:10.19232/uv4pb.2015.1.14
#> A BibTeX entry for LaTeX users is
#>   @Article{,
#>     author = {Pedro J. Aphalo},
#>     title = {The r4photobiology suite},
#>     journal = {UV4Plants Bulletin},
#>     volume = {2015},
#>     number = {1},
#>     pages = {21-29},
#>     year = {2015},
#>     doi = {10.19232/uv4pb.2015.1.14},
#>   }


© 2012-2019 Pedro J. Aphalo ( Released under the GPL, version 2 or greater. This software carries no warranty of any kind.

Functions in photobiology

Name Description
A2T Convert absorbance into transmittance
D2.UV586 Data for typical calibration lamps
D2.UV653 Data for typical calibration lamps
D2.UV654 Data for typical calibration lamps
A.illuminant.spct CIE A illuminant data
Ler_leaf.spct Green Arabidopsis leaf reflectance and transmittance.
D2_spectrum Calculate deuterium lamp output spectrum from fitted constants
FEL.BN.9101.165 Data for typical calibration lamps
D65.illuminant.spct CIE D65 illuminant data
FEL_spectrum Incandescent "FEL" lamp emission spectrum
Ler_leaf_trns_i.spct Green Arabidopsis leaf spectral transmittance.
MathFun Miscellaneous Mathematical Functions
absorbance_spct Calculate absorbance from spectral absorbance.
absorbance Absorbance
T2A Convert transmittance into absorbance.
T2Afr Convert transmittance into absorptance.
as.cps_mspct Coerce to a collection-of-spectra
as.chroma_spct Coerce to a spectrum
as.calibration_spct Coerce to a spectrum
Ler_leaf_rflt.spct Green Arabidopsis leaf spectral reflectance.
as.chroma_mspct Coerce to a collection-of-spectra
Ler_leaf_trns.spct Green Arabidopsis leaf spectral transmittance.
add_attr2tb Copy attributes from members of a generic_mspct
as.calibration_mspct Coerce to a collection-of-spectra
T2T Convert transmittance type.
auto_hinges Guess whether insertion of hinges is needed or not
as.reflector_spct Coerce to a spectrum
as.reflector_mspct Coerce to a collection-of-spectra
as_tod Convert date to time-of-day in hours, minutes or seconds
as.source_spct Coerce to a spectrum
as_energy Convert spectral photon irradiance into spectral energy irradiance
as.filter_spct Coerce to a spectrum
as.matrix-mspct Coerce a collection of spectra into a matrix
as.generic_spct Coerce to a spectrum
Trig Trigonometric Functions
as.filter_mspct Coerce to a collection-of-spectra
black_body.spct Theoretical black body
checkSpctVersion Check that the "spct.version" attribute is set
checkTimeUnit Check the "time.unit" attribute of an existing source_spct object
as.cps_spct Coerce to a spectrum
c Combine collections of spectra
as.response_mspct Coerce to a collection-of-spectra
as.generic_mspct Coerce to a collection-of-spectra
as.response_spct Coerce to a spectrum
absorptance Absorptance
check_w.length Sanity check of wavelengths (internal function).
as.raw_spct Coerce to a spectrum
absorptance_spct Calculate absorptance from spectral absorptance.
as_quantum Convert spectral energy irradiance into spectral photon irradiance
as.raw_mspct Coerce to a collection-of-spectra
checkMspctVersion Check that the "mspct.version" attribute is set
ccd.spct Spectral response of a back-thinned CCD image sensor.
class_spct Query which is the class of an spectrum
ciexyzCMF2.spct Linear energy CIE xyz colour matching function (CMF) 2 deg data
as.object_mspct Coerce to a collection-of-spectra
check_spct Check validity of spectral objects
as_quantum_mol Convert spectral energy irradiance into spectral photon irradiance
as.object_spct Coerce to a spectrum
check_spectrum Sanity check a spectrum
eq_ratio Energy:photon ratio
cps2irrad Conversion from counts per second to physical quantities
clear_body.spct Theoretical clear body
convertTimeUnit Convert the "time.unit" attribute of an existing source_spct object
energy_ratio Energy:energy ratio
copy_attributes Copy attributes
clear.spct Theoretical spectrum of a clear material
convolve_each Convolve function for collections of spectra
as.solar_date Convert a solar_time object into solar_date object
day_night Times for sun positions
defunct Defunct functions and methods
average_spct Average spectral data.
as.source_mspct Coerce to a collection-of-spectra
beesxyzCMF.spct Honeybee xyz chromaticity colour matching function data
compare_spct Coarse-grained comparison of two spectra
ciexyzCC10.spct CIE xyz chromaticity coordinates (CC) 10 deg data
ciev2.spct Linear energy CIE 2008 luminous efficiency function 2 deg data
color_of Color of an object
spread Expanse
getNormalized Get the "normalized" attribute
getWhereMeasured Get the "where.measured" attribute
fshift_spct fshift a spectrum
findMultipleWl Find repeated w.length values
getRfrType Get the "Rfr.type" attribute
filter_cps.mspct Counts per second from a measurement of a plastic film
Extract Extract or replace parts of a spectrum
generic_mspct Collection-of-spectra constructor
calc_multipliers Spectral weights
Extract_mspct Extract or replace members of a collection of spectra
calc_source_output Scaled and/or interpolated light-source spectral output
get_attributes Get the metadata attributes
is.summary_generic_spct Query class of spectrum summary objects
merge2object_spct Merge into object_spct
is_photon_based Query if a spectrum contains photon- or energy-based data.
is_normalized Query whether a generic spectrum has been normalized.
merge_attributes Merge and copy attributes
is.waveband Query if it is a waveband
ciev10.spct Linear energy CIE 2008 luminous efficiency function 10 deg data
clean Clean (=replace) off-range values in a spectrum
clean_spct Clean a spectrum
div-.generic_spct Arithmetic Operators
dim.generic_mspct Dimensions of an Object
f_dispatcher_spct Math function dispatcher for spectra
clip_wl Clip head and/or tail of a spectrum
ciexyzCMF10.spct Linear energy CIE xyz colour matching function (CMF) 10 deg data
ciexyzCC2.spct CIE xyz chromaticity coordinates 2 deg data
clear_photobio.cache Clear the spectral weights cache
div_spectra Divide two spectra, even if the wavelengths values differ
e2q Convert energy-based quantities into photon-based quantities.
e_ratio Energy:energy ratio
e2qmol_multipliers Calculate energy to quantum (mol) multipliers
fshift Shift the scale of a spectrum using a summary function
energy_as_default Set spectral-data options
fscale_spct fscale a spectrum
find_peaks Find peaks in a spectrum
getScaled Get the "scaled" attribute
e2quantum_multipliers Calculate energy to quantum multipliers
find_wls Find wavelength values in a spectrum
energy_irradiance Calculate (energy) irradiance from spectral irradiance
e_fluence Energy fluence
getSpctVersion Get the "spct.version" attribute
normalize Normalize spectral data
e_response Energy-based photo-response
green_leaf.spct Green birch leaf reflectance.
is_effective Is an R object "effective"
irradiance Photon or energy irradiance from spectral energy or photon irradiance.
get_peaks Get peaks and valleys in a spectrum
is_absorbance_based Query if a spectrum contains absorbance or transmittance data
irrad Irradiance
fluence Fluence
format.solar_time Encode in a Common Format
e_irrad Energy irradiance
formatted_range Compute range and format it
getHowMeasured Get the "how.measured" attribute
getAfrType Get the "Afr.type" attribute
getTfrType Get the "Tfr.type" attribute
fscale Rescale a spectrum using a summary function
insert_spct_hinges Insert new wavelength values into a spectrum
getTimeUnit Get the "time.unit" attribute of an existing source_spct object
getBSWFUsed Get the "bswf.used" attribute
getIdFactor Get the "idfactor" attribute
getWhatMeasured Get the "what.measured" attribute
minus-.generic_spct Arithmetic Operators
normalize_range_arg Normalize a range argument into a true numeric range
integrate_spct Integrate spectral data.
photons_energy_ratio Photon:energy ratio
na.omit Handle Missing Values in Objects
plus-.generic_spct Arithmetic Operators
mod-.generic_spct Arithmetic Operators
is.generic_mspct Query class of spectrum objects
normalization Normalization of an R object
is.generic_spct Query class of spectrum objects
getWhenMeasured Get the "when.measured" attribute
getInstrDesc Get the "instr.desc" attribute
getInstrSettings Get the "instr.settings" attribute
getMultipleWl Get the "multiple.wl" attribute
getMspctVersion Get the "mspct.version" attribute
polyester.spct Transmittance spectrum of clear polyester film
interpolate_spct Map a spectrum to new wavelength values.
head_tail Return the First and Last Part of an Object
integrate_xy Gives irradiance from spectral irradiance.
is.old_spct Query if an object has old class names
is.solar_time Query class
prod_spectra Multiply two spectra, even if the wavelengths values differ
^.generic_spct Arithmetic Operators
join_mspct Join all spectra in a collection
rmDerivedSpct Remove "generic_spct" and derived class attributes.
q2e Convert photon-based quantities into energy-based quantities
round Rounding of Numbers
setWhenMeasured Set the "when.measured" attribute
setAfrType Set the "Afr.type" attribute
s_mean_se Mean and standard error from collection of spectra
s_mean Mean from collection of spectra
source_spct Spectral-object constructor
setWhatMeasured Set the "what.measured" attribute
select_spct_attributes Merge user supplied attribute names with default ones
spct_attr2tb Copy attributes into a tibble
summary_spct_classes Function that returns a vector containing the names of spectral summary classes. Daily solar spectral irradiance (simulated)
insert_hinges Insert wavelength values into spectral data.
log Logarithms and Exponentials
calendar_change Solar astronomy using Meeus' algorithm
wl_max Wavelength maximum
isValidInstrSettings Check the "instr.settings" attribute
labels Find labels from "waveband" object
interpolate_wl Map spectra to new wavelength values.
interpolate_spectrum Calculate spectral values at a different set of wavelengths
isValidInstrDesc Check the "instr.desc" attribute
oper_spectra Binary operation on two spectra, even if the wavelengths values differ
l_insert_hinges Insert wavelength values into spectral data.
msmsply Multi-spct transform methods
mspct_classes Names of multi-spectra classes
peaks Peaks or local maxima
q_irrad Photon irradiance
relative_AM Relative Air Mass (AM)
q_fluence Photon fluence
reflectance_spct Calculate reflectance from spectral reflectance
rowwise rowwise functions for collections of spectra
setInstrDesc Set the "instr.desc" attribute
setRfrType Set the "Rfr.type" attribute
s_e_irrad2rgb Spectral irradiance to rgb color conversion
setInstrSettings Set the "instr.settings" attribute
is_scaled Query whether a generic spectrum has been scaled
photobiology-package photobiology: Photobiological Calculations
tag Tag a spectrum
trim_tails Trim (or expand) head and/or tail
trim_waveband Trim (or expand) head and/or tail
thin_wl Thin the density of wavelength values
photon_irradiance Photon irradiance
photodiode.spct Spectral response of a GaAsP photodiode
rgb_spct RGB color values
photon_ratio Photo:photon ratio
q_ratio Photon:photon ratio
q_response Photon-based photo-response
qe_ratio Photon:energy ratio
rbindspct Row-bind spectra
rmDerivedMspct Remove "generic_mspct" and derived class attributes.
wl_range Wavelength range
setScaled Set the "scaled" attribute
is_tagged Query if it is an spectrum is tagged
reflectance Reflectance
wl_midpoint Midpoint
wl_min Wavelength minimum
s_median Median of a collection of spectra
s_prod Product from collection of spectra
s_range Range of a collection of spectra
setGenericSpct Convert an R object into a spectrum object.
setNormalized Set the "normalized" attribute
setBSWFUsed Set the "bswf.used" attribute
setMultipleWl Set the "multiple.wl" attribute
normalized_diff_ind Calculate a normalized index.
water_vp_sat Water vapour pressure
wb_trim_as_default Set computation options
w_length_range2rgb Wavelength range to rgb color conversion
sign Sign
wb2tagged_spct Create tagged spectrum from wavebands
s_sd Standard Deviation of a collection of spectra
summary Summary of a spectral object
split_energy_irradiance Energy irradiance for split spectrum regions
split_bands List-of-wavebands constructor
sum_spectra Add two spectra
opaque.spct Theoretical spectrum of an opaque material
print.solar_time Print solar time and solar date objects
print.waveband Print a "waveband" object
print Print a spectral object
print.summary_generic_spct Print spectral summary
sun.spct Solar spectral irradiance (simulated)
slash-.generic_spct Arithmetic Operators
s_var Variance of a collection of spectra
resp_spct Calculate response from spectral response
sun_angles Solar angles
uncollect Extract all members from a collection
valleys Valleys or local minima
validate_geocode Validate a geocode
tz_time_diff Time difference between two time zones
response Integrated response
waveband Waveband constructor method
s_se Standard Error of a collection of spectra
subset2mspct Convert 'long' or tidy spectral data into a collection of spectra
transmittance_spct Calculate transmittance from spectral transmittance.
subt_spectra Subtract two spectra
s_sum Sum from collection of spectra
setTfrType Set the "Tfr.type" attribute
split_irradiance Energy or photon irradiance for split spectrum regions
spct_classes Function that returns a vector containing the names of spectra classes.
sun.daily.spct Daily solar spectral irradiance (simulated)
split2mspct Convert a 'wide' or untidy data frame into a collection of spectra
setTimeUnit Set the "time.unit" attribute of an existing source_spct object Solar spectral irradiance (simulated)
split_photon_irradiance Photon irradiance for split spectrum regions
se Standard error of the mean
setHowMeasured Set the "how.measured" attribute
waveband_ratio Photon or energy ratio
trimInstrSettings Trim the "instr.settings" attribute
trim_spct Trim (or expand) head and/or tail of a spectrum
trimInstrDesc Trim the "instr.desc" attribute
v_replace_hinges Overwrite spectral data values at existing wavelength values.
white_led.cps_spct White led bulb spectrum
white_body.spct Theoretical white body
v_insert_hinges Insert spectral data values at new wavelength values.
untag Remove tags
setWhereMeasured Set the "where.measured" attribute
setIdFactor Set the "idfactor" attribute
upgrade_spct Upgrade one spectral object
using_Tfr Use photobiology options
white_led.source_spct White led bulb spectrum
upgrade_spectra Upgrade one or more spectral objects
white_led.raw_spct White led bulb spectrum
shared_member_class Classes common to all collection members.
smooth_spct Smooth a spectrum
solar_time Local solar time
wl_stepsize Stepsize
Subset Subsetting spectra
twilight2angle twilight argument check and conversion
transmittance Transmittance
times-.generic_spct Arithmetic Operators
trim_wl Trim head and/or tail of a spectrum
verbose_as_default Set error reporting options
wb2rect_spct Create tagged spectrum from wavebands
w_length2rgb Wavelength to rgb color conversion
wb2spct Create spectrum from wavebands
wls_at_target Find wavelengths values corresponding to a target spectral value
yellow_gel.spct Transmittance spectrum of yellow theatrical gel.
No Results!

Vignettes of photobiology

No Results!

Last month downloads


Type Package
Date 2020-01-06
License GPL (>= 2)
LazyLoad yes
LazyData yes
ByteCompile true
Encoding UTF-8
RoxygenNote 7.0.2
VignetteBuilder knitr
NeedsCompilation no
Packaged 2020-01-07 00:46:26 UTC; aphalo
Repository CRAN
Date/Publication 2020-01-09 14:20:02 UTC

Include our badge in your README