apodization
v2.0.0
Published
window function applier and some shapes
Downloads
1
Readme
window-functions
window function applier and some shapes.
Installation
$ npm i window-functions
Usage
It is possible to import the functions directly. Those function accepts an object with options and returns a function (i: number) => number to avoid constants calculation for each call.
import { lorentzToGauss } from 'apodization';
const gm = lorentzToGauss({ gaussianHz: 0.2, exponentialHz: 0, center: 0.5, length: 500, dw = 0.01 });
const value = gm(250); //returns the max value of the gaussian;
Current supported shapes:
It is possible to apply a window function directly to data (number[]). It does not change the original data by default but it is possible to pass an array in output
property.
import { applyWindow, exponential } from 'apodization';
const data = [1,2,3,4,5];
const exponentialFunc = exponential({ dw: 0.1, lb: 0.2, start: 0 })
const result = applyWindow(data, {
func: exponential,
start: 0,
output: data //inplace modification
});
It is possible to call a window function by:
import { getFunction } from 'apodization';
const shapeOptions = {
dw = 0.01,
center: 0.5,
length: 500,
gaussianHz: 0.2,
exponentialHz: 0,
};
const func = getFunction({
kind: 'lorentzToGauss',
...shapeOptions,
});
console.log(func(250)); //value of window function of index 250