Skip to content

Commit

Permalink
Merge pull request #448 from HJZollner/develop
Browse files Browse the repository at this point in the history
BUG FIX - MM3co scaling - fit functions - Kathleen Hupfeld
  • Loading branch information
HJZollner authored Jun 23, 2022
2 parents 24e89ec + 384d4b8 commit d99485e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions fit/osp_fitHERCULES.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions fit/osp_fitHERMES.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions fit/osp_fitMEGA.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
dataToFit.refFWHM = fitParamsOff.refFWHM;

if ~strcmp(fitOpts.coMM3, 'none')
fitOpts.CrFactor = 1;
[basisSetDiff1] = osp_addDiffMMPeaks(basisSetDiff1,basisSetOff,fitOpts);
end

Expand Down Expand Up @@ -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(:,:);
Expand Down
14 changes: 14 additions & 0 deletions libraries/FID-A/fitTools/fitModels/Osprey/osp_addDiffMMPeaks.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'));
Expand Down

0 comments on commit d99485e

Please sign in to comment.