Skip to contents

Package overview

photobiology photobiology-package
photobiology: Photobiological Calculations

Radiation

Classes, methods and objects for storing, manipulating and describing spectral data.

Waveband and spectral weighting functions

Constructors and other methods for waveband objects used to store descriptions of wavelength ranges and spectral weighting functions.

waveband() new_waveband()
Waveband constructor method
is.waveband()
Query if it is a waveband
split_bands()
List-of-wavebands constructor
wb2spct()
Create spectrum from wavebands
wb2rect_spct() fast_wb2rect_spct()
Create tagged spectrum from wavebands
wb2tagged_spct()
Create tagged spectrum from wavebands
print(<waveband>)
Print a "waveband" object

Individual spectra

Constructors and query methods for objects used to store spectral data.

source_spct() calibration_spct() raw_spct() cps_spct() generic_spct() response_spct() filter_spct() reflector_spct() solute_spct() object_spct() chroma_spct()
Spectral-object constructors
is.generic_spct() is.raw_spct() is.calibration_spct() is.cps_spct() is.source_spct() is.response_spct() is.filter_spct() is.reflector_spct() is.object_spct() is.solute_spct() is.chroma_spct() is.any_spct()
Query class of spectrum objects
as.generic_spct()
Coerce to a spectrum
as.calibration_spct()
Coerce to a spectrum
as.raw_spct()
Coerce to a spectrum
as.cps_spct()
Coerce to a spectrum
as.source_spct()
Coerce to a spectrum
as.response_spct()
Coerce to a spectrum
as.filter_spct()
Coerce or convert into a filter spectrum
as.reflector_spct()
Coerce to a spectrum
as.solute_spct()
Coerce to a solute spectrum
as.object_spct()
Coerce to a spectrum
as.chroma_spct()
Coerce to a spectrum
setGenericSpct() setCalibrationSpct() setRawSpct() setCpsSpct() setFilterSpct() setSoluteSpct() setReflectorSpct() setObjectSpct() setResponseSpct() setSourceSpct() setChromaSpct()
Convert an R object into a spectrum object.
generic_mspct() calibration_mspct() raw_mspct() cps_mspct() source_mspct() filter_mspct() reflector_mspct() object_mspct() solute_mspct() response_mspct() chroma_mspct()
Collection-of-spectra constructor
class_spct()
Query which is the class of a spectrum
spct_classes()
Function returning a vector containing the names of spectra classes.
rmDerivedSpct()
Remove "generic_spct" and derived class attributes.
make_var_labels()
Column or variable labels

Collections of spectra

Constructor and query methods for objects used to store multiple spectra.

generic_mspct() calibration_mspct() raw_mspct() cps_mspct() source_mspct() filter_mspct() reflector_mspct() object_mspct() solute_mspct() response_mspct() chroma_mspct()
Collection-of-spectra constructor
is.generic_mspct() is.calibration_mspct() is.raw_mspct() is.cps_mspct() is.source_mspct() is.response_mspct() is.filter_mspct() is.reflector_mspct() is.object_mspct() is.solute_mspct() is.chroma_mspct() is.any_mspct()
Query class of spectrum objects
as.generic_mspct() mat2mspct()
Coerce to a collection-of-spectra
as.calibration_mspct()
Coerce to a collection-of-spectra
as.raw_mspct()
Coerce to a collection-of-spectra
as.cps_mspct()
Coerce to a collection-of-spectra
as.source_mspct()
Coerce to a collection-of-spectra
as.response_mspct()
Coerce to a collection-of-spectra
as.filter_mspct()
Coerce to a collection-of-spectra
as.reflector_mspct()
Coerce to a collection-of-spectra
as.solute_mspct()
Coerce to a collection-of-spectra
as.object_mspct()
Coerce to a collection-of-spectra
as.chroma_mspct()
Coerce to a collection-of-spectra
as.matrix(<generic_mspct>) mspct2mat()
Coerce a collection of spectra into a matrix
setGenericSpct() setCalibrationSpct() setRawSpct() setCpsSpct() setFilterSpct() setSoluteSpct() setReflectorSpct() setObjectSpct() setResponseSpct() setSourceSpct() setChromaSpct()
Convert an R object into a spectrum object.
mspct_classes()
Names of multi-spectra classes
rmDerivedMspct()
Remove "generic_mspct" and derived class attributes.
shared_member_class()
Classes common to all collection members.

