Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

cheminfo-js/ir-spectrum

Repository files navigation

This project was archived. Future developements are done on cheminfo/ir-spectrum

ir-spectrum

NPM version build status Test coverage npm download

.

Installation

$ npm install --save ir-spectrum

Usage

import IRSpectrum from 'ir-spectrum';

let spectrum = IRSpectrum.fromJcamp(jcamp);

// let spectrum = IRSpectrum.fromText(jcamp);

spectrum.setPeaks([]);

// if optimize is true, peak picking will find the best peak close to wavelength
spectrum.peakPicking(wavelength, { range: 0, optimize: true });
console.log(spectrum.peaks());

spectrum.autoPeakPicking({
  fromWavelength: 1500,
  toWavelength: 4000,
  noiseLvel: 0.01
});

// you may selecdt how you would like to retrieve the data
// there are 3 modes: ABSORBANCE, TRANSMITTANCE or PERCENT_TRANSMITTANCE
// those methods are very practical in coordination with www.jsgraph.org
spectrum.setMode(IRSpectrum.ABSORBANCE);
let annotations = spectrum.getAnnotations();
let data = spectrum.getData();

License

MIT