Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve manual range picking and fix simulation of diagonal peaks in COSY prediction #3308

281 changes: 281 additions & 0 deletions public/data/brukerFolders/hsqcBrukerFilters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
{
"version": 7,
"data": {
"source": {
"entries": [
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/acqu"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/acqu2"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/acqu2s"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/acqus"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/pdata/1/proc"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/pdata/1/proc2"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/pdata/1/proc2s"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/pdata/1/procs"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/2/ser"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/acqu"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/acqu2"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/acqu2s"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/acqus"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/pdata/1/proc"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/pdata/1/proc2"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/pdata/1/proc2s"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/pdata/1/procs"
},
{
"baseURL": "", "relativePath": "data/brukerFolders/cosyAndHsqcFid/3/ser"
}
]
},
"spectra": [
{
"id": "1349b256-7a33-4d90-9c7f-cc2e43f3be89",
"meta": {},
"filters": [
{
"name": "apodizationDimension1",
"value": {
"exponential": {
"apply": false,
"options": { "lineBroadening": 0.3 }
},
"sineBell": { "apply": false, "options": { "offset": 0.5 } },
"sineSquare": { "apply": true, "options": { "offset": 0.5 } },
"traf": { "apply": false, "options": { "lineBroadening": 0.3 } },
"gaussian": {
"apply": false,
"options": { "lineBroadening": 0.3, "lineBroadeningCenter": 0 }
}
},
"enabled": true,
"id": "b2567a33-4d90-4c7f-8c2e-43f3be893962"
},
{
"name": "zeroFillingDimension1",
"value": { "nbPoints": 1024 },
"enabled": true,
"id": "567a334d-905c-4fcc-ae43-f3be8939623c"
},
{
"name": "fftDimension1",
"value": {},
"enabled": true,
"id": "7a334d90-5c7f-4c2e-83f3-be8939623c3d"
},
{
"name": "apodizationDimension2",
"value": {
"exponential": {
"apply": false,
"options": { "lineBroadening": 0.3 }
},
"sineBell": { "apply": false, "options": { "offset": 0.5 } },
"sineSquare": { "apply": true, "options": { "offset": 0.5 } },
"traf": { "apply": false, "options": { "lineBroadening": 0.3 } },
"gaussian": {
"apply": false,
"options": { "lineBroadening": 0.3, "lineBroadeningCenter": 0 }
}
},
"enabled": true,
"id": "334d905c-7fcc-4e43-b3be-8939623c3d36"
},
{
"name": "zeroFillingDimension2",
"value": { "nbPoints": 1024 },
"enabled": true,
"id": "4d905c7f-cc2e-43f3-be89-39623c3d3670"
},
{
"name": "fftDimension2",
"value": {},
"enabled": true,
"id": "905c7fcc-2e43-43be-8939-623c3d367007"
},
{
"name": "phaseCorrectionTwoDimensions",
"value": {
"horizontal": { "ph0": 33.84521484375, "ph1": -5.625 },
"vertical": { "ph0": -15.28564453125, "ph1": 33.75 }
},
"enabled": true,
"id": "5c7fcc2e-43f3-4e89-b962-3c3d36700728"
}
],
"info": {},
"display": {
"isPositiveVisible": true,
"isNegativeVisible": true,
"isVisible": true,
"contourOptions": {
"positive": { "contourLevels": [47, 100], "numberOfLayers": 10 },
"negative": { "contourLevels": [47, 100], "numberOfLayers": 10 }
},
"dimension": 2,
"negativeColor": "yellow",
"positiveColor": "black"
},
"data": {},
"sourceSelector": {
"files": [
"data/brukerFolders/cosyAndHsqcFid/3/acqu2s",
"data/brukerFolders/cosyAndHsqcFid/3/acqus",
"data/brukerFolders/cosyAndHsqcFid/3/ser",
"data/brukerFolders/cosyAndHsqcFid/3/pdata/1/procs",
"data/brukerFolders/cosyAndHsqcFid/3/pdata/1/proc2s"
]
},
"zones": {
"values": [],
"options": { "isSumConstant": true, "sumAuto": true }
},
"customInfo": {}
},
{
"id": "7b9a1a5f-da6e-4dc9-88f1-18972ad0f7e7",
"meta": {},
"sourceSelector": {
"files": [
"data/brukerFolders/cosyAndHsqcFid/2/acqu2s",
"data/brukerFolders/cosyAndHsqcFid/2/acqus",
"data/brukerFolders/cosyAndHsqcFid/2/ser",
"data/brukerFolders/cosyAndHsqcFid/2/pdata/1/procs",
"data/brukerFolders/cosyAndHsqcFid/2/pdata/1/proc2s"
]
},
"filters": [
{
"name": "apodizationDimension1",
"value": {
"exponential": {
"apply": false,
"options": { "lineBroadening": 0.3 }
},
"sineBell": {
"apply": true,
"options": { "offset": 0, "exponent": 1 }
},
"sineSquare": { "apply": false, "options": { "offset": 0 } },
"traf": { "apply": false, "options": { "lineBroadening": 0.3 } },
"gaussian": {
"apply": false,
"options": { "lineBroadening": 0.3, "lineBroadeningCenter": 0 }
}
},
"enabled": true,
"id": "1a5fda6e-9dc9-48f1-9897-2ad0f7e70197"
},
{
"name": "zeroFillingDimension1",
"value": { "nbPoints": 1024 },
"enabled": true,
"id": "5fda6e9d-c948-4118-972a-d0f7e70197ad"
},
{
"name": "fftDimension1",
"value": {},
"enabled": true,
"id": "da6e9dc9-48f1-4897-aad0-f7e70197ad07"
},
{
"name": "apodizationDimension2",
"value": {
"exponential": {
"apply": false,
"options": { "lineBroadening": 0.3 }
},
"sineBell": {
"apply": true,
"options": { "offset": 0, "exponent": 1 }
},
"sineSquare": { "apply": false, "options": { "offset": 0 } },
"traf": { "apply": false, "options": { "lineBroadening": 0.3 } },
"gaussian": {
"apply": false,
"options": { "lineBroadening": 0.3, "lineBroadeningCenter": 0 }
}
},
"enabled": true,
"id": "6e9dc948-f118-472a-90f7-e70197ad075d"
},
{
"name": "zeroFillingDimension2",
"value": { "nbPoints": 1024 },
"enabled": true,
"id": "9dc948f1-1897-4ad0-b7e7-0197ad075d90"
},
{
"name": "fftDimension2",
"value": {},
"enabled": true,
"id": "c948f118-972a-40f7-a701-97ad075d90f1"
},
{
"name": "phaseCorrectionTwoDimensions",
"value": {},
"enabled": true,
"id": "48f11897-2ad0-47e7-8197-ad075d90f11e",
"error": "Phase correction is not applicable to raw data"
},
{
"name": "symmetrizeCosyLike",
"value": {},
"enabled": false,
"id": "f118972a-d0f7-4701-97ad-075d90f11e9a"
}
],
"info": {},
"display": {
"isPositiveVisible": true,
"isNegativeVisible": true,
"isVisible": true,
"contourOptions": {
"positive": { "contourLevels": [51, 100], "numberOfLayers": 10 },
"negative": { "contourLevels": [51, 100], "numberOfLayers": 10 }
},
"dimension": 2,
"negativeColor": "blue",
"positiveColor": "darkblue"
},
"data": {},
"zones": {
"values": [],
"options": { "isSumConstant": true, "sumAuto": true }
},
"customInfo": {}
}
]
}
}
81 changes: 29 additions & 52 deletions src/component/modal/MultipletAnalysisModal.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,15 @@
import { Dialog } from '@blueprintjs/core';
/** @jsxImportSource @emotion/react */
import { Dialog, DialogBody } from '@blueprintjs/core';
import styled from '@emotion/styled';
import { xGetFromToIndex, xyToXYObject } from 'ml-spectra-processing';
import { analyseMultiplet } from 'multiplet-analysis';
import type { ActiveSpectrum } from 'nmr-load-save';
import { xreimMultipletAnalysis } from 'nmr-processing';
import { useEffect, useState } from 'react';
import { Axis, LineSeries, Plot } from 'react-plot';

