Socket
Book a DemoInstallSign in
Socket

apodization

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apodization

window function applier and some shapes

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

window-functions

NPM version build status Test coverage npm download

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:

Exponential Lorentz to gauss

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

License

MIT

FAQs

Package last updated on 19 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.