summary() and print() methods for spectra

Specializations and variants of R’s generic methods for spectral data and accompanying metadata records.

Methods for the computation of non-spectral derived quantities from spectra. Each spectrum is described by one or up to a few scalar values resulting from integration or averaging of spectral values over wavelengths, or other properties.

irrad()
Irradiance
e_irrad()
Energy irradiance
q_irrad()
Photon irradiance
fluence()
Fluence
e_fluence()
Energy fluence
q_fluence()
Photon fluence
illuminance()
Irradiance
response()
Integrated response
e_response()
Energy-based photo-response
q_response()
Photon-based photo-response
absorbance()
Absorbance
absorptance()
Absorptance
transmittance()
Transmittance
reflectance()
Reflectance
average_spct()
Average spectral data.
integrate_spct()
Integrate spectral data.
color_of() colour_of() color() fast_color_of_wl() fast_color_of_wb()
Color of an object
rgb_spct()
RGB color values
e_ratio()
Energy:energy ratio
q_ratio()
Photon:photon ratio
eq_ratio()
Energy:photon ratio
qe_ratio()
Photon:energy ratio
e_fraction()
Energy:energy fraction
q_fraction()
Photon:photon fraction
Tfr_ratio()
transmittance:transmittance ratio
Tfr_fraction()
transmittance:transmittance fraction
Tfr_normdiff()
transmittance:transmittance normalised difference
Rfr_ratio()
reflectance:reflectance ratio
Rfr_fraction()
reflectance:reflectance fraction
Rfr_normdiff()
reflectance:reflectance normalised difference

Methods for querying about the wavelength values of spectra and wavebands. Each spectrum or wavebdand is described by one or two scalar values.

Statistical summaries from groups of spectra

Methods that compute statistical summaries of spectral data, treating individual spectra as replicates or sampled members from a population of spectra. A summary spectrum or fewer spectra than input are returned.

compare_spct()
Coarse-grained comparison of two spectra
s_sum()
Sum from collection of spectra
s_prod()
Product from collection of spectra
s_mean()
Mean from collection of spectra
s_median()
Median of a collection of spectra
s_range()
Range of a collection of spectra
s_var()
Variance of a collection of spectra
s_sd()
Standard Deviation of a collection of spectra
s_se()
Standard Error of a collection of spectra
s_mean_se()
Mean and standard error from collection of spectra
s_mean_se_band()
Mean plus and minus standard error from collection of spectra
pull_sample()
Random sample of spectra

Metadata attributes

Methods for setting and querying metadata from spectral objects.