import { isSpectrum2D } from '../../data/data2d/Spectrum2D/index.js';
import { useChartData } from '../context/ChartContext.js';
import { useScaleChecked } from '../context/ScaleContext.js';
import { StyledDialogBody } from '../elements/StyledDialogBody.js';

const DialogBody = styled(StyledDialogBody)`
button:focus {
outline: none;
}

.header {
color: #464646;
font-size: 15px;
height: 20px;
}

.container {
padding: 10px;
max-height: 500px;
overflow-y: auto;

.row {
outline: none;
display: flex !important;
flex-direction: row;
margin: 0;

.multiplicity {
flex: 2;
display: flex;
align-items: center;
justify-content: center;
padding: 0 20px;
}
}

.row:nth-child(odd) {
background: #fafafa;
}
}
`;

const LoaderContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -138,7 +101,7 @@
}

const {
data: { x, re },
data: { x, re, im },
info,
} = spectrum;

Expand All @@ -149,26 +112,40 @@
from,
to,
});

const analysesProps = {
x: x.slice(fromIndex, toIndex),
y: re.slice(fromIndex, toIndex),
re: re.slice(fromIndex, toIndex),
im: im?.slice(fromIndex, toIndex),
};
// console.log(
// 'hola',
// JSON.stringify(analysesProps, (key, value) =>
// ArrayBuffer.isView(value) ? Array.from(value as any) : value,
// ),
// );
try {
const result = analyseMultiplet(analysesProps, {
frequency: info.originFrequency,
minimalResolution: 0.1,
maxTestedJ: 17,
takeBestPartMultiplet: true,
correctVerticalOffset: true,
symmetrizeEachStep: true,
decreasingJvalues: true,
makeShortCutForSpeed: true,
debug: true,
const result = xreimMultipletAnalysis(analysesProps, {
autoPhase: false,
analyzer: {
frequency: info.originFrequency,
minimalResolution: 0.1,
critFoundJ: 0.75,
maxTestedJ: 17,
minTestedJ: 1,
checkSymmetryFirst: false,
takeBestPartMultiplet: true,
correctVerticalOffset: true,
symmetrizeEachStep: false,
decreasingJvalues: true,
makeShortCutForSpeed: true,
debug: true,
},
});
setCalcFinished(true);
setAnalysisData(result);
} catch (error) {
// TODO: handle error

Check warning on line 148 in src/component/modal/MultipletAnalysisModal.tsx

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Unexpected 'todo' comment: 'TODO: handle error'
reportError(error);
}
}
Expand Down
Loading
Loading