Read Spectral and Logged Data from Foreign Files

Functions for reading, and in some cases writing, foreign files containing spectral data from spectrometers and their associated software, output from daylight simulation models in common use, and some spectral data repositories. As well as functions for exchange of spectral data with other R packages. Part of the 'r4photobiology' suite, Aphalo P. J. (2015) .


Package ‘photobiologyInOut’ provides functions for importing spectral data from diverse sources including instrument-specific files, as well as spectral data output by solar-radiation simulation models. It also includes functions for exchanging spectral data with other R packages. Package ‘photobiologyInOut’ complements other packages in the ‘r4photobiology suite’ by allowing reading and writing “foreign” spectral data as well as reading data saved from data loggers.

Developing a package like this is a never-ending task as I have only a limited sample of output files for testing and formats are quite variable. The functions may not work with different software or firmware versions used for acquiring spectral data from instruments. Even the format of files can depend on the current locale and operating system.

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

Warning

The functions in this package work with the example files I have access to for testing, but they may not work with your own files as file formats vary.

PLEASE, BE VERY CAREFUL WHEN USING THIS PACKAGE. DO CHECK THAT UNITS USED IN THE IMPORTED FILE ARE THOSE EXPECTED BY THESE FUNCTIONS AND THAT THE VALUES IN THE RETRIEVED DATA ARE THOSE EXPECTED!

If they do not work with your files, they hopefully will be useful as examples for developing your own functions. If you develop new functions or improve the existing ones, please, do contribute them back to this project.

Installation

Installation of the most recent stable version from CRAN:

install.packages("photobiologyInOut")

Installation of the current unstable version from Bitbucket:

# install.packages("devtools")
devtools::install_bitbucket("aphalo/photobiologyInOut")

Documentation

