These functions allow to import Thermo Galactic/Grams `.spc` files.

read_spc(
  filename,
  keys_hdr2data = FALSE,
  keys_log2data = FALSE,
  log_txt = TRUE,
  log_bin = FALSE,
  log_disk = FALSE,
  hdr = list(),
  no_object = FALSE
)

Arguments

filename

The complete file name of the `.spc` file.

keys_hdr2data, keys_log2data

character vectors with the names of parameters in the `.spc` file's log block (log2xxx) or header (hdr2xxx) that should go into the extra data (yyy2data) of the returned hyperSpec object.

All header fields specified in the `.spc` file format specification (see below) are imported and can be referred to by their de-capitalized names.

log_txt

Should the text part of the `.spc` file's log block be read?

log_bin, log_disk

Should the normal and on-disk binary parts of the `.spc` file's log block be read? If so, they will be put as raw vectors into the hyperSpec object's log_

hdr

A list with fileheader fields that overwrite the settings of actual file's header.

Use with care, and look into the source code for detailed insight on the elements of this list.

no_object

If `TRUE`, a list with wavelengths, spectra, labels, log and data are returned instead of a hyperSpec object.

This parameter will likely be subject to change in future - use with care.

Value

If the file contains multiple spectra with individual wavelength axes, `read_spc()` returns a list of hyperSpec objects. Otherwise the result is a hyperSpec object.

`read_spc_Kaiser_map()` returns a hyperSpec object with data columns x, y, and z containing the stage position as recorded in the `.spc` files' log_

Note

Only a restricted set of test files was available for development. Particularly, the w-planes feature could not be tested.

If you have `.spc` files that cannot be read with these function, don't hesitate to contact the package maintainer with your code patch or asking advice.

References

Source development kit and file format specification of `.spc` files.

Author

C. Beleites

Examples


## get the sample .spc files from ftirsearch.com (see above)
if (FALSE) {
# single spectrum
spc <- read_spc("BENZENE.SPC")
plot(spc)

# multi-spectra .spc file with common wavelength axis
spc <- read_spc("IG_MULTI.SPC")
spc

# multi-spectra .spc file with individual wavelength axes
spc <- read_spc("BARBITUATES.SPC")
plot(spc[[1]], lines.args = list(type = "h"))
}