forked from freesurfer/freesurfer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_uncertainty_and_timecourses.m
46 lines (42 loc) · 1.86 KB
/
plot_uncertainty_and_timecourses.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
BG_opt = computeUpsampled(insulin_opt, parms) ;
BG_init = computeUpsampled(insulin_init, parms) ;
parms.insulin = insulin_init ;
BG_prob = estimate_BG_probability(parms, hyper_parms);
parms.insulin = insulin_opt ;
BGopt_prob = estimate_BG_probability(parms, hyper_parms);
loss_opt = compute_insulin_schedule_loss(insulin_opt, parms, hyper_parms)
%%%%% plot the risk minimizing uncertainty
figure('name', 'risk minimizing', 'position', [786 604 1379 689]) ;
h2 = imagesc(BGopt_prob);
set(gca, 'ylim', [0 350], 'xlim', [0 parms.T1], 'fontsize', 16, 'fontweight', 'bold');
axis xy
xlabel('time (min)', 'fontsize', 16, 'fontweight', 'bold') ;
ylabel('BG (mg/dL)', 'fontsize', 16, 'fontweight', 'bold') ;
colorbar;
title('uncertainty curves for risk-minimizing schedule', 'fontsize', 16, 'fontweight', 'bold') ;
print -dtiff risk_minimizing_uncertainty.tif
%%%%% plot the deteriministic uncertainty
chigh = max(BGopt_prob(:)) ;
figure('name', 'L1 minimizing', 'position', [2174 601 1248 691]) ;
h1 = imagesc(BG_prob, [0 chigh]);
set(gca, 'ylim', [0 350], 'xlim', [0 parms.T1], 'fontsize', 16, 'fontweight', 'bold');
axis xy
xlabel('time (min)', 'fontsize', 16, 'fontweight', 'bold') ;
ylabel('BG (mg/dL)', 'fontsize', 16, 'fontweight', 'bold') ;
colorbar;
title('uncertainty curves for deterministic schedule', 'fontsize', 16, 'fontweight', 'bold') ;
print -dtiff deterministic_L1_uncertainty.tif
%%%% plot the timecourses
figure('name', 'BG for risk and L1-minimizing schedules') ;
plot(BG_opt, 'g')
hold on;
plot(BG_init, 'k')
plot(BG_fixed, 'r')
hold off;
legend('risk minimizing', 'deterministic','15 min pre-bolus');
xlabel('time (min)', 'fontsize', 16, 'fontweight', 'bold') ;
ylabel('BG (mg/dL)', 'fontsize', 16, 'fontweight', 'bold') ;
set(gca, 'xlim', [0 parms.T1], 'fontsize', 16, 'fontweight','bold') ;
ch = get(gca, 'children') ;
set(ch, 'linewidth', 4);
%print -dtiff BG_timecourses.tif