Open sumpfralle opened 1 year ago
Actually, I wrote "jcamp_calc_xsec" as a convenient way to convert the units of the input spectrum into absorption cross-section. If the input spectrum supplies arbitrary units, then there will be no easy way to know how to convert this to absorption cross-section. The three examples shown here of y-units are taken from the various JCAMP files that I've used in the past as part of the NIST infrared spectral database.
When you mention about the adjustment of the y values, do you mean that running "jcamp_calc_xsec()" will change the y values of the original input? It certainly wasn't meant to do that, so if it does then that behavior should be considered a bug. (A bug which I didn't encounter because I'm always converting my spectra to xsec.)
I saw where in the code that this function can change the y-values. I made a slight modification to make sure that the input will not get changed.
As for the "power" or "intensity" values -- I can't see any way to convert these to cross-section values without knowing the representation of these in their basic units.
Is there something different that would work better for you?
The latest specification describes the
YUNITS
field as follows:The following example values are mentioned in the specification:
POWER
INTENSITY
But in
JCAMP_calc_xsec
the current implementation ofjcamp
seems to insist on specific values:transmittance
absorbance
(micromol/mol)-1m-1 (base 10)
Personally I am surprised, that a function named
JCAMP_calc_xsec
interferes withy
values at all.Maybe this adjustment of
y_values
could be optional? Or it could tolerate unknown values in order to skip the adjustment ofy
values?My current workaround is to set
yunits
toabsorbance
(which seems to skip this processing step).I am willing to prepare a proposal, if you can hint me at your preferred solution.