is_photon_based() is_energy_based()
Query if a spectrum contains photon- or energy-based data.
setBSWFUsed() getBSWFUsed()
The "bswf.used" attribute
is_effective()
Is an R object "effective"
getInstrDesc() instr_descriptor()
Get the "instr.desc" attribute
setInstrDesc() `instr_descriptor<-`()
Set the "instr.desc" attribute
trimInstrDesc()
Trim the "instr.desc" attribute
isValidInstrDesc()
Check the "instr.desc" attribute
getInstrSettings() instr_settings()
Get the "instr.settings" attribute
setInstrSettings() `instr_settings<-`()
Set the "instr.settings" attribute
trimInstrSettings()
Trim the "instr.settings" attribute
isValidInstrSettings()
Check the "instr.settings" attribute
getMultipleWl() multiple_wl()
Get the "multiple.wl" attribute
setMultipleWl() `multiple_wl<-`()
Set the "multiple.wl" attribute
getNormalized() getNormalised() getNormalization() getNormalisation()
Query the "normalized" and "normalization" attributes
setNormalized() setNormalised()
Set the "normalized" and "normalization" attributes
is_normalized() is_normalised()
Query whether a generic spectrum has been normalized.
getScaled() getScaling()
Get the "scaled" attribute
setScaled()
Set the "scaled" attribute
is_scaled()
Query whether a generic spectrum has been scaled
setRfrType() getRfrType()
The "Rfr.type" attribute
getFilterProperties() filter_properties()
Get the "filter.properties" attribute
setFilterProperties() `filter_properties<-`()
Set the "filter.properties" attribute
getSoluteProperties() solute_properties()
Get the "solute.properties" attribute
setSoluteProperties() `solute_properties<-`()
Set the "solute.properties" attribute
setTfrType() getTfrType()
The "Tfr.type" attribute
f_mspct() mutate_mspct() calc_filter_multipliers() T2T() getAfrType() setAfrType() sample_spct() sample_mspct()
Defunct functions and methods
is_absorbance_based() is_absorptance_based() is_transmittance_based()
Query if a spectrum contains absorbance or transmittance data
getKType()
Get the "K.type" attribute
setKType()
Set the "K.type" attribute
is_mole_based() is_mass_based()
Query if a spectrum contains mole or mass based data
getTimeUnit()
Get the "time.unit" attribute of an existing source_spct object
setTimeUnit()
Set the "time.unit" attribute of an existing source_spct object
setResponseType() getResponseType()
Set the "response.type" attribute
getWhatMeasured() what_measured()
Get the "what.measured" attribute
setWhatMeasured() `what_measured<-`()
Set the "what.measured" attribute
getWhenMeasured() when_measured()
Get the "when.measured" attribute
setWhenMeasured() `when_measured<-`()
Set the "when.measured" attribute
getWhereMeasured() where_measured()
Get the "where.measured" attribute
setWhereMeasured() `where_measured<-`()
Set the "where.measured" attribute
getHowMeasured() how_measured()
Get the "how.measured" attribute
setHowMeasured() `how_measured<-`()
Set the "how.measured" attribute
getIdFactor() id_factor()
Get the "idfactor" attribute
setIdFactor() `id_factor<-`()
Set the "idfactor" attribute
is_tagged()
Query if a spectrum is tagged
dim(<generic_mspct>) `dim<-`(<generic_mspct>)
Dimensions of an Object
labels(<waveband>) labels(<generic_spct>)
Find labels from "waveband" object
add_attr2tb() when_measured2tb() geocode2tb() lonlat2tb() lon2tb() lat2tb() address2tb() what_measured2tb() how_measured2tb() normalized2tb() scaled2tb() instr_desc2tb() instr_settings2tb() BSWF_used2tb() filter_properties2tb() solute_properties2tb() Tfr_type2tb() Rfr_type2tb() time_unit2tb() comment2tb()
Copy attributes from members of a generic_mspct
spct_attr2tb()
Copy attributes into a tibble
spct_metadata()
Access metadata

Spectral features

Methods for detection of specific features in spectra.

peaks()
Peaks or local maxima
valleys()
Valleys or local minima
wls_at_target()
Find wavelengths values corresponding to a target spectral value
spikes()
Spikes

Non-summary methods for transforming or modifying the radiation-related quantity of spectral data objects.

clean()
Clean (=replace) off-range values in a spectrum
despike()
Remove spikes from spectrum
normalize() normalise()
Normalize spectral data
normalization()
Normalization of an R object
fscale()
Rescale a spectrum using a summary function
fshift()
Shift the scale of a spectrum using a summary function
convertTimeUnit()
Convert the "time.unit" attribute of an existing source_spct object
e2q()
Convert energy-based quantities into photon-based quantities.
q2e()
Convert photon-based quantities into energy-based quantities
T2A()
Convert transmittance into absorbance.
A2T()
Convert absorbance into transmittance
T2Afr()
Convert transmittance into absorptance.
Afr2T()
Convert transmittance into absorptance.
any2T() any2A() any2Afr()
Convert filter quantities.
convertTfrType()
Convert the "Tfr.type" attribute
convertThickness()
Convert the "thickness" attribute of an existing filter_spct object.
tag()
Tag a spectrum
untag()
Remove tags
cps2irrad() cps2Rfr() cps2Tfr()
Conversion from counts per second to physical quantities
smooth_spct()
Smooth a spectrum

Non-summary methods for transforming or modifying the wavelengths of spectral data objects.

Mathematical operators and functions for spectra

Specializations of all R’s mathematical functions and operators for spectral objects.

Extract, replace and combine

Functions and operators, both specializations of R’s ones and new ones specific to spectra and collections of spectra.

Apply

Apply functions for collections of spectra.

msmsply() msdply() mslply() msaply()
Multi-spct transform methods
convolve_each()
Convolve function for collections of spectra

Options

Convenience functions for setting R options recognized by functions in the ‘r4photobiology’ suite of R packages.

Astronomy

Astronomical computations of interest in photobiology and meteorology.

solar_time()
Local solar time
as.solar_date()
Convert a solar_time object into solar_date object
is.solar_time() is.solar_date()
Query class
as_tod()
Convert datetime to time-of-day
format(<tod_time>)
Encode in a Common Format
print(<tod_time>)
Print time-of-day objects
tz_time_diff()
Time difference between two time zones
day_night() day_night_fast() is_daytime() noon_time() sunrise_time() sunset_time() day_length() night_length()
Times for sun positions
sun_angles() sun_angles_fast() sun_elevation() sun_zenith_angle() sun_azimuth() distance_to_sun()
Solar angles
format(<solar_time>)
Encode in a Common Format
print(<solar_time>) print(<solar_date>)
Print solar time and solar date objects
validate_geocode() is_valid_geocode() length_geocode() na_geocode()
Validate a geocode
irrad_extraterrestrial()
Extraterrestrial irradiance

Atmosphere

Computations related to water vapour in air, and on equivalent air mass at different solar elevations.

Optics

Computations related to radiation physics.

Datasets

Spectral data used in documentation examples and unit tests

Data for light sources

Spectral irradiance data for daylight and artificial light

sun.spct sun.data
Solar spectral irradiance (simulated)
sun_daily.spct sun_daily.data sun.daily.spct sun.daily.data
Daily solar spectral irradiance (simulated)
sun_evening.spct sun_evening.mspct
Time series of solar spectral irradiance (measured)
white_led.source_spct white_led.cps_spct white_led.raw_spct
White led bulb spectrum
phenylalanine.spct
Molar spectral attenuation coefficient of phenylalanine
water.spct
Molar spectral attenuation coefficient of water
A.illuminant.spct
CIE A illuminant data
D50.illuminant.spct
CIE D50 illuminant data
D65.illuminant.spct
CIE D65 illuminant data
FEL_spectrum()
Incandescent "FEL" lamp emission spectrum
D2_spectrum()
Calculate deuterium lamp output spectrum from fitted constants
D2.UV653 D2.UV586 D2.UV654 FEL.BN.9101.165
Data for typical calibration lamps

Data for real and theoretical objects

Spectral transmittance, spectral reflectance and spectral absorptance data for real and theoretical objects

two_filters.spct two_filters.mspct polyester.spct yellow_gel.spct
Transmittance spectrum of plastic films
clear.spct opaque.spct
Theoretical spectrum of clear and apaque materials
green_leaf.spct
Green birch leaf reflectance.
Ler_leaf.spct Ler_leaf_rflt.spct Ler_leaf_trns.spct Ler_leaf_trns_i.spct
Green Arabidopsis leaf reflectance and transmittance.
black_body.spct white_body.spct clear_body.spct
Theoretical optical bodies

Data for light sensors

ccd.spct
Spectral response of a back-thinned CCD image sensor.
photodiode.spct
Spectral response of a GaAsP photodiode

Data for human vision

Data for the spectral response of the human eye as used in different computaions related to illumination and vision

ciev10.spct
Linear energy CIE 2008 luminous efficiency function 10 deg data
ciev2.spct
Linear energy CIE 2008 luminous efficiency function 2 deg data
ciexyzCC10.spct
CIE xyz chromaticity coordinates (CC) 10 deg data
ciexyzCC2.spct
CIE xyz chromaticity coordinates 2 deg data
ciexyzCMF10.spct
Linear energy CIE xyz colour matching function (CMF) 10 deg data
ciexyzCMF2.spct
Linear energy CIE xyz colour matching function (CMF) 2 deg data
cone_fundamentals10.spct cone_fundamentals10.mspct
Ten-degree cone fundamentals

Data for animal vision

Data for the spectral response of bee vision

beesxyzCMF.spct
Honeybee xyz chromaticity colour matching function data

Utility data

List of packages in the R for Photobiology suite

r4p_pkgs
Packages in R for Photobiology suite

Housekeeping and helper functions

Utilities mainly used internally in the ‘r4photobiology’ suite of R packages, but safe to use in user code.

check_spct()
Check validity of spectral objects
enable_check_spct() disable_check_spct() set_check_spct()
Enable or disable checks
check_w.length()
Sanity check of wavelengths (internal function).
checkTimeUnit()
Check the "time.unit" attribute of an existing source_spct object
copy_attributes()
Copy attributes
merge_attributes()
Merge and copy attributes
formatted_range()
Compute range and format it
normalize_range_arg()
Normalize a range argument into a true numeric range
collect2mspct()
Form a new collection
spct_wide2long()
Convert spectrum from wide to long form
uncollect2spct()
Extract all members from a collection
drop_user_cols()
Drop user columns
getSpctVersion()
Get the "spct.version" attribute
getMspctVersion()
Get the "mspct.version" attribute
is.old_spct()
Query if an object has old class names
upgrade_spct()
Upgrade one spectral object
upgrade_spectra()
Upgrade one or more spectral objects
f_mspct() mutate_mspct() calc_filter_multipliers() T2T() getAfrType() setAfrType() sample_spct() sample_mspct()
Defunct functions and methods

Low-level functions

Internal functions available for use by developers when maximum flexibility is needed. They are not meant for everyday use as they lack error handling and data validation features.

as_energy()
Convert spectral photon irradiance into spectral energy irradiance
as_quantum()
Convert spectral energy irradiance into spectral photon irradiance
as_quantum_mol()
Convert spectral energy irradiance into spectral photon irradiance
calc_multipliers()
Spectral weights
calc_source_output()
Scaled and/or interpolated light-source spectral output
check_spectrum()
Sanity check a spectrum
copy_attributes()
Copy attributes
div_spectra()
Divide two spectra, even if the wavelengths values differ
e2qmol_multipliers()
Calculate energy to quantum (mol) multipliers
e2quantum_multipliers()
Calculate energy to quantum multipliers
energy_irradiance()
Calculate (energy) irradiance from spectral irradiance
energy_ratio()
Energy:energy ratio
findMultipleWl()
Find repeated w.length values
find_peaks()
Find peaks in a spectrum
find_spikes()
Find spikes
find_wls()
Find wavelength values in a spectrum
fit_peaks() fit_valleys()
Refine position and value of extremes by fitting
get_attributes()
Get the metadata attributes
get_peaks() get_valleys()
Get peaks and valleys in a spectrum
insert_spct_hinges()
Insert new wavelength values into a spectrum
integrate_xy()
Gives irradiance from spectral irradiance.
interpolate_spectrum()
Calculate spectral values at a different set of wavelengths
irradiance()
Photon or energy irradiance from spectral energy or photon irradiance.
merge_attributes()
Merge and copy attributes
normalized_diff_ind() normalised_diff_ind() NDxI()
Calculate a normalized difference.
oper_spectra()
Binary operation on two spectra, even if the wavelengths values differ
photon_irradiance()
Photon irradiance
photon_ratio()
Photo:photon ratio
photons_energy_ratio()
Photon:energy ratio
prod_spectra()
Multiply two spectra, even if the wavelengths values differ
replace_bad_pixs()
Replace bad pixels in a spectrum
s_e_irrad2rgb()
Spectral irradiance to rgb color conversion
select_spct_attributes() spct_attributes()
Merge user supplied attribute names with default ones
split_energy_irradiance()
Energy irradiance for split spectrum regions
split_irradiance()
Energy or photon irradiance for split spectrum regions
split_photon_irradiance()
Photon irradiance for split spectrum regions
subt_spectra()
Subtract two spectra
sum_spectra()
Add two spectra
trim_tails()
Trim (or expand) head and/or tail
trim_waveband()
Trim (or expand) head and/or tail
v_insert_hinges()
Insert spectral data values at new wavelength values.
v_replace_hinges()
Overwrite spectral data values at existing wavelength values.
w_length_range2rgb()
Wavelength range to rgb color conversion
w_length2rgb()
Wavelength to rgb color conversion
waveband_ratio()
Photon or energy ratio