User Guide

Package ‘photobiologyFilters’ 0.5.1

Pedro J. Aphalo

2020-04-29

Introduction

This package, is a data only package, part of a suite, which has package ‘photobiology’ at its core. Please visit (http://www.r4photobiology.info/) for additional information. For details on plotting spectra, please consult the documentation for package ‘ggspectra’, and for information on the calculation of summaries and maths operations between spectra, please, consult the documentation for package ‘photobiology’.

library(photobiology)
## Loading required package: tibble
## News at https://www.r4photobiology.info/
library(photobiologyWavebands)
library(photobiologyFilters)
library(ggspectra)
## Loading required package: ggplot2
theme_set(theme_bw())

In this very brief User Guide we describe how to access individual spectra or subsets of spectra.

The data

Spectral data is included both for optical filters, sold as such, and for materials that either on purpose or by accident may be interposed in the “light” path in photobiological experiments, including glass panes, plastic sheets and films. It must be kept in mind that, 1) absorptance depends on the thickness of a filter in addition to the properties of the material it is made off, and that 2) reflectance depends on the angle of incidence of the light beam.

The spectral data have been acquired with an assortment of different instruments. Some data are measured by the authors with spectrophotometers, others have been provided by filter manufacturers. Whenever data was available an approximate reflectance for normal incidence angle, material thickness, and the mode of attenuation have been stored as metadata. In the case of filters sold assembled in frames for use in photography and industrial automation the thickness is rarely disclosed by suppliers. Reflectance in some cases was estimated from maximum transmittance for known clear materials or from independent sources.

The difference in resolution and slit function among instruments can give, for the same filter, measured “apparent” peaks and valleys of slightly different width, and slopes of slightly different steepness. This is an inevitable artifact of spectral measurements, and except for some dichroic (= interference) filters, filters have relatively wide (“Gaussian”) peaks, the distortion is small.

Another important consideration is that some materials scatter transmitted and reflected light, and consequently such materials can be accurately measured only with an integrating sphere. Data included here have been in many cases measured without an integrating sphere; i.e. only by assessing the direct beam. For non-scattering materials this causes minor errors.

Glass-filter properties vary to some extent among melt batches. Variation can also be expected among batches of plastic filters. Furthermore, filters age upon exposure to light and UV radiation, and in some cases even upon exposure to air. Aging is not limited to plastic filters and can also affect optical glass.

We provide spectral reflectance constants for some of the filters in this collection, as we do not have such data available for all of them. For filters made of ionic glass and coloured plastics, reflection is not selective, and amounts to about 9 to 10% of radiation incident at an angle close to perpendicular to the surface. Anti-reflection coating (ARC) reduces reflections, and multi-coating (MC) even further. Such coatings are not equally effective at all wavelengths and, consequently, their use can modify the spectral properties of a filter. In contrast to the filters described above, dichroic or interference filters reflect the “rejected” radiation. It is also possible to produce filters that have an absorbing glass as substrate and a dichroic coating deposited onto one or both of its surfaces. In the metadata filters are tagged as belonging to one of three attenuation.mode types: absorption, reflection and mixed. Mixed includes those filters where wavelength-selective attenuation is brought about both by absorption and reflection, including scattering media and dichroic filters deposited on absorptive ionic glass.

