Skip to content
Snippets Groups Projects
Commit b7e0b824 authored by William Lövfors's avatar William Lövfors
Browse files

Revision post review comments

parent c07cc4cf
No related branches found
No related tags found
No related merge requests found
Showing
with 66 additions and 20 deletions
......@@ -28,12 +28,13 @@ try
disp('3. Effects of removing insulin actions (Fig. 5)')
disp('4. All figure after diabetes was introduced (Fig. 6, 7, S3, S4)')
disp('5. Best agreement when insulin action 3 was removed (Fig. S2)')
disp('6. Figures related to using the alternative epi data set (Doc. SX)')
disp('Note that figures numbered 5X corresponds to supplementary figures SX.')
choice = input('\nChoice (1, 2, 3, 4 or 5): ');
choice = input('\nChoice (1, 2, 3, 4, 5 or 6): ');
if ~ismember(choice, [1,3,5])
if ~ismember(choice, [1,3,5, 6])
fprintf('\n\nWhat resolution do you want?\n')
disp('High resolution (as in the papers) or low resolution (faster)?')
disp('High resolution (as in the paper) or low resolution (faster)?')
disp('1. High resolution')
disp('2. Low resolution')
choice2 = input('\nChoice (1 or 2): ');
......@@ -41,11 +42,11 @@ try
choice2 = 1;
end
fprintf('\n\n')
if ~ismember(choice,[1 2 3 4 5]) && ~ismember(choice2,[1 2])
if ~ismember(choice,[1 2 3 4 5 6]) && ~ismember(choice2,[1 2])
error('Invalid choice of plots. Invalid choice of resolution')
elseif ~ismember(choice,[1 2 3 4 5]) && ismember(choice2,[1 2])
elseif ~ismember(choice,[1 2 3 4 5 6]) && ismember(choice2,[1 2])
error('Invalid choice of plots. Valid choice of resolution')
elseif ismember(choice,[1 2 3 4 5]) && ~ismember(choice2,[1 2])
elseif ismember(choice,[1 2 3 4 5 6]) && ~ismember(choice2,[1 2])
error('Valid choice of plots. Invalid choice of resolution')
elseif choice2==1
res=0.01;
......@@ -66,6 +67,10 @@ try
PlotUncertainty(1, res)
elseif choice == 5
PlotUncertainty(0,res, 'lipolysis_noIns3')
elseif choice == 6
PlotPL('lipolysis', 0)
PlotUncertainty(0,res, 'lipolysis', 0)
PlotInsulinActions(0)
else
disp('Invalid choice if plots')
end
......
if ~(exist('./Model equations.txt','file') && exist('./Scripts and data','dir'))
cdChoice=input('Warning! You are likely running the file from the wrong directory.\nDo you want to attempt to switch to the correct directory automatically?\n 1. yes\n 2. no\nChoice (1 or 2): ','s');
if cdChoice == 1
cd(fileparts(mfilename('fullpath')))
elseif cdChoice == 2
disp('Warning! The script will most likely not run from this directory.')
disp('If you encounter errors, please change the directory to the folder with the files.' )
else
disp('Invalid choice')
end
end
assert(exist('./Model equations.txt','file') && exist('./Scripts and data','dir'),'Error! Likely running from the wrong directory.')
currentDir = pwd;
try
run('./Scripts and data/Setup.m')
res = 0.01;
cd('Scripts and data')
PlotPL('lipolysis', 0)
PlotUncertainty(0,res, 'lipolysis', 0)
PlotInsulinActions(0)
cd(currentDir)
catch err
disp('Something went wrong.')
cd(currentDir)
rethrow(err)
end
\ No newline at end of file
function [cost, responses] = CostInVivo(params, model, data, tol)
function [cost, responses] = CostInVivo(params, model, data, tol, useFig2EpiData)
if nargin<4, tol = 0; end
try
ind = ismember(data.Fig1.Time(1):data.Fig1.Time(30), data.Fig1.Time);
......@@ -11,18 +11,32 @@ try
SEM=data.Fig1.SEM;
costFig1 = sum((yh-y).^2 ./SEM.^2);
%% Fig2
yh=[responses.Gly.Fig2Epi(ind); responses.Gly.Fig2Iso(ind)];
y=[data.Fig2Epi.Mean; data.Fig2Iso.Mean];
SEM=[data.Fig2Epi.SEM; data.Fig2Iso.SEM];
costFig2 = sum((yh-y).^2 ./SEM.^2);
%% Fig3
yh=responses.Gly.Fig3EpiPhe(ind);
y=data.Fig3EpiPhe.Mean;
SEM=data.Fig3EpiPhe.SEM;
costFig3 = sum((yh-y).^2 ./SEM.^2);
if useFig2EpiData
%% Fig2
yh=[responses.Gly.Fig2Epi(ind); responses.Gly.Fig2Iso(ind)];
y=[data.Fig2Epi.Mean; data.Fig2Iso.Mean];
SEM=[data.Fig2Epi.SEM; data.Fig2Iso.SEM];
costFig2 = sum((yh-y).^2 ./SEM.^2);
%% Fig3
yh=responses.Gly.Fig3EpiPhe(ind);
y=data.Fig3EpiPhe.Mean;
SEM=data.Fig3EpiPhe.SEM;
costFig3 = sum((yh-y).^2 ./SEM.^2);
else
%% Fig2
yh=responses.Gly.Fig2Iso(ind);
y=data.Fig2Iso.Mean;
SEM=data.Fig2Iso.SEM;
costFig2 = sum((yh-y).^2 ./SEM.^2);
%% Fig3
yh=[responses.Gly.Fig3Epi(ind); responses.Gly.Fig3EpiPhe(ind)];
y=[data.Fig3Epi.Mean; data.Fig3EpiPhe.Mean];
SEM=[data.Fig3Epi.SEM; data.Fig3EpiPhe.SEM];
costFig3 = sum((yh-y).^2 ./SEM.^2);
end
%% Total cost
cost=costFig1+costFig2+costFig3+steady;
......
File deleted
File deleted
File deleted
File deleted
......@@ -90,7 +90,7 @@ lb=repmat(log(1e-6), 1, expInd); % set lower bound for all "InVitro" parameters
ub=repmat(log(1e6), 1, expInd); % set upper bound for all "InVitro" paramters
lb=[lb 0.6 8 0 0 0 -5 log(0.5) -5 0.5 0.5 0.5];
ub=[ub 1 12 8 20 20 3 log(1.1) 3 2 2 2];
ub=[ub 1 12 20 20 20 3 log(1.1) 3 2 2 2];
if contains(modelName, '_noIns1')
lb([28 31])=[];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment