Skip to content

Commit

Permalink
fix: create info1D for projections (#2841)
Browse files Browse the repository at this point in the history
  • Loading branch information
jobo322 committed Jan 18, 2024
1 parent 8b57b9f commit 1571b50
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/data/data2d/Spectrum2D/getMissingProjection.ts
@@ -1,6 +1,6 @@
import { NmrData2DFt } from 'cheminfo-types';
import { zoneToX } from 'ml-spectra-processing';
import { Info2D } from 'nmr-processing';
import { Info1D, Info2D } from 'nmr-processing';

import { UsedColors } from '../../../types/UsedColors';
import { initiateDatum1D } from '../../data1d/Spectrum1D';
Expand Down Expand Up @@ -45,7 +45,9 @@ export function getMissingProjection(
if (index === -1) index = 0;

const info = {
nucleus: datumInfo.nucleus[index], // 1H, 13C, 19F, ...
...getInfo(datumInfo, index),
experiment: '1d',
pulseSequence: 'projection',
isFid: false,
isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
dimension: 1,
Expand All @@ -55,3 +57,11 @@ export function getMissingProjection(

return initiateDatum1D({ info, data }, { usedColors });
}

function getInfo(info, index) {
const newInfo: any = {};
for (const key in info) {
newInfo[key] = Array.isArray(info[key]) ? info[key][index] : info[key];
}
return newInfo as Info1D;
}

0 comments on commit 1571b50

Please sign in to comment.