All the spectral data in this package are stored in a single R object, a collection of spectra of class filter_mspct with members of class filter_spct. Individual or subsets of spectra can be retrieved by name. The package includes also several character vectors of names, each one containing names for filters of a given color, a given type or from a given manufacturer. The names of all these vectors are available in vector `all_filter_accessors. The names used are in most cases the codes used by the manufacturers for the given type with a code for the manufacturer of supplier added. Any dashes in these codes have been replaced by underscores.

band_pass_filters
##  [1] "BPI_Luminance"                   "BPI_Solatrol"                   
##  [3] "Foiltek_Clear_PET_G"             "Heliopan_BG38"                  
##  [5] "McDermit_PET_Autostat_CT5_125um" "MIDOPT_AB555"                   
##  [7] "MIDOPT_Bi405"                    "MIDOPT_Bi440"                   
##  [9] "MIDOPT_Bi450"                    "MIDOPT_Bi518"                   
## [11] "MIDOPT_Bi520"                    "MIDOPT_Bi550"                   
## [13] "MIDOPT_Bi632"                    "MIDOPT_Bi650"                   
## [15] "MIDOPT_Bi660"                    "MIDOPT_Bi685"                   
## [17] "MIDOPT_Bi725"                    "MIDOPT_Bi780"                   
## [19] "MIDOPT_Bi808"                    "MIDOPT_Bi830"                   
## [21] "MIDOPT_Bi850"                    "MIDOPT_Bi880"                   
## [23] "MIDOPT_Bi905"                    "MIDOPT_BN470"                   
## [25] "MIDOPT_BN485"                    "MIDOPT_BN490"                   
## [27] "MIDOPT_BN532"                    "MIDOPT_BN535"                   
## [29] "MIDOPT_BN595"                    "MIDOPT_BN630"                   
## [31] "MIDOPT_BN650"                    "MIDOPT_BN660"                   
## [33] "MIDOPT_BN740"                    "MIDOPT_BN785"                   
## [35] "MIDOPT_BN810"                    "MIDOPT_BN840"                   
## [37] "MIDOPT_BN850"                    "MIDOPT_BN880"                   
## [39] "MIDOPT_BN940"                    "MIDOPT_BP250"                   
## [41] "MIDOPT_BP324"                    "MIDOPT_BP365"                   
## [43] "MIDOPT_BP470"                    "MIDOPT_BP485"                   
## [45] "MIDOPT_BP500"                    "MIDOPT_BP525"                   
## [47] "MIDOPT_BP550"                    "MIDOPT_BP590"                   
## [49] "MIDOPT_BP635"                    "MIDOPT_BP660"                   
## [51] "MIDOPT_BP695"                    "MIDOPT_BP735"                   
## [53] "MIDOPT_BP800"                    "MIDOPT_BP810"                   
## [55] "MIDOPT_BP845"                    "MIDOPT_BP850"                   
## [57] "MIDOPT_BP865"                    "MIDOPT_BP880"                   
## [59] "MIDOPT_DB395_870"                "MIDOPT_DB475_850"               
## [61] "MIDOPT_DB550_850"                "MIDOPT_DB660_850"               
## [63] "MIDOPT_DB735"                    "MIDOPT_DB850"                   
## [65] "MIDOPT_DB940"                    "MIDOPT_PE530"                   
## [67] "MIDOPT_TB475_550_850"            "MIDOPT_TB550_660_850"           
## [69] "Schott_BG18"                     "Schott_BG25"                    
## [71] "Schott_BG3"                      "Schott_BG36"                    
## [73] "Schott_BG38"                     "Schott_BG39"                    
## [75] "Schott_BG40"                     "Schott_BG42"                    
## [77] "Schott_BG50"                     "Schott_BG55"                    
## [79] "Schott_BG60"                     "Schott_BG60HT"                  
## [81] "Schott_BG61"                     "Schott_BG62"                    
## [83] "Schott_BG62HS"                   "Schott_BG62HT"                  
## [85] "Schott_BG63"                     "Schott_BG64"                    
## [87] "Schott_BG66HS"                   "Schott_BG67"                    
## [89] "Schott_BG7"                      "Schott_UG1"                     
## [91] "Schott_UG11"                     "Schott_UG2A"                    
## [93] "Schott_UG5"                      "Unbranded_Clear_LD_PE_50um"     
## [95] "Unbranded_Clear_LD_PE_50um_used" "UQG_Blue_dichroic_CDB"          
## [97] "UQG_UG1_2mm"
schott_filters
##  [1] "Schott_UG1"     "Schott_UG5"     "Schott_UG11"    "Schott_BG3"    
##  [5] "Schott_BG7"     "Schott_BG18"    "Schott_BG25"    "Schott_BG36"   
##  [9] "Schott_BG38"    "Schott_BG39"    "Schott_BG40"    "Schott_BG42"   
## [13] "Schott_S_8612"  "Schott_BG50"    "Schott_BG55"    "Schott_BG60"   
## [17] "Schott_BG60HT"  "Schott_BG61"    "Schott_BG62"    "Schott_BG62HT" 
## [21] "Schott_BG63"    "Schott_BG64"    "Schott_VG9"     "Schott_VG20"   
## [25] "Schott_S_8022"  "Schott_S_8023"  "Schott_GG395"   "Schott_GG400"  
## [29] "Schott_GG420"   "Schott_GG435"   "Schott_GG455"   "Schott_GG475"  
## [33] "Schott_GG495"   "Schott_OG515"   "Schott_OG530"   "Schott_OG550"  
## [37] "Schott_OG570"   "Schott_OG590"   "Schott_RG9"     "Schott_RG610"  
## [41] "Schott_RG630"   "Schott_RG645"   "Schott_RG665"   "Schott_RG695"  
## [45] "Schott_RG715"   "Schott_RG780"   "Schott_RG830"   "Schott_RG850"  
## [49] "Schott_RG1000"  "Schott_NG1"     "Schott_NG3"     "Schott_NG4"    
## [53] "Schott_NG5"     "Schott_NG9"     "Schott_NG11"    "Schott_N_WG280"
## [57] "Schott_N_WG295" "Schott_N_WG305" "Schott_N_WG320" "Schott_KG1"    
## [61] "Schott_KG2"     "Schott_KG3"     "Schott_KG5"     "Schott_BG67"   
## [65] "Schott_UG2A"    "Schott_BG62HS"  "Schott_BG66HS"

Accessing individual spectra

The filter_spct member objects in filters.mspct can be accessed through their names or through a numeric index. As the numeric indexes are likely to change with updates to the package, their use is discouraged. Names as character strings should be used instead. The names are listed in the documentation and also available through the “Data Catalogue” vignette. They can also be listed with method names().

head(names(filters.mspct), 6)
## [1] "Baader_U_filter"             "BPI_Luminance"              
## [3] "BPI_Solatrol"                "BW_007_Clear_MRC_nano"      
## [5] "Courttaulds_CA_115um"        "Courttaulds_CA_115um_age000"

We can use a character string as index to extract an individual filter_spct object.

filters.mspct$Schott_UG11
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Transmittance of type 'internal'
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length     Tfr
##  *    <dbl>   <dbl>
##  1      200 0.00001
##  2      201 0.00001
##  3      202 0.00001
##  4      203 0.00001
##  5      204 0.00001
##  6      205 0.00001
##  7      206 0.00001
##  8      207 0.00001
##  9      208 0.00001
## 10      209 0.00001
## # ... with 991 more rows
filters.mspct[["Schott_UG11"]]
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Transmittance of type 'internal'
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length     Tfr
##  *    <dbl>   <dbl>
##  1      200 0.00001
##  2      201 0.00001
##  3      202 0.00001
##  4      203 0.00001
##  5      204 0.00001
##  6      205 0.00001
##  7      206 0.00001
##  8      207 0.00001
##  9      208 0.00001
## 10      209 0.00001
## # ... with 991 more rows

Be aware that according to R’s rules, using single square brackets will return a filter_mspct object possibly of length one. This statement is not equivalent to the one in the chunk immediately above.

filters.mspct["Schott_UG11"]
## Object: filter_mspct [1 x 1]
## --- Member: Schott_UG11 ---
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Transmittance of type 'internal'
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length     Tfr
##  *    <dbl>   <dbl>
##  1      200 0.00001
##  2      201 0.00001
##  3      202 0.00001
##  4      203 0.00001
##  5      204 0.00001
##  6      205 0.00001
##  7      206 0.00001
##  8      207 0.00001
##  9      208 0.00001
## 10      209 0.00001
## # ... with 991 more rows
## 
## --- END ---

Of course, with this syntax it is possible to use a vector of member names.

Accessing subsets of spectra

We can subset the filter_mspct object by indexing with vectors of character strings. The package provides several predefined ones, and users can easily define their own, either as constants or through computation. Here we use a vector defined by the package.

filters.mspct[petri_dishes]
## Object: filter_mspct [3 x 1]
## --- Member: glass_nn ---
## Object: filter_spct [911 x 2]
## Wavelength range 190 to 1100 nm, step 1 nm 
## Label: Petri dish lid;  glass 
## Transmittance of type 'total'
## Rfr (/1): 0.08, thickness (mm): NA, attenuation mode: absorption.
## 
## # A tibble: 911 x 2
##    w.length      Tfr
##       <int>    <dbl>
##  1      190 0.000142
##  2      191 0.000138
##  3      192 0.000135
##  4      193 0.000132
##  5      194 0.000129
##  6      195 0.000126
##  7      196 0.000123
##  8      197 0.000120
##  9      198 0.000117
## 10      199 0.000113
## # ... with 901 more rows
## --- Member: PS_Sterilin101 ---
## Object: filter_spct [911 x 2]
## Wavelength range 190 to 1100 nm, step 1 nm 
## Label: Petri dish lid;  polystyrene;  Sterilin101 
## Transmittance of type 'total'
## Rfr (/1): 0.104, thickness (mm): NA, attenuation mode: absorption.
## 
## # A tibble: 911 x 2
##    w.length      Tfr
##       <int>    <dbl>
##  1      190 0.000127
##  2      191 0.000125
##  3      192 0.000123
##  4      193 0.000121
##  5      194 0.000119
##  6      195 0.000117
##  7      196 0.000115
##  8      197 0.000113
##  9      198 0.000111
## 10      199 0.000109
## # ... with 901 more rows
## --- Member: PS_Sterilin109 ---
## Object: filter_spct [911 x 2]
## Wavelength range 190 to 1100 nm, step 1 nm 
## Label: Petri dish lid;  polystyrene;  Sterilin109 
## Transmittance of type 'total'
## Rfr (/1): 0.098, thickness (mm): NA, attenuation mode: absorption.
## 
## # A tibble: 911 x 2
##    w.length      Tfr
##       <int>    <dbl>
##  1      190 0.000134
##  2      191 0.000132
##  3      192 0.000129
##  4      193 0.000127
##  5      194 0.000124
##  6      195 0.000122
##  7      196 0.000119
##  8      197 0.000117
##  9      198 0.000115
## 10      199 0.000112
## # ... with 901 more rows
## 
## --- END ---

The vector all_filter_accessors contains the names of the different vectors of names of members of filters.mspct.

all_filter_accessors
##  [1] "acetate_filters"            "acrylic_filters"           
##  [3] "baader_filters"             "band_pass_filters"         
##  [5] "blue_filters"               "blue_green_filters"        
##  [7] "bpi_visqueen_filters"       "bw_filters"                
##  [9] "clear_filters"              "courtaulds_filters"        
## [11] "etola_filters"              "evonik_filters"            
## [13] "fake_unbranded_filters"     "firecrest_filters"         
## [15] "foiltek_filters"            "fotga_filters"             
## [17] "green_filters"              "haida_filters"             
## [19] "heat_filters"               "heliopan_filters"          
## [21] "hoya_filters"               "kenko_filters"             
## [23] "kolarivision_filters"       "lee_filters"               
## [25] "long_pass_filters"          "mcdermit_filters"          
## [27] "midopt_filters"             "neutral_filters"           
## [29] "old_schott_filters"         "optical_glass_filters"     
## [31] "orange_filters"             "photography_filters"       
## [33] "plastic_film_filters"       "plastic_sheet_filters"     
## [35] "plexiglas_filters"          "polycarbonate_filters"     
## [37] "polyester_filters"          "polystyrene_filters"       
## [39] "polyvynil_chloride_filters" "red_nir_filters"           
## [41] "rocolax_filters"            "rosco_filters"             
## [43] "schott_filters"             "short_pass_filters"        
## [45] "tiffen_filters"             "uqg_filters"               
## [47] "uv_filters"                 "uvir_cut_filters"          
## [49] "uvroptics_filters"          "xl_horticulture_filters"   
## [51] "yellow_filters"             "zeiss_filters"             
## [53] "zomei_filters"

In addition to the predefined vectors it is possible to compute numeric indexing vectors using pattern matching with grep(). In this example we extract the member spectra with names containing the string “UG”.

filters.mspct[grep("UG", names(filters.mspct))]
## Object: filter_mspct [5 x 1]
## --- Member: Schott_UG1 ---
## Object: filter_spct [943 x 2]
## Wavelength range 258 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG10.001 
## Transmittance of type 'internal'
## Rfr (/1): 0.086, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 943 x 2
##    w.length      Tfr
##  *    <dbl>    <dbl>
##  1      258 4.30e-12
##  2      259 2.56e-11
##  3      260 1.30e-10
##  4      261 6.50e-10
##  5      262 2.63e- 9
##  6      263 9.85e- 9
##  7      264 3.39e- 8
##  8      265 1.05e- 7
##  9      266 2.96e- 7
## 10      267 7.80e- 7
## # ... with 933 more rows
## --- Member: Schott_UG11 ---
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Transmittance of type 'internal'
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length     Tfr
##  *    <dbl>   <dbl>
##  1      200 0.00001
##  2      201 0.00001
##  3      202 0.00001
##  4      203 0.00001
##  5      204 0.00001
##  6      205 0.00001
##  7      206 0.00001
##  8      207 0.00001
##  9      208 0.00001
## 10      209 0.00001
## # ... with 991 more rows
## --- Member: Schott_UG2A ---
## Object: filter_spct [932 x 2]
## Wavelength range 269 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG2A0.00325 
## Transmittance of type 'internal'
## Rfr (/1): 0.082, thickness (mm): 3.25, attenuation mode: absorption.
## 
## # A tibble: 932 x 2
##    w.length      Tfr
##  *    <dbl>    <dbl>
##  1      269 4.12e-22
##  2      270 1.20e-20
##  3      271 4.10e-19
##  4      272 8.00e-18
##  5      273 1.54e-16
##  6      274 2.49e-15
##  7      275 3.36e-14
##  8      276 3.41e-13
##  9      277 3.15e-12
## 10      278 2.39e-11
## # ... with 922 more rows
## --- Member: Schott_UG5 ---
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG50.001 
## Transmittance of type 'internal'
## Rfr (/1): 0.086, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length     Tfr
##  *    <dbl>   <dbl>
##  1      200 0.00001
##  2      201 0.00001
##  3      202 0.00001
##  4      203 0.00001
##  5      204 0.00001
##  6      205 0.00001
##  7      206 0.00001
##  8      207 0.00001
##  9      208 0.00001
## 10      209 0.00001
## # ... with 991 more rows
## --- Member: UQG_UG1_2mm ---
## Object: filter_spct [831 x 2]
## Wavelength range 190 to 1020 nm, step 1 nm 
## Label: Glass filter: UQG UG1 2mm 
## Transmittance of type 'total'
## Rfr (/1): 0.077, thickness (mm): 2, attenuation mode: absorption.
## 
## # A tibble: 831 x 2
##    w.length      Tfr
##  *    <dbl>    <dbl>
##  1      190 0.000112
##  2      191 0.000111
##  3      192 0.000110
##  4      193 0.000108
##  5      194 0.000107
##  6      195 0.000105
##  7      196 0.000102
##  8      197 0.000102
##  9      198 0.000102
## 10      199 0.000102
## # ... with 821 more rows
## 
## --- END ---

To generate the subset of names matching a pattern, we can also use grep().

grep("UG", names(filters.mspct), value = TRUE)
## [1] "Schott_UG1"  "Schott_UG11" "Schott_UG2A" "Schott_UG5"  "UQG_UG1_2mm"

Querying metadata

The spectra are saved in objects of class "filter_spct", defined in package ‘photobiology’. Specializations of several methods including print() and summary() include a summary of the metadata in the header of the printout. Two different definitions of transmittance exist, differing in how reflection is treated: for “internal” transmittance, the divisor is the radiation entering the material, and for “total” transmittance the incident radiation. For some materials reflectance (Rfr) does not vary much with wavelength, and some suppliers provide a constant value for it.

filters.mspct$Schott_UG11
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Transmittance of type 'internal'
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length     Tfr
##  *    <dbl>   <dbl>
##  1      200 0.00001
##  2      201 0.00001
##  3      202 0.00001
##  4      203 0.00001
##  5      204 0.00001
##  6      205 0.00001
##  7      206 0.00001
##  8      207 0.00001
##  9      208 0.00001
## 10      209 0.00001
## # ... with 991 more rows

Metadata can also be queried with other methods. Please, see the documentation for package ‘photobiology’ for the details.

filter_properties(filters.mspct$Schott_UG11)
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
what_measured(filters.mspct$Schott_UG11)
## [1] "SCHOTT UG110.001"
how_measured(filters.mspct$Schott_UG11)
## [1] "Numerical data from supplier."
is_normalized(filters.mspct$Schoot_UG11)
## [1] NA
cat(comment(filters.mspct$Schott_UG11), "\n")
## SCHOTT filter 'UG11' data, reference thickness (m): 0.001 and reflectance factor: 0.908
##  (c) copyright SCHOTT, reproduced with permission.

Of the different metadata items, the type of data is of great importance. Transmittance (and absorptance) can be expressed in two different ways: 1) taking incident radiation as reference, or 2) taking radiation entering the material as reference (i.e. discounting reflection). 1) is referred as total transmittance while 2) is referred as internal transmittance. Attribute `Tfr.type" is used to store this information.

