Read contents of one spectroscopic file produced by OcenView software (Ocen Optics, Inc.) to hyperSpec object. Supported file formats areeither TimeSeries data file with header or ASCII data file with header. Suported versions of file are `OceanView 1.5.2` and `OceanView 1.5.0?`

read.OceanView(
  file,
  dec = ".",
  parse_filename = NULL,
  ignore.case = FALSE,
  xlab = NULL,
  ylab = "I, a.u.",
  last_headerline_text = ">>>>>Begin Spectral Data<<<<<",
  software = "OceanView",
  version_ = "1.5.2",
  n = 17,
  file_format = c("auto", "ascii", "ts", "timeseries")[1]
)

read.OceanView2(file, dec = ",", ..., file_format = "auto")

read.OceanView0(
  file,
  dec = ".",
  ...,
  file_format = "auto",
  parse_filename = parser_1
)

read.OceanView.ascii(file, dec = ".", ..., file_format = "ascii")

read.OceanView.ascii2(file, dec = ",", ..., file_format = "ascii")

read.OceanView.ascii0(
  file,
  dec = ".",
  ...,
  file_format = "ascii",
  parse_filename = parser_1
)

read.OceanView.ts(file, dec = ".", ..., file_format = "ts")

read.OceanView.ts2(file, dec = ",", ..., file_format = "ts")

read.OceanView.ts0(
  file,
  dec = ".",
  ...,
  file_format = "ts",
  parse_filename = parser_1
)

Arguments

file

(string) A name of OcenView file .

dec

("." | ",") The character used in the file for decimal points , e.g. period (".") or comma (",").

parse_filename

(function | string | NULL) Either a function that parses string of filename and extracts relevant information,
or a regular expression to be used to parse file name and extract relevant information,
or NULL.

ignore.case

A logical that indicates if regular extression in parse_filename is case sensitive. Applies ONLY if parse_filename is a string with regular expression.

xlab

(string | NULL) Label for x (wavelength) axis. If NULL (defaut) - the label is selected automatically.

ylab

(string) Label for y (intensity) axis. Defaut is "I, a.u.".

last_headerline_text

(string) A string, that indicates the last header line. Default is ">>>>>Begin Spectral Data<<<<<".

software

("OceanView" | "OOIBase32") Name of software, that created the file.

version_

("1.5.2" | "1.5.0" | string) A version of OceanView file. Curently supported versions are "1.5.2" (or newer) and "1.5.0".

n

(integer) Number of header lines to be scanned . Default is 17. These lines include the header line indicated in last_headerline_text.

file_format

("auto"|"ascii"|"ts"|"timeseries") A string to determine format of spectroscopic OceanView file:
"ascii" for ASCII file with header;
"ts" or "timeseries" for timeseries file with header;
"auto" (default) - automatically determines the format of file, but may result in a slower performance than options above.

Value

A hyperSpec object with technical and spectroscopic information from file file.

Details

In read.OceanView the default decimal symbol is period (.). In read.OceanView2 - comma (,).

Author

Vilmantas Gegzna

Examples

# \donttest{
if (FALSE) {

library(spHelper)

read.OceanView("Spectra.txt")
read.OceanView("Spectra.txt", dec = ",")
read.OceanView2("Spectra.txt")


# Read several files to one `hyperspec` object:

Files   <- dir()[1:4]                     # 4 files are sellected
sp_list <- lapply(Files, read.OceanView)  # Makes a list of objects
sp      <- collapse(sp_list)              # Makes one object

plotmat(sp)

# -------------------------------------------------------------------

files <- dir("data-raw/demo spectra", full.names = TRUE)

# ts example:

file.ts <- files[3]
read.OceanView(file.ts) %T>% plot(col=2:3) %>%  summary_hyData

# ascii examples:

file.ascii.Raman <- files[1]
read.OceanView(file.ascii.Raman) %T>% plot(col=2) %>%  summary_hyData

file.ascii.Fluorescence <- files[2]
read.OceanView(file.ascii.Fluorescence) %T>% plot(col=4) %>%  summary_hyData
read.OceanView(file.ascii.Fluorescence)$..  %>% head

# .Scope example:
file.Scope <- files[4]
read.OOIBase32(file.Scope) %T>% plot(col=5) %>%  summary_hyData
read.OOIBase32(file.Scope)$..  %>% head
# -------------------------------------------------------------------
}# }