Skip to content

Commit

Permalink
fix: manual zones detection for predicted 2D spectra (#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Jun 30, 2023
1 parent 89cccd1 commit 8da944b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/data/PredictionManager.ts
Expand Up @@ -242,6 +242,7 @@ function generated2DSpectrum(params: {
frequency,
experiment,
});
const spectralWidth = getSpectralWidth(experiment, inputOptions);
const datum = initiateDatum2D(
{
data: { rr: { ...minMaxContent, noise: 0.01 } },
Expand All @@ -256,6 +257,7 @@ function generated2DSpectrum(params: {
originFrequency: frequency,
baseFrequency: frequency,
pulseSequence: 'prediction',
spectralWidth,
experiment,
},
},
Expand All @@ -269,6 +271,29 @@ function get2DWidth(nucleus: string[]) {
return nucleus[0] === nucleus[1] ? 0.02 : { x: 0.02, y: 0.2133 };
}

function getSpectralWidth(experiment: string, options: PredictionOptions) {
const formTo = options['1d'];

switch (experiment) {
case 'cosy': {
const { from, to } = formTo['1H'];
const diff = to - from;
return [diff, diff];
}
case 'hsqc':
case 'hmbc': {
const proton = formTo['1H'];
const carbon = formTo['13C'];
const protonDiff = proton.to - proton.from;
const carbonDiff = carbon.to - carbon.from;

return [protonDiff, carbonDiff];
}
default:
return [];
}
}

function calculateFrequency(
nucleus: string | string[],
frequency: number,
Expand Down

0 comments on commit 8da944b

Please sign in to comment.