getTfrType(filters.mspct$Schott_UG11)
## [1] "internal"

Conversions

When metatdata are available and the mode of attenuation is "absorption" it is possible to compute the expected transmittance for a different thickness of the material. In the example we compute transmittance for a thickness of 4 mm.

convertThickness(filters.mspct$Schott_UG11, thickness = 4e-3)
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Transmittance of type 'internal'
## Rfr (/1): 0.092, thickness (mm): 4, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length      Tfr
##       <dbl>    <dbl>
##  1      200 1.00e-20
##  2      201 1.00e-20
##  3      202 1.00e-20
##  4      203 1.00e-20
##  5      204 1.00e-20
##  6      205 1.00e-20
##  7      206 1.00e-20
##  8      207 1.00e-20
##  9      208 1.00e-20
## 10      209 1.00e-20
## # ... with 991 more rows

We can also convert "internal" transmittance into "total" transmittance.

convertTfrType(filters.mspct$Schott_UG11, Tfr.type = "total")
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Transmittance of type 'total'
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length        Tfr
##       <dbl>      <dbl>
##  1      200 0.00000908
##  2      201 0.00000908
##  3      202 0.00000908
##  4      203 0.00000908
##  5      204 0.00000908
##  6      205 0.00000908
##  7      206 0.00000908
##  8      207 0.00000908
##  9      208 0.00000908
## 10      209 0.00000908
## # ... with 991 more rows

