JSPM

  • Created
  • Published
  • Downloads 1607
  • Score
    100M100P100Q112790F
  • License MIT

Global Spectra Deconvolution

Package Exports

  • ml-gsd
  • ml-gsd/src/gsd
  • ml-gsd/src/post/broadenPeaks

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ml-gsd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

global-spectral-deconvolution

NPM version build status Test coverage npm download

Global Spectra Deconvolution + Peak optimizer

gsdis using an algorithm that is searching for inflection points to determine the position of peaks and the width of the peaks are between the 2 inflection points. The result of GSD yield to an array of object containing {x, y and width}. However this width is based on the inflection point and may be different from the 'fwhm' (Full Width Half Maximum).

The second algorithm (optimizePeaks) will optimize the width as a FWHM to match the original peak. After optimization the width with therefore be always FWHM whichever is the function used.

API documentation

Parameters

minMaxRatio=0.00025 (0-1)

Threshold to determine if a given peak should be considered as a noise, bases on its relative height compared to the highest peak.

broadRatio=0.00 (0-1)

If broadRatio is higher than 0, then all the peaks which second derivative smaller than broadRatio * maxAbsSecondDerivative will be marked with the soft mask equal to true.

noiseLevel=0 (-inf, inf)

Noise threshold in spectrum units

maxCriteria=true [true||false]

Peaks are local maximum(true) or minimum(false)

smoothY=true [true||false]

Select the peak intensities from a smoothed version of the independent variables?

realTopDetection=false [true||false]

Use a quadratic optimizations with the peak and its 3 closest neighbors to determine the true x,y values of the peak?

sgOptions={windowSize: 5, polynomial: 3}

Savitzky-Golay parameters. windowSize should be odd; polynomial is the degree of the polynomial to use in the approximations. It should be bigger than 2.

heightFactor=0

Factor to multiply the calculated height (usually 2).

derivativeThreshold=0

Filters based on the amplitude of the first derivative

Post methods

GSD.broadenPeaks(peakList, {factor=2, overlap=false})

We enlarge the peaks and add the properties from and to. By default we enlarge of a factor 2 and we don't allow overlap.

GSD.joinBroadPeaks

GSD.optimizePeaks

Example

import { IsotopicDistribution } from 'mf-global';
import { gsd, optimizePeaks } from '../src';

// generate a sample spectrum of the form {x:[], y:[]}
const data = new IsotopicDistribution('C').getGaussian();

let peaks = gsd(data, {
  noiseLevel: 0,
  minMaxRatio: 0.00025, // Threshold to determine if a given peak should be considered as a noise
  realTopDetection: true,
  maxCriteria: true, // inverted:false
  smoothY: false,
  sgOptions: { windowSize: 7, polynomial: 3 },
});
console.log(peaks); // array of peaks {x,y,width}, width = distance between inflection points
// GSD

let optimized = optimizePeaks(data, peaks);
console.log(optimized); // array of peaks {x,y,width}, width = FWHM

License

MIT