ml-peak-shape-generator
Advanced tools
Comparing version 4.0.1 to 4.0.2
# Changelog | ||
### [4.0.2](https://www.github.com/mljs/peak-shape-generator/compare/v4.0.1...v4.0.2) (2022-01-23) | ||
### Bug Fixes | ||
* update dependencies ([edd036f](https://www.github.com/mljs/peak-shape-generator/commit/edd036f1d7291cde8408f6ea8073e807883880e3)) | ||
### [4.0.1](https://www.github.com/mljs/peak-shape-generator/compare/v4.0.0...v4.0.1) (2021-11-26) | ||
@@ -4,0 +11,0 @@ |
@@ -5,6 +5,6 @@ import type { Gaussian2DClassOptions } from './gaussian2D/Gaussian2D'; | ||
*/ | ||
interface IGaussianShape2D extends Gaussian2DClassOptions { | ||
interface GaussianShape2D extends Gaussian2DClassOptions { | ||
kind: 'gaussian'; | ||
} | ||
export declare type Shape2D = IGaussianShape2D; | ||
export declare type Shape2D = GaussianShape2D; | ||
export {}; |
{ | ||
"name": "ml-peak-shape-generator", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Generate various peak shapes", | ||
@@ -60,15 +60,15 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^27.0.3", | ||
"@types/jest": "^27.4.0", | ||
"compute-erfinv": "^3.0.1", | ||
"eslint": "^8.3.0", | ||
"eslint-config-cheminfo-typescript": "^10.2.4", | ||
"jest": "^27.3.1", | ||
"prettier": "^2.5.0", | ||
"eslint": "^8.7.0", | ||
"eslint-config-cheminfo-typescript": "^10.3.0", | ||
"jest": "^27.4.7", | ||
"prettier": "^2.5.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^27.0.7", | ||
"typescript": "^4.5.2" | ||
"ts-jest": "^27.1.3", | ||
"typescript": "^4.5.5" | ||
}, | ||
"dependencies": { | ||
"cheminfo-types": "^0.8.0" | ||
"cheminfo-types": "^0.9.1" | ||
} | ||
} |
@@ -8,3 +8,2 @@ # ml-peak-shape-generator | ||
Generate various peak shapes. | ||
@@ -14,6 +13,6 @@ | ||
| Name | Equation | | ||
| ------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| Gaussian | <img src="https://tex.cheminfo.org/?tex=y%5Ccdot%20exp%5Cleft%5B-%5Cfrac%7B1%7D%7B2%7D%5Cfrac%7B%5Cdelta%7D%7B%5Csigma%5E2%7D%5Cright%5D"/> | | ||
| Lorentzian | <img src="https://tex.cheminfo.org/?tex=y%5Ccdot%5Cfrac%7B%5Comega%5E2%7D%7B4%5Cdelta%20%2B%20%5Comega%5E2%7D"/> | | ||
| Name | Equation | | ||
| ------------ | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| Gaussian | <img src="https://tex.cheminfo.org/?tex=y%5Ccdot%20exp%5Cleft%5B-%5Cfrac%7B1%7D%7B2%7D%5Cfrac%7B%5Cdelta%7D%7B%5Csigma%5E2%7D%5Cright%5D"/> | | ||
| Lorentzian | <img src="https://tex.cheminfo.org/?tex=y%5Ccdot%5Cfrac%7B%5Comega%5E2%7D%7B4%5Cdelta%20%2B%20%5Comega%5E2%7D"/> | | ||
| Pseudo Voigt | <img src="https://tex.cheminfo.org/?tex=y%20%5Ccdot%5Cleft%5Bx_g%5Ccdot%20exp%5Cleft%5B-%5Cfrac%7B1%7D%7B2%7D%5Cfrac%7B%5Cdelta%7D%7B%5Csigma%5E2%7D%5Cright%5D%20%2B%20x_l%5Ccdot%5Cfrac%7B%5Comega%5E2%7D%7B4%5Cdelta%20%2B%20%5Comega%5E2%7D%5Cright%5D"/> | | ||
@@ -23,4 +22,4 @@ | ||
| <img src="https://tex.cheminfo.org/?tex=%5Cdelta%20%3D%20%5Cleft(t%20-%20x%5Cright)%5E2%0A"/> | <img src="https://tex.cheminfo.org/?tex=%5Csigma%20%3D%20%5Cfrac%7Bwidth%7D%7B2%5Csqrt%7B2%20%5Ccdot%20ln(2)%7D%7D"/> | <img src="https://tex.cheminfo.org/?tex=%5Comega%20%3D%20width"/>| | ||
| --------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------- | | ||
| <img src="https://tex.cheminfo.org/?tex=%5Cdelta%20%3D%20%5Cleft(t%20-%20x%5Cright)%5E2%0A"/> | <img src="https://tex.cheminfo.org/?tex=%5Csigma%20%3D%20%5Cfrac%7BFWHM%7D%7B2%5Csqrt%7B2%20%5Ccdot%20ln(2)%7D%7D"/> | <img src="https://tex.cheminfo.org/?tex=%5Comega%20%3D%20FWHM"/> | | ||
| --------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------- | | ||
@@ -34,14 +33,18 @@ ## Installation | ||
```js | ||
import { gaussian, lorentzian, pseudoVoigt} from 'ml-peak-shape-generator'; | ||
import { | ||
getGaussianData, | ||
getLorentzianData, | ||
getPseudoVoigtData, | ||
} from 'ml-peak-shape-generator'; | ||
// It's possible to specify the windows size with factor option | ||
let data = gaussian.getData({factor: 3.5, sd: 500}); | ||
let data = getGaussianData({ sd: 500 }, { factor: 3.5 }); | ||
// or fix the number of points as Full Width at Half Maximum | ||
let data = gaussian.getData({factor: 3.5, fwhm: 500}); | ||
let data = getGaussianData({ fwhm: 500 }, { factor: 3.5 }); | ||
// It's possible to specify the windows size with factor option | ||
let data = loretzian.getData({factor: 5, fwhm: 500}); | ||
let data = getLorentzianData({ fwhm: 500 }, { factor: 5 }); | ||
// It's possible to specify the windows size with factor option | ||
let data = pseudoVoigt.getData({factor: 5, fwhm: 500}); | ||
let data = getPseudoVoigtData({ fwhm: 500 }, { factor: 5 }); | ||
``` | ||
@@ -52,14 +55,13 @@ | ||
```js | ||
import { gaussian, gaussian2D } from 'ml-peak-shape-shape'; | ||
import { Gaussian, gaussianFct, Gaussian2D } from 'ml-peak-shape-shape'; | ||
const gaussianShape = new gaussian.Gaussian({ fwhm: 500, factor: 3.5, height: 1}); | ||
// It is possible to set a new value for fwhm and height | ||
const gaussianShape = new Gaussian({ fwhm: 500 }); | ||
// It is possible to set a new value for fwhm | ||
gaussianShape.fwhm = 300; | ||
gaussianShape.height = 2; | ||
// By default the height value ensure a surface/area equal 1. | ||
const gaussian2DShape = new gaussian2D.Gaussian2D({ fwhm: 500, factor: 3.5}); | ||
// By default the height value ensure a volume equal 1. | ||
const gaussian2DShape = new Gaussian2D({ fwhm: 500 }); | ||
// It is possible to set values for sd, fwhm and factor for each axes. | ||
const gaussian2DShape = new gaussian2D.Gaussian2D({ fwhm: { x: 300, y: 500 }, factor: 3.5}); | ||
const gaussian2DShape = new Gaussian2D({ fwhm: { x: 300, y: 500 } }); | ||
@@ -71,8 +73,10 @@ // It is possible to set new value for fwhm by: | ||
//An instance of any shape has the same methods accessible for each | ||
//An instance of any shape has the same methods accessible for each | ||
//shape e.g. fct or getData, but these use the internal parameters. e.g: | ||
const gaussianShape = new gaussian.Gaussian({ fwhm: 500 }); | ||
const gaussianShape = new Gaussian({ fwhm: 500 }); | ||
gaussianShape.fct(5); | ||
gaussian.fct(5, 500); | ||
gaussianFct(5, 500); | ||
// getData | ||
gaussianShape.getData({ factor: 3.5 }); | ||
``` | ||
@@ -85,4 +89,4 @@ | ||
let shapeGenerator = getShape1D('lorentzian', {factor: 3.5, sd: 500}); | ||
let shapeGenerator = getShape2D('gaussian2D', {factor: 3.5, sd: 500}); | ||
let shapeGenerator = getShape1D({ kind: 'lorentzian', sd: 500 }); | ||
let shapeGenerator = getShape2D({ kind: 'gaussian', sd: 500 }); | ||
``` | ||
@@ -93,4 +97,4 @@ | ||
```js | ||
import { gaussian } from 'ml-peak-shape-generator'; | ||
const func = gaussian.fct(x - mean, fwhm); | ||
import { gaussianFct } from 'ml-peak-shape-generator'; | ||
const func = gaussianFct(x - mean, fwhm); | ||
``` | ||
@@ -111,2 +115,2 @@ | ||
[download-image]: https://img.shields.io/npm/dm/ml-peak-shape-generator.svg | ||
[download-url]: https://www.npmjs.com/package/ml-peak-shape-generator | ||
[download-url]: https://www.npmjs.com/package/ml-peak-shape-generator |
@@ -6,6 +6,6 @@ import type { Gaussian2DClassOptions } from './gaussian2D/Gaussian2D'; | ||
*/ | ||
interface IGaussianShape2D extends Gaussian2DClassOptions { | ||
interface GaussianShape2D extends Gaussian2DClassOptions { | ||
kind: 'gaussian'; | ||
} | ||
export type Shape2D = IGaussianShape2D; | ||
export type Shape2D = GaussianShape2D; |
127775
108
+ Addedcheminfo-types@0.9.1(transitive)
- Removedcheminfo-types@0.8.0(transitive)
Updatedcheminfo-types@^0.9.1