Conversion between transmittance, absorptance and absorbance is also possible. In package ‘photobiology’ fractions of one are used to express transmittance, reflectance and absorptance.

any2Afr(filters.mspct$Schott_UG11, action = "replace")
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length   Afr
##       <dbl> <dbl>
##  1      200  1.00
##  2      201  1.00
##  3      202  1.00
##  4      203  1.00
##  5      204  1.00
##  6      205  1.00
##  7      206  1.00
##  8      207  1.00
##  9      208  1.00
## 10      209  1.00
## # ... with 991 more rows

For absorbance, logarithms using 10 as base are used. In some fields, natural logarithms are used instead. Expressing A on this base is not supported by this package and any input absorbances must be first converted to log10 based A.

any2A(filters.mspct$Schott_UG11, action = "replace")
## Object: filter_spct [1,001 x 2]
## Wavelength range 200 to 5200 nm, step 1 to 50 nm 
## Label: SCHOTT UG110.001 
## Rfr (/1): 0.092, thickness (mm): 1, attenuation mode: absorption.
## 
## # A tibble: 1,001 x 2
##    w.length     A
##       <dbl> <dbl>
##  1      200     5
##  2      201     5
##  3      202     5
##  4      203     5
##  5      204     5
##  6      205     5
##  7      206     5
##  8      207     5
##  9      208     5
## 10      209     5
## # ... with 991 more rows

