Skip to contents

Package 'ooacquire' includes example scripts for acquisition of spectral data using Ocean Optics spectrometers. These scripts demonstrate the use of functions acq_irrad_interactive() and acq_fraction_interactive().

Details

The default behaviour of functions acq_irrad_interactive() and acq_fraction_interactive() is controlled by passing arguments to their formal parameters when called as well as by R options set before calling them.

Some of these defaults affect the type of data returned and the computation of physical quantities from the detector raw-counts data received from the spectrometer and which type of graphical and textual summaries are computed an saved.

One parameter can be passed as argument the definition of an R function used to controll a lamp or some other device by a trigger or a message to the user.

However, the majority of the options make it possible to chose which menues and features are accesible interactively through menues. Experience has shown that in a long data acquisition session, displaying to the operator only those options relevant to the current protocol or measurement approach reduces operator stress, decreases the oportunities for mistakes and allows measurements to be done faster and more consistently. The folder, operator, and file names used can be also set by arguments.

These functions have what at first sight is an excessive number of formal parameters. This is true if arguments to these parameters are entered manually each time spectral measurements are acquired. The idea is that using a simple R script, users can setup the default behaviour of these functions to match their needs. Once a script is available, it can be sourced to start a measurement session.

The scripts included in 'ooacquire' provide several examples of how to customize the default behaviour of the functions. Some of the files also include commented-out variations on the code example.

Examples

# find where the example files are installed as part of the package
path <- system.file("example-scripts", package = "ooacquire")

# list the files in the folder
list.files(path)
#>  [1] "acq-interac-using-triggers.R"      "fluence-acq-interac-acq-options.R"
#>  [3] "irrad-acq-interac-acq-options.R"   "irrad-acq-interac-simple.R"       
#>  [5] "irrad-acq-interac-ui-options.R"    "irrad-acq-script-FLMS.R"          
#>  [7] "irrad-acq-script-Luke.R"           "irrad-acq-script.R"               
#>  [9] "irrad-acq-series-tests.R"          "irrad-acq-timeseries.R"           
#> [11] "irrad-files.R"                     "linearization_test_script.R"      
#> [13] "measure-detector-non-linearity.R"  "transmittance-acq-interac-flash.R"
#> [15] "transmittance-acq-interac.R"       "transmittance_acq_script.R"       

# read and display one example file
readLines(paste(path, "irrad-acq-interac-simple.R", sep = "/"))
#>  [1] "# this is a simple example, see the help page of acq_irrad_interactive() for"   
#>  [2] "# a full description of parameters and the arguments they accept"               
#>  [3] "library(ooacquire)"                                                             
#>  [4] "library(lubridate)"                                                             
#>  [5] ""                                                                               
#>  [6] "photon_as_default()"                                                            
#>  [7] "acq_irrad_interactive(qty.out = \"irrad\","                                     
#>  [8] "                      protocols = \"ld\","                                      
#>  [9] "                      save.pdfs = TRUE,"                                        
#> [10] "                      save.summaries = FALSE,"                                  
#> [11] "                      save.collections = FALSE,"                                
#> [12] "                      interface.mode = \"auto-attr\","                          
#> [13] "                      folder.name = sprintf(\"./TEST-%s\", lubridate::today()))"