From 384d4b87cbd6d7d1e508d23a070c7807da7fbef7 Mon Sep 17 00:00:00 2001 From: Helge <47348963+HJZollner@users.noreply.github.com> Date: Thu, 23 Jun 2022 10:20:27 -0400 Subject: [PATCH] BUG FIX - MM3co scaling - fit functions - Kathleen Hupfeld - Fixed the scaling of the co-edited MM peak at 3 ppm. Scaling issue was related to the on the flight calculation based on the sum spectrum while the initial MMs are calculated with the A sub spectrum. Therefore, this did not occur for MEGA or the older implementation prior to v.2.0.0. --- fit/osp_fitHERCULES.m | 1 + fit/osp_fitHERMES.m | 1 + fit/osp_fitMEGA.m | 2 ++ .../fitTools/fitModels/Osprey/osp_addDiffMMPeaks.m | 14 ++++++++++++++ 4 files changed, 18 insertions(+) diff --git a/fit/osp_fitHERCULES.m b/fit/osp_fitHERCULES.m index 670c9b7f..721bc667 100644 --- a/fit/osp_fitHERCULES.m +++ b/fit/osp_fitHERCULES.m @@ -75,6 +75,7 @@ dataToFit.refFWHM = fitParamsSum.refFWHM; if isfield(fitOpts, 'coMM3') && ~strcmp(fitOpts.coMM3, 'none') + fitOpts.CrFactor = 4; [basisSetDiff1] = osp_addDiffMMPeaks(basisSetDiff1,basisSetSum,fitOpts); end diff --git a/fit/osp_fitHERMES.m b/fit/osp_fitHERMES.m index 4ce00d0b..2855d58f 100644 --- a/fit/osp_fitHERMES.m +++ b/fit/osp_fitHERMES.m @@ -75,6 +75,7 @@ dataToFit.refFWHM = fitParamsSum.refFWHM; if isfield(fitOpts, 'coMM3') && ~strcmp(fitOpts.coMM3, 'none') + fitOpts.CrFactor = 4; [basisSetDiff1] = osp_addDiffMMPeaks(basisSetDiff1,basisSetSum,fitOpts); end diff --git a/fit/osp_fitMEGA.m b/fit/osp_fitMEGA.m index 8ecff4cc..6a60a6d2 100644 --- a/fit/osp_fitMEGA.m +++ b/fit/osp_fitMEGA.m @@ -98,6 +98,7 @@ dataToFit.refFWHM = fitParamsOff.refFWHM; if ~strcmp(fitOpts.coMM3, 'none') + fitOpts.CrFactor = 1; [basisSetDiff1] = osp_addDiffMMPeaks(basisSetDiff1,basisSetOff,fitOpts); end @@ -272,6 +273,7 @@ basisSetDiff1 = MRSCont.fit.basisSet; basisSetDiff1.fids = basisSetDiff1.fids(:,:,3); basisSetDiff1.specs = basisSetDiff1.specs(:,:,3); + fitOpts.CrFactor = 1; [basisSetDiff1] = osp_addDiffMMPeaks(basisSetDiff1,fitOpts); basisSetConc.fids(:,:,1) = basisSetDiff1.fids(:,:); basisSetConc.specs(:,:,1) = basisSetDiff1.specs(:,:); diff --git a/libraries/FID-A/fitTools/fitModels/Osprey/osp_addDiffMMPeaks.m b/libraries/FID-A/fitTools/fitModels/Osprey/osp_addDiffMMPeaks.m index 86fd87b9..62968f10 100644 --- a/libraries/FID-A/fitTools/fitModels/Osprey/osp_addDiffMMPeaks.m +++ b/libraries/FID-A/fitTools/fitModels/Osprey/osp_addDiffMMPeaks.m @@ -10,6 +10,8 @@ % To scale the amplitudes correctly, we first need to determine the % area of the 3.027 ppm CH3 signal of creatine [CrArea] = detCrArea(BASISoff); + % Take into account whether off or sum spectrum is used + CrArea = CrArea/fitOpts.CrFactor; oneProtonArea = CrArea/3; % Next, we determine the area of a Gaussian singlet with nominal area 1 @@ -40,6 +42,18 @@ BASISdiff.fids(:,idx_MM) = BASISdiff.fids(:,idx_MM) + MM3co.fids; BASISdiff.specs(:,idx_MM) = BASISdiff.specs(:,idx_MM) + MM3co.specs; end + + if strcmp(fitOpts.coMM3, '3to2MMud') % 3:2 MM09 and co-edited MM3 model + idx_MM = find(strcmp(BASISdiff.name,'MM09')); + if isempty(idx_MM) + error('No basis function with nametag ''MM09'' found! Abort!'); + end + idx_MM2 = find(strcmp(BASISdiff.name,'MM30')); + BASISdiff.fids(:,idx_MM) = BASISdiff.fids(:,idx_MM) + BASISdiff.fids(:,idx_MM2); + BASISdiff.specs(:,idx_MM) = BASISdiff.specs(:,idx_MM) + BASISdiff.specs(:,idx_MM2); + BASISdiff.fids(:,idx_MM2) = zeros(length(BASISdiff.fids(:,idx_MM2)),1); + BASISdiff.specs(:,idx_MM2) = zeros(length(BASISdiff.specs(:,idx_MM2)),1); + end if strcmp(fitOpts.coMM3, '3to2MMsoft') % 3:2 MM09 and co-edited MM3 model idx_MM = find(strcmp(BASISdiff.name,'MM09'));