Plotting

Spectra can be plotted in the same ways as other data stored in data frames, using base R graphics, package ‘lattice’ or ‘ggplot2’. However, another package in our suite, ‘ggspectra’, built as an extension to ‘ggplot2’ makes plotting spectra extremely easy.

autoplot() methods use the metadata in the objects to set labels and decorations, as well as automatically setting the mapping of the x and y aesthetics.

autoplot(filters.mspct$MIDOPT_LP500)

autoplot(filters.mspct$MIDOPT_LP500,
         annotations = list(c("-", "peaks"), c("+", "wls")))

autoplot(filters.mspct$MIDOPT_TB550_660_850, 
         annotations = c("+", "title:none:none:what", "wls"), 
         w.band = VIS_bands(),
         range = c(500, 910),
         span = 11)
## Warning in range_check_Tfr(x, strict.range = strict.range): Off-range
## transmittance values [-0.0004..0.9229] instead of [0..1]

To graphically compare filters, we can pass a collection of spectral objects, such as subset of filters.mspct.

autoplot(filters.mspct[c("Schott_UG1", "Schott_UG11")], 
         range = c(200, 900),
         annotations = c("+", "boundaries"), 
         span = 11)
## Warning: Removed 42 rows containing non-finite values (stat_peaks).

To graphichaly compare filter thicknesses we can pass a collection of spectral objects.

