$ npm install --save ir-spectrum
import IRSpectrum from 'ir-spectrum';
let analysis = IRSpectrum.fromJcamp(jcamp);When loading an IR spectrum from JCAMP or SPC, two additional variables are systematically added:
| Key | Label | Units | Description | Always present |
|---|---|---|---|---|
| x | Wavenumber | cm⁻¹ | Infrared wavenumber | Yes |
| y | (from source file) | Original y-axis data | Yes | |
| a | Absorbance | Absorbance values | Yes | |
| t | Transmittance | % | Percent transmittance values | Yes |
The conversion is automatic: if the original y label contains "transmittance", absorbance is calculated; if it contains "absorbance", transmittance is calculated. For transmittance, the presence of '%' or 'percent' in the label is used to determine the scaling factor.
<select name="selector.variables">
<option value="a vs x">Absorbance versus wavenumber</option>
<option value="t vs x">Transmittance versus wavenumber</option>
</select>