write_jdx: Write to file in JCAMP-DX format

Description Usage Arguments References

Description

Writes spectra to a single or individual file in JCAMP-DX format. The format definition for JCAMP-DX 4.24 as specified in McDonald and Wilks (1988) is used. Please refer to this publication for more information about the data labels. This implementation writes labels for the required entries (table IIa) plus missing entries for the required and optional spectral parameters (see table V).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
write_jdx(
  x,
  path = x@data$filename,
  encoding = "latin1",
  title = x@data$spcname,
  data_type = c(NA_character_, "RAMAN SPECTRUM", "INFRARED SPECTRUM"),
  origin = NA,
  owner = NA,
  x_units = c(NA_character_, "1/CM", "MICROMETERS", "NANOMETERS"),
  y_units = c("ARBITRARY UNITS", "ABSORBANCE", "TRANSMITTANCE", "REFLECTANCE"),
  additional_labels = NULL,
  ymax = 32767,
  xmax = NULL,
  blocksize = 10
)

Arguments

x

a hyperSpec object

path

character; if only one path is provided, all spectra are written as blocks to a single file; specify a path for each spectrum to write separate files.

encoding

character; usually "latin1"

title

character; title for each spectrum, usually a column of the hyperSpec object is used here, such as x@data$spc.

data_type

character; translated to upper case; allowed values are NULL, "RAMAN SPECTRUM", "INFRARED SPECTRUM".

origin

character; length 1 or nrow(xx)

owner

character; length 1 or nrow(xx)

x_units

character; translated to upper case; allowed values are "1/CM", "MICROMETERS", "NANOMETERS".

y_units

character; translated to upper case; allowed values are "ARBITRARY UNITS", "ABSORBANCE", "TRANSMITTANCE", "REFLECTANCE".

additional_labels

list; provide a list of named character vectors which get used as additional header entries after being translated to uppercase characters - e.g. for two spectra list( c("date" = "2020-01-01", "Sample description" = "Sample1"), c("date" = "2020-01-05", "Sample description" = "Sample2")). While you enter any labels here its best to stick to the ones defined in McDonald and Wilks (1988) for software compatibility.

ymax

numeric; ordinate values is scaled to a range of c(-ymax, ymax) before being converted to integer.

xmax

numeric; , abscissa is scaled to a range of c(-xmax, xmax) before being converted to integer. If NULL, the unconverted doubles are written to the file.

blocksize

integer; number of ordinate values in a row.

References

ROBERT S. McDONALD and PAUL A. WILKS, JR. 1988. JCAMP-DX: A Standard Form for the Exchange of Infrared Spectra in Computer Readable Form. Appl. Spectrosc. 42(1), pp151-162


konradmayer/hyperSpec.utils documentation built on May 2, 2021, 4:17 a.m.