HTML documentation is available at (http://docs.r4photobiology.info/photobiologyInOut/), including a User Guide.

News on updates to the different packages of the ‘r4photobiology’ suite are regularly posted at (http://www.r4photobiology.info/).

Two articles introduce the basic ideas behind the design of the suite and its use: Aphalo P. J. (2015) (https://doi.org/10.19232/uv4pb.2015.1.14) and Aphalo P. J. (2016) (https://doi.org/10.19232/uv4pb.2016.1.15).

A book is under preparation, and the draft is currently available at (https://leanpub.com/r4photobiology/).

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 (http://hdl.handle.net/10138/37558).

Contributing

Pull requests, bug reports, and feature requests are welcome at (http://bitbucket.org/aphalo/photobiologyInOut).

Citation

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

citation("photobiologyInOut")
#> 
#> To cite package 'photobiologyInOut' 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},
#>   }

License

© 2015-2018 Pedro J. Aphalo ([email protected]). Released under the GPL, version 2 or greater. This software carries no warranty of any kind.

News

TODO

Add support for StellarNet spectrometers and Bentham spectrometers. Add a generic reader of files into a collection of spectra. Add test cases for new functions for exchange of foreign data (currently tested through examples in vignette) (URGENT otherwise bugs creep-in easily).

photobiologyInOut 0.4.19 (2018-12-11)

  • Track code breaking change in 'readr' (>= 1.3.0).

photobiologyInOut 0.4.18 (2018-11-22)

  • Track code breaking change in 'readr' (>= 1.2.0).
  • Fix bug in read_oo_pidata() that was preventing reading of Ocean Optics "Raspberry Pi" Flame files with a sequence header line at the top.
  • Add decoding of file header to extract integration time and number of scans to read_oo_pidata().
  • Improve decoding of file header to extract instrument settings in read_oo_jazdata().

photobiologyInOut 0.4.17 (2018-09-27)

  • Add new function to read transmittance and reflectance files from Ocean Optics' Jaz modular spectrometer.
  • Fix bug in decoding of time and date in functions read_fmi2mspct(), read_tuv_usrout() and read_qtuv_txt(). Decoding failed under R 3.4.4 (oldrel) but worked under R 3.5.1 due to functions from 'lubridate' returning POSIXlt values instead of POSIXct values. Now we force conversion to POSIXct.

photobiologyInOut 0.4.16 (2018-08-30)

Revise read_fmi_dat() to extract date from file header and save the file header to the spectral object as a comment. Add read_fmi2mspct() for reading spectral irradiance. Bug fix: decoding of dates in fmi import functions for daily data not always returned POSIXct objects triggering errors in downstream code.

photobiologyInOut 0.4.15 (2018-08-10)

Add read_yoctopuce_csv() to read CSV files from YoctoPuce modules. Add read_qtuv_txt() to read spectral data output files from the on-line Quick TUV calculator. Add read_tuv_usrout2mspct() wrapper of read_tuv_usrout() and subset2mspct(). Revise read_tuv_usrout() with new formal parameter ozone.du and fix a bug in the setting of "where.measured" attribute. Revise all read functions so that they store the header of the imported file as a vector of character strings to attribute "file.header".

photobiologyInOut 0.4.14 (2018-04-03)

Implement class coercion methods ("as." methods) to complement earlier functions, tracking 'photobiology' 0.9.20. Move coercion methods from and to matrix objects to 'photobiology' 0.9.20. Update to track API changes in 'colorSpec' 0.7-3. Translate vignette to Rmarkdown.

photobiologyInOut 0.4.13

Add function read_FReD_csv() (read files flower reflectance database). Add function read_ASTER_txt() (read files ASTER materials reflectance database). Revise function read_licor_prn() to accept transmittance and reflectance spectra in addition to energy and photon irradiance spectra. Improve handling of 'label' by using only the base name of files and appending user supplied label text. Change location of external data used in vignettes.

photobiologyInOut 0.4.12

Fix CITATION file. Add function read_uvspec_disort(), rename read_libradtran_vesa() to read_uvspec_disort_vesa().

photobiologyInOut 0.4.11

Edit read_licor_prn() to work around a bug in readr::read_table() that results in missread data (wrong numbers). Add read_csi_dat() to read data saved from modern Campbell Scientific loggers.

photobiologyInOut 0.4.10

Make compatible with upcoming version of package 'lubridate' (pull request by vspinu NA). Add function read_avaspec_xls() which can import spectral data from Excel files exported from Avantes software. Fix code to avoid partial matches of function parameter names (tz -> tzone).

photobiologyInOut 0.4.9

Fix LaTeX error in vignette.

photobiologyInOut 0.4.8

Replace a couple of NA returned by read fucntions with empty spectral objects. Improve handling of strict.range to avoid spurious warnings.

photobiologyInOut 0.4.7

Add functions mspct2matrix() and matrix2mspct for conversion of collections of spectra into R matrices and vice-versa.

photobiologyInOut 0.4.6

Fix bug introduced when attempting to make the package pass CRAN checks without triggering a note.

photobiologyInOut 0.4.5

Fix for compatibility with 'dplyr' (> 0.4.3). Add functions to exchange data with package 'colorSpec': colorSpec2spct(), colorSpec2chroma_spct(), colorSpec2mspct(), spct2colorSpec(), chroma_spct2colorSpec(), and mspct2colorSpec(). Add or revise functions to exchange data with package 'hyperSpec': spct2hyperSpec(), mspct2hyperSpec(), hyperSpec2spct() and hyperSpec2mspct(). Add import function for raw counts from Ocean Optics instruments accessed through server running on a Raspberry Pi board: read_oo_pidata().

photobiologyInOut 0.4.4

Add 'readr::locale' support to all functions that could make use of it. Add 'label' parameter to all file import functions. Add function read_oo_ssdata() for reading SpectraSuite files containing raw counts. Add function read_libradtran_vesa() for reading libRadtran output file with multiple solar spectrum simulations (as preprocessed by Vesa's script). Add metadata as consistently as possible to the objects returned by all the file import functions. Update dependencies. Edit the user Guide. WARNING: from version 0.4.4 the time zone (tz) is by default "UTC" for decoding dates and times in files imported. In most cases you will need to pass the tz (or the locale) where the file was created as an argument to the functions!

photobiologyInOut 0.4.3

Update for compatibility with 'lubridate' (>= 1.5.6) Add function read_oo_jazdata() to read Jaz files containing raw counts. Add preliminary versions of functions to exchange data with package 'hyperSpec': mspct2hyperSpec() and hyperSpec2mspct(). Add preliminary version of function to import data from package 'pavo': rspec2mspct().

photobiologyInOut Ver 0.4.2

Fix bug in read_fmi_cum(). Update dependencies.

photobiologyInOut Ver 0.4.1

Update vignette. Fix docs.

photobiologyInOut Ver 0.4.0

This is a major update, not backwards compatible, as names and formal parameters of all functions have changed. Trimming is no longer supported (should be done as a separate operation).

The functions for Ocean Optics files now read the number of pixels from the file header, and hopefully will better adjust to different instruments and settings.

Functions for reading multiple spectra now return collections of spectra. (Functions that saved the spectral objects constructed from the data read from text files on disk back to disk as R data files have been removed.)

New functions for reading daily spectral exposure data from files returned by models from FMI have been added.

New function for reading .csv file from Avantes' AvaSpec spectrometers added.

photobiologyInOut Ver 0.3.2

Add "use.hinges" argument to functions, and default to not adding hinges when trimming input.

photobiologyInOut Ver 0.3.1

Remove dependency on data.table.

photobiologyInOut Ver 0.3.0

Corrected some bugs in read_licor_files()

photobiologyInOut Ver 0.2.1

Added function to read spectral irradiance files generated by the Jaz spectrometer from Ocean Optics.

Functions names shortened.

Expanded the User Guide.

photobiologyInOut Ver 0.2.0

Edited read_licor_prn_files() drastically. The new version is functionally equivalent but formal arguments have changed. In addition it is now implemented by calling read_licor_prn_file().

New functions read_licor_prn_file(), read_macam_dta_file(), read_ooss_txt_file() and read_tuv_file() returning source.spct objects.

Function read_xlsx() removed as there are other packages available for Excel file import.

photobiologyInOut Ver 0.1.3

Added function read.xlsx() for reading data from Excel workbook files saved as .xlsx (zipped XML format).

photobiologyInOut Ver 0.1.2

Added parameter unit.out and cleaned code.

photobiologyInOut Ver 0.1.0

First version containing only one function for importing data measured with a LI-COR LI-1800 spectroradiometer from .PRN text files produced by the PC1800 MS-DOS program from LI-COR.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("photobiologyInOut")

0.4.19 by Pedro J. Aphalo, 3 months ago


http://www.r4photobiology.info/


Report a bug at https://bitbucket.org/aphalo/photobiologyinout/issues/


Browse source code at https://github.com/cran/photobiologyInOut


Authors: Pedro J. Aphalo [aut, cre] , Titta K. Kotilainen [ctb] , Glenn Davis [ctb]


Documentation:   PDF Manual  


GPL (>= 2) license


Imports methods, photobiology, stringr, lubridate, tibble, dplyr, tidyr, readr, readxl, hyperSpec, colorSpec, lazyeval

Suggests knitr, rmarkdown, ggplot2, ggspectra, photobiologyWavebands, pavo, testthat


See at CRAN