Package Exports
- ml-peak-shape-generator
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-peak-shape-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ml-peak-shape-generator
Peak shape generator, the current kind of shapes supported are:
Name | Equation |
---|---|
Gaussian | |
Lorentzian | |
Pseudo Voigt |
where
Installation
$ npm i ml-peak-shape-generator
Usage
import { Gaussian, Lorentzian, PseudoVoigt} from 'ml-peak-shape-generator';
// It's possible to specify the windows size with factor option
let data = new Gaussian({factor: 3.5, sd: 500}).getData();
// or fix the number of points as Full Width at Half Maximum
let data = new Gaussian({factor: 3.5, fwhm: 500}).getData();
// It's possible to specify the windows size with factor option
let data = new Loretzian({factor: 5, fwhm: 500}).getData();
// It's possible to specify the windows size with factor option
let data = new PseudoVoigt({{factor: 5, fwhm: 500}}).getData();
import { getShapeGenerator } from 'ml-peak-shape-generator';
// If you want to dynamically select a shape you can use the `getShapeGenerator` method. It returns a instance of required kind of shape.
let shapeGenerator = getShapeGenerator('lorentzian', {factor: 3.5, sd: 500});
It is also possible to get a function that allows to calculate y for any x
import { Gaussian } from 'ml-peak-shape-generator';
const func = Gaussian.fct(x - mean, fwhm);