Skip to content

Commit

Permalink
fix: peak shape drawing (#1767)
Browse files Browse the repository at this point in the history
* chore: change default shape to Lorentzian.

close: #1747

* chore: pass from-to to peakToXY

close: #1746
  • Loading branch information
jobo322 committed Sep 23, 2022
1 parent 53abe16 commit 90a75a7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
26 changes: 18 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -76,7 +76,7 @@
"nmr-correlation": "^2.3.3",
"nmr-load-save": "^0.2.1",
"nmr-parser": "^2.0.1",
"nmr-processing": "^9.1.0",
"nmr-processing": "^9.2.0",
"nmredata": "^0.7.1",
"numeral": "^2.0.6",
"openchemlib": "^8.0.1",
Expand Down Expand Up @@ -127,4 +127,4 @@
"typescript": "~4.8.3",
"vite": "^3.1.1"
}
}
}
1 change: 0 additions & 1 deletion src/component/1d/peaks/PeaksShapes.tsx
Expand Up @@ -46,7 +46,6 @@ function PeaksShapesItems(props: { vAlign: number }) {
{' '}
{spectrum.peaks.values.map((peak) => {
const { fill, path } = getPath({ target: 'peakShape', peak });

return (
<path
key={peak.id}
Expand Down
8 changes: 6 additions & 2 deletions src/component/1d/peaks/usePeakShapesPath.ts
Expand Up @@ -25,16 +25,20 @@ export function usePeakShapesPath(spectrum: Datum1D) {
} {
const { target } = options;

const frequency = spectrum.info.originFrequency;
let pathSeries: DataXY<DoubleArray> | null = null;
switch (target) {
case 'peakShape':
pathSeries = peakToXY(options.peak, {
frequency: spectrum.info.originFrequency,
frequency,
nbPoints: 1024,
from: options.peak.x - (options.peak.width / frequency) * 9,
to: options.peak.x + (options.peak.width / frequency) * 9,
});
break;
case 'peaksSum':
pathSeries = peaksToXY(options.peaks, {
frequency: spectrum.info.originFrequency,
frequency,
nbPoints: width,
from: xDomain[0],
to: xDomain[1],
Expand Down
1 change: 1 addition & 0 deletions src/data/data1d/Spectrum1D/peaks/autoPeakPicking.ts
Expand Up @@ -30,6 +30,7 @@ export function autoPeakPicking(datum1D: Datum1D, options) {
{
frequency,
direction,
shape: { kind: 'lorentzian' },
noiseLevel: noise * noiseFactor,
minMaxRatio, // Threshold to determine if a given peak should be considered as a noise
realTopDetection: true,
Expand Down
1 change: 1 addition & 0 deletions src/data/data1d/Spectrum1D/ranges/autoRangesDetection.ts
Expand Up @@ -4,6 +4,7 @@ import { Datum1D, Range } from '../../../types/data1d';

const defaultPeakPickingOptions = {
minMaxRatio: 1,
shape: { kind: 'lorentzian' },
realTopDetection: true,
maxCriteria: true,
smoothY: false,
Expand Down

0 comments on commit 90a75a7

Please sign in to comment.