ml-peak-shape-generator
Advanced tools
Comparing version 3.0.0 to 3.0.1
# Changelog | ||
### [3.0.1](https://www.github.com/mljs/peak-shape-generator/compare/v3.0.0...v3.0.1) (2021-11-17) | ||
### Bug Fixes | ||
* add Abstract class to shapes ([06b5ab8](https://www.github.com/mljs/peak-shape-generator/commit/06b5ab89b8a3962e80b6c57251ea3b749c2eb16b)) | ||
## [3.0.0](https://www.github.com/mljs/peak-shape-generator/compare/v2.0.2...v3.0.0) (2021-11-17) | ||
@@ -4,0 +11,0 @@ |
import { ROOT_2LN2, GAUSSIAN_EXP_FACTOR, ROOT_PI_OVER_LN2, } from '../../../util/constants'; | ||
import erfinv from '../../../util/erfinv'; | ||
export class Gaussian { | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
export class Gaussian extends Shape1DClass { | ||
constructor(options = {}) { | ||
super(); | ||
const { fwhm = 500, sd } = options; | ||
@@ -6,0 +8,0 @@ this.fwhm = sd ? Gaussian.widthToFWHM(2 * sd) : fwhm; |
import { ROOT_THREE } from '../../../util/constants'; | ||
export class Lorentzian { | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
export class Lorentzian extends Shape1DClass { | ||
constructor(options = {}) { | ||
super(); | ||
const { fwhm = 500 } = options; | ||
@@ -5,0 +7,0 @@ this.fwhm = fwhm; |
import { GAUSSIAN_EXP_FACTOR, ROOT_2LN2_MINUS_ONE, ROOT_PI_OVER_LN2, } from '../../../util/constants'; | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
import { Gaussian } from '../gaussian/Gaussian'; | ||
import { Lorentzian } from '../lorentzian/Lorentzian'; | ||
export class PseudoVoigt { | ||
export class PseudoVoigt extends Shape1DClass { | ||
constructor(options = {}) { | ||
super(); | ||
const { fwhm = 500, mu = 0.5 } = options; | ||
@@ -7,0 +9,0 @@ this.mu = mu; |
import { GAUSSIAN_EXP_FACTOR } from '../../../util/constants'; | ||
import { Gaussian } from '../../1d/gaussian/Gaussian'; | ||
export class Gaussian2D { | ||
import { Shape2DClass } from '../Shape2DClass'; | ||
export class Gaussian2D extends Shape2DClass { | ||
// /** | ||
@@ -9,2 +10,3 @@ // * The maximum z value of the shape, default keep surface equal 1. | ||
constructor(options = {}) { | ||
super(); | ||
let { fwhm = 50, sd } = options; | ||
@@ -11,0 +13,0 @@ fwhm = ensureFWHM2D(fwhm, sd); |
import type { GetData1DOptions } from '../../../types/GetData1DOptions'; | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
interface ICalculateHeight { | ||
@@ -36,3 +37,3 @@ fwhm?: number; | ||
} | ||
export declare class Gaussian { | ||
export declare class Gaussian extends Shape1DClass { | ||
/** | ||
@@ -39,0 +40,0 @@ * Full width at half maximum. |
@@ -9,4 +9,6 @@ "use strict"; | ||
const erfinv_1 = __importDefault(require("../../../util/erfinv")); | ||
class Gaussian { | ||
const Shape1DClass_1 = require("../Shape1DClass"); | ||
class Gaussian extends Shape1DClass_1.Shape1DClass { | ||
constructor(options = {}) { | ||
super(); | ||
const { fwhm = 500, sd } = options; | ||
@@ -13,0 +15,0 @@ this.fwhm = sd ? Gaussian.widthToFWHM(2 * sd) : fwhm; |
import { GetData1DOptions } from '../../../types/GetData1DOptions'; | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
export interface ILorentzianClassOptions { | ||
@@ -21,3 +22,3 @@ /** | ||
} | ||
export declare class Lorentzian { | ||
export declare class Lorentzian extends Shape1DClass { | ||
/** | ||
@@ -24,0 +25,0 @@ * Full width at half maximum. |
@@ -5,4 +5,6 @@ "use strict"; | ||
const constants_1 = require("../../../util/constants"); | ||
class Lorentzian { | ||
const Shape1DClass_1 = require("../Shape1DClass"); | ||
class Lorentzian extends Shape1DClass_1.Shape1DClass { | ||
constructor(options = {}) { | ||
super(); | ||
const { fwhm = 500 } = options; | ||
@@ -9,0 +11,0 @@ this.fwhm = fwhm; |
import { GetData1DOptions } from '../../../types/GetData1DOptions'; | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
export interface IPseudoVoigtClassOptions { | ||
@@ -36,3 +37,3 @@ /** | ||
} | ||
export declare class PseudoVoigt { | ||
export declare class PseudoVoigt extends Shape1DClass { | ||
/** | ||
@@ -39,0 +40,0 @@ * Full width at half maximum. |
@@ -5,6 +5,8 @@ "use strict"; | ||
const constants_1 = require("../../../util/constants"); | ||
const Shape1DClass_1 = require("../Shape1DClass"); | ||
const Gaussian_1 = require("../gaussian/Gaussian"); | ||
const Lorentzian_1 = require("../lorentzian/Lorentzian"); | ||
class PseudoVoigt { | ||
class PseudoVoigt extends Shape1DClass_1.Shape1DClass { | ||
constructor(options = {}) { | ||
super(); | ||
const { fwhm = 500, mu = 0.5 } = options; | ||
@@ -11,0 +13,0 @@ this.mu = mu; |
import { GetData1DOptions } from '../../types/GetData1DOptions'; | ||
export declare abstract class Shape1DClass { | ||
abstract height: number; | ||
abstract fwhm: number; | ||
@@ -8,5 +7,5 @@ abstract fwhmToWidth(fwhm: number): number; | ||
abstract fct(x: number): number; | ||
abstract getArea(): number; | ||
abstract getArea(height?: number): number; | ||
abstract getFactor(area?: number): number; | ||
abstract getData(options: GetData1DOptions): Float64Array; | ||
} |
import type { GetData2DOptions } from '../../../types/GetData2DOptions'; | ||
import { Shape2DClass } from '../Shape2DClass'; | ||
export interface XYNumber { | ||
@@ -39,3 +40,3 @@ x: number; | ||
} | ||
export declare class Gaussian2D { | ||
export declare class Gaussian2D extends Shape2DClass { | ||
/** | ||
@@ -42,0 +43,0 @@ * Full width at half maximum. |
@@ -6,3 +6,4 @@ "use strict"; | ||
const Gaussian_1 = require("../../1d/gaussian/Gaussian"); | ||
class Gaussian2D { | ||
const Shape2DClass_1 = require("../Shape2DClass"); | ||
class Gaussian2D extends Shape2DClass_1.Shape2DClass { | ||
// /** | ||
@@ -13,2 +14,3 @@ // * The maximum z value of the shape, default keep surface equal 1. | ||
constructor(options = {}) { | ||
super(); | ||
let { fwhm = 50, sd } = options; | ||
@@ -15,0 +17,0 @@ fwhm = ensureFWHM2D(fwhm, sd); |
import { XYNumber } from './gaussian2D/Gaussian2D'; | ||
export interface GetData2DOptions { | ||
height?: number; | ||
length?: number | XYNumber; | ||
@@ -9,9 +10,8 @@ factor?: number | XYNumber; | ||
abstract fwhmY: number; | ||
abstract height: number; | ||
abstract fwhmToWidth(fwhm: number): number; | ||
abstract widthToFWHM(width: number): number; | ||
abstract fct(x: number, y: number): number; | ||
abstract getSurface(): number; | ||
abstract getSurface(height?: number): number; | ||
abstract getFactor(area?: number): number; | ||
abstract getData(options: GetData2DOptions): Float64Array[]; | ||
} |
{ | ||
"name": "ml-peak-shape-generator", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Generate various peak shapes", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -8,2 +8,3 @@ import type { GetData1DOptions } from '../../../types/GetData1DOptions'; | ||
import erfinv from '../../../util/erfinv'; | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
// import { Shape1DClass } from '../Shape1DClass'; | ||
@@ -48,3 +49,3 @@ | ||
export class Gaussian { | ||
export class Gaussian extends Shape1DClass { | ||
/** | ||
@@ -57,2 +58,3 @@ * Full width at half maximum. | ||
public constructor(options: IGaussianClassOptions = {}) { | ||
super(); | ||
const { fwhm = 500, sd } = options; | ||
@@ -59,0 +61,0 @@ |
import { GetData1DOptions } from '../../../types/GetData1DOptions'; | ||
import { ROOT_THREE } from '../../../util/constants'; | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
@@ -25,3 +26,3 @@ export interface ILorentzianClassOptions { | ||
export class Lorentzian { | ||
export class Lorentzian extends Shape1DClass { | ||
/** | ||
@@ -34,2 +35,3 @@ * Full width at half maximum. | ||
public constructor(options: ILorentzianClassOptions = {}) { | ||
super(); | ||
const { fwhm = 500 } = options; | ||
@@ -36,0 +38,0 @@ |
@@ -7,2 +7,3 @@ import { GetData1DOptions } from '../../../types/GetData1DOptions'; | ||
} from '../../../util/constants'; | ||
import { Shape1DClass } from '../Shape1DClass'; | ||
import { Gaussian } from '../gaussian/Gaussian'; | ||
@@ -48,3 +49,3 @@ import { Lorentzian } from '../lorentzian/Lorentzian'; | ||
export class PseudoVoigt { | ||
export class PseudoVoigt extends Shape1DClass { | ||
/** | ||
@@ -62,2 +63,3 @@ * Full width at half maximum. | ||
public constructor(options: IPseudoVoigtClassOptions = {}) { | ||
super(); | ||
const { fwhm = 500, mu = 0.5 } = options; | ||
@@ -64,0 +66,0 @@ |
import { GetData1DOptions } from '../../types/GetData1DOptions'; | ||
export abstract class Shape1DClass { | ||
public abstract height: number; | ||
public abstract fwhm: number; | ||
@@ -10,5 +9,5 @@ | ||
public abstract fct(x: number): number; | ||
public abstract getArea(): number; | ||
public abstract getArea(height?: number): number; | ||
public abstract getFactor(area?: number): number; | ||
public abstract getData(options: GetData1DOptions): Float64Array; | ||
} |
import type { GetData2DOptions } from '../../../types/GetData2DOptions'; | ||
import { GAUSSIAN_EXP_FACTOR } from '../../../util/constants'; | ||
import { Gaussian } from '../../1d/gaussian/Gaussian'; | ||
import { Shape2DClass } from '../Shape2DClass'; | ||
@@ -46,3 +47,3 @@ export interface XYNumber { | ||
export class Gaussian2D { | ||
export class Gaussian2D extends Shape2DClass { | ||
/** | ||
@@ -61,2 +62,3 @@ * Full width at half maximum. | ||
public constructor(options: IGaussian2DClassOptions = {}) { | ||
super(); | ||
let { fwhm = 50, sd } = options; | ||
@@ -63,0 +65,0 @@ |
import { XYNumber } from './gaussian2D/Gaussian2D'; | ||
export interface GetData2DOptions { | ||
height?: number; | ||
length?: number | XYNumber; | ||
@@ -11,3 +12,2 @@ factor?: number | XYNumber; | ||
public abstract fwhmY: number; | ||
public abstract height: number; | ||
@@ -17,5 +17,5 @@ public abstract fwhmToWidth(fwhm: number): number; | ||
public abstract fct(x: number, y: number): number; | ||
public abstract getSurface(): number; | ||
public abstract getSurface(height?: number): number; | ||
public abstract getFactor(area?: number): number; | ||
public abstract getData(options: GetData2DOptions): Float64Array[]; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144778
2486