thin_and_thick.mspct <- 
  filter_mspct(list("1 mm" = filters.mspct$Schott_UG11,
                    "3 mm" = convertThickness(filters.mspct$Schott_UG11,
                                              thickness = 3e-3)))
autoplot(thin_and_thick.mspct,
         range = c(200, 900),
         annotations = c("+", "boundaries"),
         span = 101)

To graphichaly assess filter stacks with air gaps.

stack.spct <- filters.mspct$Haida_Clear_Night_NanoPro * filters.mspct$Firecrest_UVIR_Cut
                    
autoplot(stack.spct,
         range = c(NA, 1400),
         w.band = c(UV_bands(), IR_bands("CIE")),
         annotations = c("+", "boundaries", "wls"),
         span = 21) +
  geom_line(data = filters.mspct$Haida_Clear_Night_NanoPro, colour = "purple") +
  geom_vline(xintercept = c(589, 589.6), linetype = "dotted") # Na emission lines

Package ‘ggspectra’ also defines specializations of method ggplot() for spectra that automatically maps the \(x\) and \(y\) aesthetics.

ggplot(filters.mspct$Firecrest_UVIR_Cut) +
  geom_line()

Calculating summaries

transmittance(filters.mspct$Firecrest_UVIR_Cut, UVA())
## Tfr(wl)_UVA.ISO 
##      0.01737539 
## attr(,"Tfr.type")
## [1] "unknown"
## attr(,"radiation.unit")
## [1] "transmittance average"
absorbance(filters.mspct$Firecrest_UVIR_Cut, list(UVA(), NIR()))
##  A(wl)_UVA.ISO A(wl)_NIR.ISO[ 
##       2.921684       2.897154 
## attr(,"Tfr.type")
## [1] "unknown"
## attr(,"radiation.unit")
## [1] "absorbance average"
transmittance(filters.mspct[grep("UG", names(filters.mspct))], 
              list(UVB(), UVA()))
