During the last two years development has continued at a slow pace. Most changes are to the functions for interactive acquisition of spectra, correction of bugs and tracking to changes in packages from which imports are made. Testing was done with new OmniDriver releases. Some data examples have been added and also replaced. Some progress with the vignettes has been done. However, the documentation still needs work.
One visible change is the move of the Git repository from Bitbucket to GitHub. Package ‘rOmniDriver’ has also been moved to GitHub and its documentation updated to reflect this.
In the introduction to this series of post, I described the Yoctopuce library and told that R package ‘reticulate’ can be used to access the Python version of the yoctopuce library. Here I describe a simple and cheap “micro” spectrometer with a digital interface and its use together with R packages from the 'r4photobiology' suite.
I will use a miniature and low cost spectrometer, type AS7265X from ams. It does not used a grating as monochromator, but instead each of the 18 channels has a different interference filter deposited directly on the silicon chip. The FWHM is 20 nm, and the wavelength range from 410 nm to 940 nm. The spectrometer consists in three separate sensor units working together. The interface is digital, and temperature compensation and analogue to digital conversion takes place in the sensor modules. In spite of the number of channels communication between the spectrometer and a micro-processor requires only two wires. The spectrometer supports two different communication protocols, the specialized I2C and a generic serial communication (UART).
Yoctopuce USB interface modules provide a very elegant solution to many different sensing and control problems, including measuring radiation. I have been interested in using them to acquire data directly from within R so as to be able to use the ‘r4photobiology’ suite of packages for real-time or near real time analysis and plotting of the acquired data.
The elegantly coded libraries supplied by Yoctopuce are available with interfaces in multiple computer programming and scripting languages. I have been trying different approaches to calling functions from these libraries in R scripts, but given the large number of functions needed to support the great variety of modules, writing an ad hoc interface for R was out of question. I first tried calling the command line version of the library functions from within R, but at least in Windows 10, the delay was too much and not consistent. Next I tried using the web server in the YoctoHub to send commands as http requests. This worked but it is a rather awkward approach, and not portable to accessing the modules directly through USB.
Two days ago, after reading about the ‘reticulate’ package I decided to test an approach similar to that I have used in package ‘rOmniDriver’ to access, with help from the ‘rJava’ package, Ocean Optics spectrometers through OmniDriver, a library written in Java. In the present case using ‘reticulate’ to access the Python version of the YoctoPuce library. It works extremely well, and the RStudio IDE provides in the editor even auto-completion and bubble help for functions and other objects defined in the Python library!
I have decided to describe here a few use cases for data acquisition or light source control using YoctoPuce models and R scripts. Most examples will be simple but useful, as they are real use cases rather than toy examples.
The YoctoPuce modules, hubs and the corresponding free libraries and the documentation are available at https://www.yoctopuce.com/. The ‘reticulate’ package is available through CRAN, and nicely formatted documentation can be found at https://rstudio.github.io/reticulate/. The first CRAN release of ‘reticulate’ appeared less than a year ago.
Improvements aiming at continuing the expansion of the support of different Ocean Optics spectrometers and of additional measurement methods.
Update acq_irrad_interactive() adding alternative user-interface modes, allowing users to set comment and what.measured attributes, and to construct collections of spectra.
Add pre-built calibrations and methods for additional FLAME-S instruments.
Improve algorithm for automatic tuning of integration time to achieve faster convergence.
Fix various minor bugs.
Test against OmniDriver 1.2.56
Update read_ooov_files() for compatibility with ‘readr’ >= 1.2.0 which is now required
Add support for measurement of pulsed light sources (under development)
The new features described below are under development, subject to change without previous notice and not yet well tested!! (double-check any results and please report any bugs by raising an issue!)
Implement support for measuring output from xenon flashes, including use of such flashes as light sources for measurement of spectral transmittance and reflectance. Use of multiple exposures per integration is also supported and the number of exposures stored as metadata is used during later processing. In the case of pulsed light sources the first conversion of RAW spectra is into counts per exposure, and instead of spectral irradiance spectral fluence per exposure is computed. All changes are backwards compatible with raw data acquired with earlier versions of ‘ooacquire’ and the user interface remains unaltered for the measurement of continuous light sources.
Add function acq_fluence_interactive() for measuring spectral fluence of pulsed light sources.
Add acq_fraction_pulsed_interactive() for measuring transmittance and reflectance using a pulsed light source.
from sources retrieved from the Git repository at Bitbucket.
devtools::install_bitbucket("aphalo/ooacquire", ref = "0.1.6")
devtools::install_bitbucket("aphalo/photobiology") # only if not automatically installed/updated
devtools::install_bitbucket("aphalo/photobiologyWavebands") # only if not automatically installed/updated
devtools::install_bitbucket("aphalo/ggspectra") # only if not automatically installed/updated