UNPKG

ml-gsd

Version:
14 lines 504 B
import { getShape1D } from 'ml-peak-shape-generator'; const { parse, stringify } = JSON; /** * Append 2 properties to the peaks, shape and fwhm */ export function setShape(peaks, options = {}) { const { shape = { kind: 'gaussian' }, output = parse(stringify(peaks)), } = options; const shapeInstance = getShape1D(shape); return output.map((peak) => ({ ...peak, shape: { fwhm: shapeInstance.widthToFWHM(peak.width), ...shape }, })); } //# sourceMappingURL=setShape.js.map