Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JCAMP_calc_xsec: tolerate arbitrary values for YUNITS? #29

Open
sumpfralle opened this issue Dec 6, 2022 · 2 comments
Open

JCAMP_calc_xsec: tolerate arbitrary values for YUNITS? #29

sumpfralle opened this issue Dec 6, 2022 · 2 comments

Comments

@sumpfralle
Copy link
Contributor

The latest specification describes the YUNITS field as follows:

can be ARBITRARY UNITS, STRING

The following example values are mentioned in the specification:

  • POWER
  • INTENSITY

But in JCAMP_calc_xsec the current implementation of jcamp 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 with y values at all.

Maybe this adjustment of y_values could be optional?
Or it could tolerate unknown values in order to skip the adjustment of y values?

My current workaround is to set yunits to absorbance (which seems to skip this processing step).

I am willing to prepare a proposal, if you can hint me at your preferred solution.

@nzhagen
Copy link
Owner

nzhagen commented Dec 7, 2022

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.)

@nzhagen
Copy link
Owner

nzhagen commented Dec 25, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants