diff --git a/src/GSDPeak.ts b/src/GSDPeak.ts index ffd0177..27e726b 100644 --- a/src/GSDPeak.ts +++ b/src/GSDPeak.ts @@ -1,5 +1,3 @@ -import { Shape1D } from 'ml-peak-shape-generator'; - export interface GSDPeak { id?: string; x: number; @@ -18,8 +16,6 @@ export interface GSDPeak { */ ddY: number; - shape: Shape1D; - inflectionPoints: { from: { x: number; index: number }; to: { x: number; index: number }; diff --git a/src/gsd.ts b/src/gsd.ts index 5be2fa5..08c47c1 100644 --- a/src/gsd.ts +++ b/src/gsd.ts @@ -11,7 +11,6 @@ import { import { GSDPeak } from './GSDPeak'; import { MakeMandatory } from './utils/MakeMandatory'; -import { MakeOptional } from './utils/MakeOptional'; import { optimizeTop } from './utils/optimizeTop'; export interface GSDOptions { @@ -49,7 +48,7 @@ export interface GSDOptions { realTopDetection?: boolean; } export type GSDPeakID = MakeMandatory; -export type GSDPeakIDOptionalShape = MakeOptional; + /** * Global spectra deconvolution * @param data - Object data with x and y arrays. Values in x has to be growing @@ -213,7 +212,7 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] { let lastK = -1; - const peaks: GSDPeakIDOptionalShape[] = []; + const peaks: GSDPeakID[] = []; for (const minddYIndex of minddY) { let deltaX = x[minddYIndex]; let possible = -1; @@ -271,5 +270,5 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] { return a.x - b.x; }); - return peaks as GSDPeakID[]; + return peaks; } diff --git a/src/post/broadenPeaks.ts b/src/post/broadenPeaks.ts index 7435981..0449f07 100644 --- a/src/post/broadenPeaks.ts +++ b/src/post/broadenPeaks.ts @@ -2,9 +2,8 @@ import { getShape1D, Shape1D } from 'ml-peak-shape-generator'; import { GSDBroadenPeak } from '../GSDBroadenPeak'; import { GSDPeak } from '../GSDPeak'; -import { MakeOptional } from '../utils/MakeOptional'; -type GSDPeakOptionalShape = MakeOptional; +type GSDPeakOptionalShape = GSDPeak & { shape?: Shape1D }; type GSDBroadenPeakWithID = GSDBroadenPeak & { id: string }; type GSDBroadenPeakWithShape = GSDBroadenPeak & { shape: Shape1D }; diff --git a/src/post/joinBroadPeaks.ts b/src/post/joinBroadPeaks.ts index fd8e257..714e97b 100644 --- a/src/post/joinBroadPeaks.ts +++ b/src/post/joinBroadPeaks.ts @@ -4,7 +4,6 @@ import { OptimizationOptions } from 'ml-spectra-fitting'; import { GSDPeak } from '../GSDPeak'; import { GSDPeakOptimized } from '../GSDPeakOptimized'; -import { MakeOptional } from '../utils/MakeOptional'; import { addMissingIDs } from '../utils/addMissingIDs'; import { addMissingShape } from '../utils/addMissingShape'; @@ -36,7 +35,7 @@ export interface JoinBroadPeaksOptions { * This function tries to join the peaks that seems to belong to a broad signal in a single broad peak. */ -export type GSDPeakOptionalShape = MakeOptional; +export type GSDPeakOptionalShape = GSDPeak & { shape?: Shape1D }; export function joinBroadPeaks( peakList: T[],