Closed philipp-baumann closed 3 years ago
My suggestion is to implement matching of spectrum types and corresponding wavenumbers (instead of fixed x$wavenumbers). The wavenumber range of the background measurement (single channel) and the sample spectrum are more narrow.
Fixed in https://github.com/pierreroudier/opusreader/commit/9ed438ebb01c48cad8b4d3f2bd5a00b52f725045.
Not 100% on the wavenumbers that should be affected to interferograms, I have used:
# Grab correct wavenumbers for interpolation
wn <- switch(extract,
spc = x$wavenumbers,
spc_nocomp = x$wavenumbers,
ScSm = x$wavenumbers_sc_sm,
ScRf = x$wavenumbers_sc_rf,
IgSm = x$wavenumbers_sc_sm,
IgRf = x$wavenumbers_sc_rf
)
Please re-open if that's not correct.
https://github.com/pierreroudier/opusreader/blob/d894ceef533af3b7285b64cfe6db461a9f31b2e2/R/opus_read_file.R#L135
Created on 2021-05-12 by the reprex package (v2.0.0)
My suggestion is to implement matching of spectrum types and corresponding wavenumbers (instead of fixed
x$wavenumbers
). The wavenumber range of the background measurement (single channel) and the sample spectrum are more narrow.I have no idea about the technical reasons behind Bruker truncating the range of single channel spectra of the background (maybe something to check with the chief software/chemometrics engineer at Bruker if they allow us insight in their "company secrets" and GMP lock-in. Regardless, we should resample it with the correct wavenumbers stored internally.
Side note: There must be a secret hash in the header to make sure nobody can modify blocks later without getting noticed...Hypothetically, if one figures out the exact location of the hash of the entire OPUS binary together with the type of hash algorithm used, GMP will be replaced by "Open Manufacturing Practice". I hope for this time to come soon. Then, becomes clear that there is no sense anymore to hide all these details in the files without providing any full specification ;-).
I have some functions in simplerspec where I have prototyped some type matching logic we could slightly modify. But have to check and recall first.