## # A tibble: 5 x 3
##   spct.idx    `Tfr(wl)_UVB.ISO` `Tfr(wl)_UVA.ISO`
##   <fct>                   <dbl>             <dbl>
## 1 Schott_UG1             0.153              0.659
## 2 Schott_UG11            0.851              0.694
## 3 Schott_UG2A            0.0472             0.660
## 4 Schott_UG5             0.957              0.924
## 5 UQG_UG1_2mm            0.128              0.516

Using the data in other contexts

As filter_mspct is a class derived from list, and filter_spct is derived from tibble::tible which is a mostly compatible reimplementation of data.frame the data can be used very easily with any R function.

head(as.data.frame(filters.mspct$Schott_UG11))
##   w.length   Tfr
## 1      200 1e-05
## 2      201 1e-05
## 3      202 1e-05
## 4      203 1e-05
## 5      204 1e-05
## 6      205 1e-05

Of course attach and with also work as expected.

attach(filters.mspct)
transmittance(Schott_UG11, UVA())
## Tfr(wl)_UVA.ISO 
##       0.6941875 
## attr(,"Tfr.type")
## [1] "unknown"
## attr(,"radiation.unit")
## [1] "transmittance average"
detach(filters.mspct)
attach(filters.mspct)
with(Schott_UG11, range(w.length))
## [1]  200 5200
detach(filters.mspct)
with(filters.mspct, transmittance(Schott_UG11, UVA()))
## Tfr(wl)_UVA.ISO 
##       0.6941875 
## attr(,"Tfr.type")
## [1] "unknown"
## attr(,"radiation.unit")
## [1] "transmittance average"