Post-Correction Analysis
"/home/gml/Proyects/Personal/Dextrose.jl/src"
xxxxxxxxxx
1
1
pwd()
"/home/gml/Proyects/Personal/Dextrose.jl/Project.toml"
"/home/gml/.julia/environments/v1.5/Project.toml"
"/home/gml/SysAdmin/Install/Julia/julia-1.5.1/share/julia/stdlib/v1.5"
xxxxxxxxxx
1
1
Base.load_path()
xxxxxxxxxx
4
1
begin
2
using Pkg
3
Pkg.activate("..")
4
end
xxxxxxxxxx
10
1
begin
2
using CSV
3
using DataFrames
4
using PlutoUI
5
using Dates
6
using Plots
7
using Clustering
8
using ShiftedArrays
9
using Statistics
10
end
"../data/"
xxxxxxxxxx
1
1
data_dir = "../data/"
"../data/604G_data"
"../data/apple_health_export"
"../data/exportar.zip"
"../data/latest.csv"
xxxxxxxxxx
1
1
data_entries = data_dir .* readdir(data_dir)
xxxxxxxxxx
1
1
data = CSV.read(data_entries[end]);
"DateTime"
"New Device Time"
"BG Reading (mg/dL)"
"Linked BG Meter ID"
"Basal Rate (U/h)"
"Temp Basal Amount"
"Temp Basal Type"
"Temp Basal Duration (h:mm:ss)"
"Bolus Type"
"Bolus Volume Selected (U)"
"Bolus Volume Delivered (U)"
"Bolus Duration (h:mm:ss)"
"Prime Type"
"Prime Volume Delivered (U)"
"Alarm"
"Suspend"
"Rewind"
"BWZ Estimate (U)"
"BWZ Target High BG (mg/dL)"
"BWZ Target Low BG (mg/dL)"
"BWZ Carb Ratio (g/U)"
"BWZ Insulin Sensitivity (mg/dL/U)"
"BWZ Carb Input (grams)"
"BWZ BG Input (mg/dL)"
"BWZ Correction Estimate (U)"
"BWZ Food Estimate (U)"
"BWZ Active Insulin (U)"
"BWZ Status"
"Sensor Calibration BG (mg/dL)"
"Sensor Glucose (mg/dL)"
"ISIG Value"
"Event Marker"
"Bolus Number"
"Bolus Cancellation Reason"
"BWZ Unabsorbed Insulin Total (U)"
"Final Bolus Estimate"
"Scroll Step Size"
"Insulin Action Curve Time"
"Sensor Calibration Rejected Reason"
"Preset Bolus"
"Network Device Disassociated Reason"
"Network Device Disconnected Reason"
"Sensor Exception"
"Preset Temp Basal Name"
"d1w5"
"Sd1w5"
"hour"
"minute"
"x(t)"
"y(t)"
xxxxxxxxxx
1
1
names(data)
Extract useful information
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
xxxxxxxxxx
10
1
begin
2
basal = data["Basal Rate (U/h)"];
3
glycaemia = data["Sensor Glucose (mg/dL)"];
4
sensitivity = data["BWZ Insulin Sensitivity (mg/dL/U)"];
5
ratio = data["BWZ Carb Ratio (g/U)"];
6
carb_insulin = data["BWZ Food Estimate (U)"];
7
correction_insulin_estimate = data["BWZ Correction Estimate (U)"];
8
active_insulin = data["BWZ Active Insulin (U)"];
9
correction_insulin_total = correction_insulin_estimate .+ active_insulin;
10
end
124.0
122.891
121.732
120.528
119.282
118.0
116.258
114.436
112.577
110.75
109.0
107.982
107.044
106.212
105.521
105.0
105.656
106.397
107.217
108.087
109.0
110.195
111.395
112.599
113.801
115.0
116.196
117.388
118.579
119.783
121.0
122.543
124.173
125.837
127.463
129.0
130.064
131.086
132.075
133.043
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
xxxxxxxxxx
1
1
replace!(glycaemia, missing=>NaN)
xxxxxxxxxx
1
1
date_strings = data["DateTime"];
xxxxxxxxxx
1
1
format = Dates.DateFormat("Y-m-d H:M:S");
xxxxxxxxxx
1
1
dates = parse.(DateTime, date_strings, format);
xxxxxxxxxx
1
1
plot(dates, glycaemia)
xxxxxxxxxx
1
1
plot(dates, basal)
xxxxxxxxxx
1
1
scatter(dates, ratio)
xxxxxxxxxx
1
1
scatter(dates, sensitivity)
Define some useful parameters with Constant
naming convention
150
xxxxxxxxxx
6
1
begin
2
# Block of constants :
3
## Time constants, in minutes :
4
MAX_INSULIN_DURATION = 180;
5
POSTPRANDIAL_TIME = 150;
6
end
Define some utility functions :
Main.workspace2888.rebound
xxxxxxxxxx
12
1
"""
2
Take an Array (some_array) and an index (n).
3
4
Returns
5
`n` if it is inbounds (i.e. n <= length(some_array)
6
`length(some_array)` otherwise
7
"""
8
function rebound(some_array, n)
9
# bound the upper limit to max array length
10
arr_size = length(some_array);
11
n <= arr_size ? n : arr_size
12
end
Main.workspace2888.plot_intervals
xxxxxxxxxx
10
1
"""
2
Doc pending,
3
sub-optimal and perhaps non-julian
4
"""
5
function plot_intervals(full_series, intervals, _title)
6
_pp = plot();
7
[ plot!(_pp, full_series[interval]) for interval in intervals ];
8
title!(_title)
9
_pp
10
end
Main.workspace2888.plot_intervals
xxxxxxxxxx
9
1
"""
2
Doc pending,
3
sub-optimal and perhaps non-julian
4
"""
5
function plot_intervals(full_series, intervals)
6
_pp = plot();
7
[ plot!(_pp, full_series[interval]) for interval in intervals ];
8
_pp
9
end
Main.workspace2888.create_intervals
xxxxxxxxxx
9
1
"""
2
Create intervals of length Main.MAX_INSULIN_DURATION,
3
respectin the size of the array `full_data`.
4
"""
5
function create_intervals(full_data, starting_points)
6
[ val:1:rebound(full_data, val+MAX_INSULIN_DURATION)
7
for val in starting_points
8
]
9
end
Main.workspace2888.mean_time
xxxxxxxxxx
9
1
"""
2
¿Cómo chingados no se va a poder calcular la media
3
de las horas del día?
4
"""
5
function mean_time(times_array)
6
_unix_mean_tmp = Libc.strftime(mean(Dates.value.(times_array)))
7
rem = match(r"\d{2}:\d{2}:\d{2}", _unix_mean_tmp)
8
rem.match
9
end
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
xxxxxxxxxx
1
1
collect(correction_insulin_total)
xxxxxxxxxx
2
1
# Better :
2
correction_idx = findall(x -> !ismissing(x) && x > 0.0, correction_insulin_estimate);
xxxxxxxxxx
1
1
true_corrections = correction_insulin_estimate[correction_idx];
xxxxxxxxxx
1
1
correction_timestamps = dates[correction_idx];
To do
benchmark both approaches :
xxxxxxxxxx
11
1
# Approach 1
2
begin
3
# Upper bound for array size :
4
max_idx = length(glycaemia);
5
post_correction_intervals = [
6
# Define up to MAX_INSULIN_DURATION steps i.e. 3 hours after each corrrection :
7
val:1:(x -> (max_idx >= x) ? x : max_idx)(val+MAX_INSULIN_DURATION)
8
for val in correction_idx
9
];
10
nothing
11
end
xxxxxxxxxx
8
1
# Approach 2
2
begin
3
my_post_correction_intervals = [
4
val:1:rebound(glycaemia, val+MAX_INSULIN_DURATION)
5
for val in correction_idx
6
];
7
nothing
8
end
Note that they do produce identical results, as expected :
true
xxxxxxxxxx
1
1
reduce((x, y) -> x*y, post_correction_intervals .== my_post_correction_intervals)
xxxxxxxxxx
4
1
post_correction_glycaemiae = [
2
replace(glycaemia[interval], missing=>NaN)
3
for interval in post_correction_intervals
4
];
254.484
255.007
255.585
256.244
257.0
258.525
260.149
261.817
263.452
265.0
266.22
267.426
268.618
269.809
271.0
272.192
273.385
274.579
275.784
277.0
278.227
279.466
280.706
281.887
283.0
282.369
281.313
280.052
278.875
278.0
278.282
278.626
279.038
279.495
280.0
280.795
281.591
282.39
283.193
284.0
264.324
264.529
264.754
265.0
265.394
265.8
266.21
266.613
267.0
267.249
282.944
282.924
282.936
282.962
283.0
283.172
283.347
283.534
283.748
284.0
284.562
285.168
285.798
286.416
287.0
287.423
287.832
288.228
288.617
289.0
289.249
289.487
289.704
289.879
290.0
289.66
289.254
288.814
288.385
288.0
287.787
287.593
287.41
287.215
287.0
286.617
286.199
285.767
285.36
285.0
231.948
231.808
231.67
231.536
231.403
231.274
231.146
231.021
230.899
230.779
229.347
229.566
229.788
230.0
230.202
230.401
230.599
230.799
231.0
231.204
231.409
231.616
231.813
232.0
231.889
231.719
231.504
231.26
231.0
230.604
230.205
229.802
229.4
229.0
228.605
228.216
227.826
227.423
227.0
226.423
225.827
225.217
224.606
224.0
223.399
222.799
222.2
221.6
221.0
220.399
205.664
206.841
208.0
209.015
210.026
211.03
212.022
213.0
213.816
214.594
203.249
204.471
205.664
206.841
208.0
209.015
210.026
211.03
212.022
213.0
213.816
214.594
215.359
216.153
217.0
218.325
219.733
221.185
222.621
224.0
225.062
226.09
227.087
228.056
229.0
229.523
230.0
230.42
230.758
231.0
230.481
229.869
229.207
228.569
228.0
227.769
227.585
227.423
227.236
227.0
153.845
153.952
154.03
154.0
153.444
152.798
152.114
151.497
151.0
151.626
248.639
247.742
247.0
246.943
246.969
247.034
247.059
247.0
246.451
245.83
245.175
244.552
244.0
243.938
243.959
244.02
244.048
244.0
243.348
242.628
241.835
240.961
240.0
238.272
236.438
234.559
232.726
231.0
229.751
228.532
227.34
226.164
225.0
223.973
222.949
221.937
220.951
220.0
219.347
218.728
139.227
139.0
138.636
138.259
137.868
137.448
137.0
136.04
134.933
133.793
172.203
172.0
171.795
171.587
171.38
171.183
171.0
171.136
171.353
171.605
171.836
172.0
171.845
171.665
171.459
171.238
171.0
170.622
170.236
169.84
169.429
169.0
168.416
167.807
167.188
166.581
166.0
165.582
165.19
164.81
164.418
164.0
163.419
162.812
162.193
161.585
161.0
160.565
160.142
159.737
221.0
220.369
219.544
218.617
217.738
217.0
216.935
216.959
217.028
217.057
201.039
199.962
198.929
198.0
197.545
197.122
196.729
196.355
196.0
195.794
195.6
195.41
195.213
195.0
194.638
194.258
193.86
193.441
193.0
192.276
191.522
190.731
189.893
189.0
187.812
186.615
185.41
184.204
183.0
181.797
180.595
179.395
178.197
177.0
175.805
174.613
173.42
172.217
171.0
169.464
151.919
152.351
152.784
153.219
153.656
154.094
154.534
154.975
155.418
155.863
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
286.0
286.898
287.901
288.962
290.011
291.0
291.677
292.331
292.949
293.51
294.0
293.875
293.662
293.404
293.169
293.0
293.176
293.41
293.662
293.872
294.0
293.665
293.289
292.878
292.446
292.0
291.414
290.821
290.221
289.614
289.0
288.25
287.488
286.704
285.879
285.0
283.66
282.256
280.817
279.388
181.559
181.118
180.695
180.316
180.0
179.987
179.985
179.991
179.997
180.0
203.847
205.0
205.841
206.654
207.443
208.223
209.0
209.65
210.298
210.925
211.498
212.0
211.902
211.735
211.514
211.264
211.0
210.602
210.202
209.801
209.4
209.0
208.601
208.204
207.807
207.406
207.0
206.446
205.863
205.258
204.635
204.0
203.212
202.396
201.572
200.767
200.0
199.392
198.79
198.194
181.0
180.621
180.169
179.692
179.286
179.0
180.001
181.262
182.641
183.934
183.934
185.0
185.077
185.066
185.005
184.971
185.0
185.378
185.824
186.292
186.7
187.0
186.532
185.972
185.342
184.677
184.0
183.076
182.158
181.204
180.165
179.0
177.229
175.438
173.628
171.815
170.0
168.164
166.307
164.462
162.681
161.0
160.087
159.273
158.522
157.776
157.0
156.193
155.376
154.554
194.0
195.061
196.123
197.166
198.132
199.0
198.623
198.01
197.272
196.565
181.62
183.0
182.839
182.513
182.058
181.542
181.0
180.014
178.957
177.882
176.878
176.0
176.321
176.797
177.414
178.153
179.0
180.742
182.579
184.455
186.281
188.0
189.242
190.452
191.636
192.817
194.0
195.061
196.123
197.166
198.132
199.0
198.623
198.01
197.272
196.565
196.0
195.961
195.973
196.012
104.0
103.223
102.423
101.609
100.798
100.0
99.4694
98.9565
98.4999
98.1682
105.192
104.611
104.0
103.223
102.423
101.609
100.798
100.0
99.4694
98.9565
98.4999
98.1682
98.0
99.2108
100.609
102.117
103.606
105.0
106.022
106.981
107.916
108.91
110.0
112.062
114.32
116.662
118.927
121.0
122.259
123.458
124.617
125.791
127.0
128.392
129.828
131.278
132.679
134.0
134.413
134.685
147.347
147.0
146.965
146.977
147.011
147.027
147.0
146.809
146.611
146.406
130.968
130.971
130.982
131.0
131.159
131.335
131.528
131.75
132.0
132.69
133.446
134.257
135.112
136.0
137.318
138.681
140.082
141.524
143.0
144.969
147.06
149.18
151.191
153.0
153.547
153.944
154.253
154.584
155.0
155.788
156.649
157.527
158.329
159.0
158.889
158.696
158.451
158.209
158.0
157.939
219.406
219.219
219.0
218.611
218.195
217.771
217.367
217.0
216.791
216.589
210.206
210.418
210.627
210.824
211.0
211.022
211.025
211.015
211.004
211.0
211.003
211.008
211.015
211.013
211.0
210.689
210.319
209.904
209.46
209.0
208.404
207.805
207.202
206.6
206.0
205.402
204.805
204.209
203.608
203.0
202.234
201.429
200.605
199.789
199.0
198.369
197.753
197.154
196.569
196.0
138.629
139.007
139.462
140.0
141.852
143.897
146.117
148.49
151.0
154.531
138.744
138.523
138.333
138.161
138.0
137.981
137.974
137.975
137.985
138.0
138.295
138.629
139.007
139.462
140.0
141.852
143.897
146.117
148.49
151.0
154.531
158.138
161.787
165.419
169.0
172.271
175.514
178.725
181.888
185.0
187.239
189.345
191.326
193.208
195.0
195.458
195.91
196.357
196.798
197.234
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
193.298
195.0
195.756
196.33
196.812
197.339
198.0
199.439
200.95
202.545
204.225
206.0
208.656
211.399
214.212
217.085
220.0
223.586
227.353
231.148
234.748
238.0
238.947
239.652
240.168
240.599
241.0
241.001
240.99
240.976
240.976
241.0
241.199
241.44
241.688
241.886
242.0
241.496
240.914
240.279
163.0
163.186
163.411
163.651
163.855
164.0
163.393
162.667
161.843
160.948
249.614
252.834
255.966
259.0
260.576
261.95
263.134
264.146
265.0
264.573
264.065
263.466
262.781
262.0
260.634
259.244
257.833
256.417
255.0
253.475
251.967
250.432
248.792
247.0
243.99
240.829
237.564
234.272
231.0
227.624
224.25
220.871
217.457
214.0
209.887
205.61
201.277
197.038
193.0
189.922
143.608
146.424
149.0
149.692
150.245
150.648
150.903
151.0
150.086
149.133
223.44
223.227
223.0
222.627
222.24
221.84
221.426
221.0
220.419
219.809
219.186
218.577
218.0
217.743
217.55
217.391
217.217
217.0
216.222
215.395
214.464
213.35
212.0
209.0
205.849
202.585
199.289
196.0
192.466
188.929
185.37
181.733
178.0
172.852
167.408
161.819
156.299
151.0
147.079
143.283
172.968
173.0
173.548
174.198
174.883
175.506
176.0
175.719
175.361
174.941
129.405
129.197
129.0
128.954
128.931
128.929
128.953
129.0
129.74
130.568
131.519
132.651
134.0
136.857
139.857
142.943
146.01
149.0
151.66
154.291
156.892
159.462
162.0
163.823
165.549
167.172
168.658
170.0
169.798
169.336
168.754
168.262
168.0
168.909
169.972
171.097
172.137
173.0
173.077
173.108
115.752
116.0
116.379
116.766
117.164
117.574
118.0
118.572
119.159
119.76
351.276
356.362
361.0
362.852
364.423
365.753
366.932
368.0
368.034
367.959
367.854
367.841
368.0
369.119
370.346
371.625
372.862
374.0
374.674
375.322
375.93
376.493
377.0
377.209
377.411
377.607
377.803
378.0
378.199
378.398
378.599
378.8
379.0
379.061
379.103
379.12
379.087
379.0
378.03
376.924
307.753
308.0
308.565
309.167
309.79
310.406
311.0
311.448
311.885
312.3
251.0
252.768
254.773
256.908
259.019
261.0
262.381
263.751
265.033
266.141
267.0
266.65
266.259
265.834
265.412
265.0
264.598
264.205
263.818
263.418
263.0
262.125
261.154
260.117
259.055
258.0
256.825
255.643
254.451
253.238
252.0
250.471
248.906
247.306
245.67
244.0
242.041
240.061
238.059
236.039
136.004
136.009
136.014
136.011
136.0
135.696
135.339
134.935
134.487
134.0
269.72
271.148
272.581
274.0
275.404
276.805
278.204
279.602
281.0
282.27
283.532
284.765
285.928
287.0
287.306
287.507
287.648
287.798
288.0
288.388
288.803
289.233
289.637
290.0
289.869
289.617
289.314
289.085
289.0
290.214
291.678
293.255
294.741
296.0
296.101
296.06
295.952
295.907
296.0
296.753
270.215
269.614
269.0
268.073
267.074
266.034
264.999
264.0
263.184
262.407
285.495
285.739
285.918
286.0
285.312
284.521
283.668
282.814
282.0
281.34
280.679
280.045
279.476
279.0
279.289
279.677
280.125
280.579
281.0
281.262
281.514
281.743
281.91
282.0
280.734
279.228
277.557
275.79
274.0
271.413
268.607
265.757
263.163
261.0
262.777
265.215
268.006
270.703
273.0
273.798
170.556
171.364
172.0
171.407
170.67
169.822
168.922
168.0
166.816
165.629
208.009
209.017
210.015
211.0
211.671
212.269
212.827
213.393
214.0
214.776
215.566
216.368
217.18
218.0
218.964
219.946
220.944
221.962
223.0
224.368
225.825
227.307
228.72
230.0
230.355
230.602
230.766
230.89
231.0
230.846
230.681
230.497
230.273
230.0
229.262
228.446
227.591
226.763
226.0
225.756
220.729
219.319
218.0
217.635
217.45
217.36
217.239
217.0
215.836
214.558
240.756
241.424
242.0
242.24
242.459
242.657
242.838
243.0
243.016
243.02
243.016
243.009
243.0
242.852
242.687
242.502
242.274
242.0
240.927
239.665
238.324
237.066
236.0
236.081
236.326
236.645
236.9
237.0
236.444
235.835
235.197
234.577
234.0
233.585
233.181
232.786
232.393
232.0
231.608
231.216
75.2105
74.0
72.6239
71.2022
69.7628
68.3528
67.0
66.1248
65.3313
64.5834
111.956
111.792
111.539
111.265
111.0
110.632
110.277
109.913
109.495
109.0
107.888
106.691
105.445
104.203
103.0
101.956
100.919
99.9024
98.9249
98.0
97.5258
97.1036
96.7203
96.3569
96.0
95.7872
95.5964
95.4147
95.2202
95.0
94.3323
93.5931
92.7939
91.9257
91.0
89.1061
86.9793
84.7784
82.7324
81.0
122.646
124.779
126.604
128.0
127.285
126.5
125.656
124.818
124.0
123.2
164.067
165.143
166.2
167.162
168.0
167.129
165.924
164.534
163.177
162.0
161.542
161.185
160.875
160.497
160.0
158.343
156.43
154.424
152.56
151.0
151.15
151.454
151.894
152.415
153.0
154.139
155.295
156.481
157.712
159.0
160.745
162.547
164.38
166.206
168.0
169.378
170.727
171.999
173.106
174.0
319.258
320.579
321.858
323.0
323.502
323.957
324.36
324.709
325.0
324.832
323.502
323.957
324.36
324.709
325.0
324.832
324.609
324.366
324.152
324.0
324.16
324.344
324.547
324.767
325.0
325.396
325.826
326.264
326.665
327.0
326.862
326.657
326.415
326.186
326.0
325.991
326.007
326.031
326.034
326.0
325.809
325.61
325.406
325.202
325.0
324.8
324.601
324.404
324.204
324.0
214.087
214.076
214.047
214.0
213.818
213.638
213.451
213.241
213.0
212.606
258.242
257.449
256.629
255.811
255.0
254.205
253.426
252.648
251.844
251.0
249.848
248.655
247.435
246.213
245.0
243.798
242.598
241.4
240.201
239.0
237.798
236.593
235.389
234.191
233.0
231.966
230.97
229.993
229.009
228.0
226.813
225.581
224.334
223.13
222.0
221.669
221.495
221.396
221.258
221.0
181.821
182.229
182.624
183.0
183.222
183.425
183.616
183.805
184.0
184.205
149.248
149.0
148.309
147.55
146.738
145.883
145.0
143.628
142.134
140.615
139.205
138.0
137.884
137.853
137.889
137.944
138.0
138.179
138.356
138.538
138.75
139.0
139.72
140.531
141.388
142.226
143.0
143.317
143.588
143.802
143.942
144.0
143.288
142.46
141.58
140.739
140.0
139.75
139.55
139.38
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
xxxxxxxxxx
1
1
[ window for window in post_correction_glycaemiae ]
xxxxxxxxxx
6
1
#begin
2
# _p = plot()
3
# for window in post_correction_glycaemiae
4
# _p = plot!(window)
5
# end
6
#end
xxxxxxxxxx
6
1
#begin
2
# plot()
3
# for window in post_correction_glycaemiae
4
# plot!(window)
5
# end
6
#end
xxxxxxxxxx
1
1
#display(_p)
181
58
xxxxxxxxxx
1
1
unique([ length(episode) for episode in post_correction_glycaemiae ])
xxxxxxxxxx
1
1
plot(glycaemia[post_correction_intervals[ith_interval]])
xxxxxxxxxx
1
1
ith_interval Slider(1:length(post_correction_intervals))
Visualise all post correction intervals
xxxxxxxxxx
1
1
plot_intervals(glycaemia, post_correction_intervals)
212:1:392
277:1:457
708:1:888
877:1:1057
1649:1:1829
2105:1:2285
2753:1:2933
2996:1:3176
3265:1:3445
3544:1:3724
3724:1:3904
3869:1:4049
4038:1:4218
4312:1:4492
4646:1:4826
4806:1:4986
6793:1:6973
7056:1:7236
8062:1:8242
8747:1:8927
10341:1:10521
10733:1:10913
11575:1:11755
11685:1:11865
12465:1:12645
12586:1:12766
12804:1:12984
13034:1:13214
13209:1:13389
13319:1:13499
14187:1:14367
14313:1:14493
14545:1:14602
xxxxxxxxxx
1
1
post_correction_intervals
This is sub-optimal, not only do we have different behaviours, we have too many lines to actually understand the trends. This is why we will have to perform clustering.
212:1:392
xxxxxxxxxx
1
1
post_correction_intervals[1]
212
277
708
877
1649
2105
2753
2996
3265
3544
3724
3869
4038
4312
4646
4806
6793
7056
8062
8747
10341
10733
11575
11685
12465
12586
12804
13034
13209
13319
14187
14313
14545
xxxxxxxxxx
1
1
[ _int[1][1] for _int in post_correction_intervals ]
129.0
130.064
131.086
132.075
133.043
134.0
134.806
135.588
136.362
137.16
138.0
139.326
140.759
142.241
143.674
145.0
145.508
145.871
146.168
146.518
147.0
148.258
149.589
150.993
152.464
154.0
156.153
158.398
160.675
162.896
165.0
166.459
167.843
169.188
170.561
172.0
173.773
175.593
177.432
179.244
254.081
254.068
254.006
253.968
254.0
254.484
255.007
255.585
256.244
257.0
xxxxxxxxxx
1
1
glycaemia[36:1:216]
124.0
122.891
121.732
120.528
119.282
118.0
116.258
114.436
112.577
110.75
109.0
107.982
107.044
106.212
105.521
105.0
105.656
106.397
107.217
108.087
109.0
110.195
111.395
112.599
113.801
115.0
116.196
117.388
118.579
119.783
121.0
122.543
124.173
125.837
127.463
129.0
130.064
131.086
132.075
133.043
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
xxxxxxxxxx
1
1
pglc = replace(glycaemia, missing=>NaN)
xxxxxxxxxx
8
1
_cluster_original_columns = [
2
"x(t)", "y(t)", # Time
3
"Sensor Glucose (mg/dL)", "BWZ BG Input (mg/dL)", # Glucose
4
"d1w5", "Sd1w5", # Trends
5
"BWZ Insulin Sensitivity (mg/dL/U)", # Params
6
"BWZ Target High BG (mg/dL)", # Objectives
7
"BWZ Target Low BG (mg/dL)"
8
];
xxxxxxxxxx
9
1
_cluster_cols = [
2
"x(t)" => :x, "y(t)" => :y,
3
"Sensor Glucose (mg/dL)" => :sensor,
4
"BWZ BG Input (mg/dL)" => :bg,
5
"d1w5" => :d1w5, "Sd1w5" => :Sd1w5,
6
"BWZ Insulin Sensitivity (mg/dL/U)" => :sensitivity,
7
"BWZ Target High BG (mg/dL)" => :htarget,
8
"BWZ Target Low BG (mg/dL)" => :ltarget
9
];
xxxxxxxxxx
1
1
correction_cluster = data[correction_idx, _cluster_original_columns];
xxxxxxxxxx
1
1
rename!(correction_cluster, _cluster_cols);
xxxxxxxxxx
1
1
_desc = describe(correction_cluster);
"x"
nothing
"y"
nothing
"sensor"
0
"bg"
0
"d1w5"
3
"Sd1w5"
3
"sensitivity"
0
"htarget"
0
"ltarget"
0
xxxxxxxxxx
1
1
[ nm => param for (nm, param) in zip(names(correction_cluster), _desc.nmissing)]
xxxxxxxxxx
5
1
begin
2
correction_cluster["idx"] = correction_idx; #ID inside original DataFrame
3
correction_cluster["datetime"] = correction_timestamps;
4
nothing
5
end
xxxxxxxxxx
1
1
_grouping_cluster = correction_cluster[:, [:x, :y]];
Variable selection rationale
Adding other parameters for the grouping could introduce some artifacts, which is obviously undefined behaviour. Wanting to evaluate the homogeneity of correction curves as a function of time, this are the only parameters that should be taken into account.
The selected variables are :x
and :y
, which are defined as follows :
Where
"Definition of parametric time functions "
Hour slider :
Clustering
xxxxxxxxxx
6
1
begin
2
features = collect(Matrix(_grouping_cluster)'); # features to use for clustering
3
result = kmeans(features, 3, display=:iter) # run K-means for the 3 clusters
4
correction_cluster["group"] = result.assignments;
5
nothing
6
end
212
2
277
2
708
1
877
1
1649
2
2105
1
2753
3
2996
2
3265
2
3544
1
3724
1
3869
1
4038
3
4312
3
4646
2
4806
2
6793
1
7056
3
8062
1
8747
2
10341
2
10733
1
11575
3
11685
2
12465
1
12586
1
12804
3
13034
3
13209
2
13319
2
14187
3
14313
3
14545
2
xxxxxxxxxx
3
1
[ id => clust for (id, clust) in
2
zip(correction_cluster.idx, correction_cluster.group)
3
]
Are our clusters what we expected ?
0 hours
1 hour
8 hours
11 hours
0 hours
7 hours
18 hours
22 hours
3 hours
7 hours
10 hours
13 hours
16 hours
20 hours
2 hours
5 hours
14 hours
18 hours
11 hours
22 hours
1 hour
7 hours
21 hours
23 hours
12 hours
14 hours
18 hours
22 hours
1 hour
2 hours
17 hours
19 hours
23 hours
xxxxxxxxxx
1
1
Hour.(correction_cluster.datetime)
2
2
1
1
2
1
3
2
2
1
1
1
3
3
2
2
1
3
1
2
2
1
3
2
1
1
3
3
2
2
3
3
2
xxxxxxxxxx
1
1
correction_cluster.group
yes
xxxxxxxxxx
1
1
# Create a Dict containing cluster_numer => cluster_center
00:26:00
xxxxxxxxxx
1
1
Time(correction_cluster.datetime[1])
2
00:26:00
01:31:00
00:23:00
22:50:00
03:19:00
02:20:00
05:00:00
22:41:00
01:15:00
23:39:00
01:03:00
02:53:00
23:19:00
3
18:47:00
16:12:00
20:46:00
18:30:00
21:49:00
18:18:00
22:08:00
17:21:00
19:27:00
1
08:42:00
11:31:00
07:59:00
07:58:00
10:58:00
13:23:00
14:07:00
11:16:00
07:47:00
12:39:00
14:40:00
xxxxxxxxxx
9
1
hour_by_group = Dict([
2
# group was determined by kmeans
3
group => [
4
# We iterate over all corrections, but keep only those belonging
5
# to the current group of the comprehension.
6
Time(correction.datetime) for correction in eachrow(correction_cluster)
7
if correction.group == group
8
] for group in unique(correction_cluster.group)
9
])
2
212
277
1649
2996
3265
4646
4806
8747
10341
11685
13209
13319
14545
3
2753
4038
4312
7056
11575
12804
13034
14187
14313
1
708
877
2105
3544
3724
3869
6793
8062
10733
12465
12586
xxxxxxxxxx
8
1
idx_by_group = Dict([
2
# iterate over groups, determined by kmeans
3
group => [
4
# keep the index of corrections belongin to the current cluster :
5
correction.idx for correction in eachrow(correction_cluster)
6
if correction.group == group
7
] for group in unique(correction_cluster.group)
8
])
2
212:1:392
277:1:457
1649:1:1829
2996:1:3176
3265:1:3445
4646:1:4826
4806:1:4986
8747:1:8927
10341:1:10521
11685:1:11865
13209:1:13389
13319:1:13499
14545:1:14602
3
2753:1:2933
4038:1:4218
4312:1:4492
7056:1:7236
11575:1:11755
12804:1:12984
13034:1:13214
14187:1:14367
14313:1:14493
1
708:1:888
877:1:1057
2105:1:2285
3544:1:3724
3724:1:3904
3869:1:4049
6793:1:6973
8062:1:8242
10733:1:10913
12465:1:12645
12586:1:12766
xxxxxxxxxx
4
1
intervals_by_group = Dict([
2
key => create_intervals(glycaemia, value)
3
for (key, value) in idx_by_group
4
])
2
254.484
255.007
255.585
256.244
257.0
258.525
260.149
261.817
263.452
265.0
266.22
267.426
268.618
269.809
271.0
272.192
273.385
274.579
275.784
277.0
278.227
279.466
280.706
281.887
283.0
282.369
281.313
280.052
278.875
278.0
278.282
278.626
279.038
279.495
280.0
280.795
281.591
282.39
283.193
284.0
264.324
264.529
264.754
265.0
265.394
265.8
266.21
266.613
267.0
267.249
282.944
282.924
282.936
282.962
283.0
283.172
283.347
283.534
283.748
284.0
284.562
285.168
285.798
286.416
287.0
287.423
287.832
288.228
288.617
289.0
289.249
289.487
289.704
289.879
290.0
289.66
289.254
288.814
288.385
288.0
287.787
287.593
287.41
287.215
287.0
286.617
286.199
285.767
285.36
285.0
231.948
231.808
231.67
231.536
231.403
231.274
231.146
231.021
230.899
230.779
248.639
247.742
247.0
246.943
246.969
247.034
247.059
247.0
246.451
245.83
245.175
244.552
244.0
243.938
243.959
244.02
244.048
244.0
243.348
242.628
241.835
240.961
240.0
238.272
236.438
234.559
232.726
231.0
229.751
228.532
227.34
226.164
225.0
223.973
222.949
221.937
220.951
220.0
219.347
218.728
139.227
139.0
138.636
138.259
137.868
137.448
137.0
136.04
134.933
133.793
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
286.0
286.898
287.901
288.962
290.011
291.0
291.677
292.331
292.949
293.51
294.0
293.875
293.662
293.404
293.169
293.0
293.176
293.41
293.662
293.872
294.0
293.665
293.289
292.878
292.446
292.0
291.414
290.821
290.221
289.614
289.0
288.25
287.488
286.704
285.879
285.0
283.66
282.256
280.817
279.388
181.559
181.118
180.695
180.316
180.0
179.987
179.985
179.991
179.997
180.0
210.206
210.418
210.627
210.824
211.0
211.022
211.025
211.015
211.004
211.0
211.003
211.008
211.015
211.013
211.0
210.689
210.319
209.904
209.46
209.0
208.404
207.805
207.202
206.6
206.0
205.402
204.805
204.209
203.608
203.0
202.234
201.429
200.605
199.789
199.0
198.369
197.753
197.154
196.569
196.0
138.629
139.007
139.462
140.0
141.852
143.897
146.117
148.49
151.0
154.531
138.744
138.523
138.333
138.161
138.0
137.981
137.974
137.975
137.985
138.0
138.295
138.629
139.007
139.462
140.0
141.852
143.897
146.117
148.49
151.0
154.531
158.138
161.787
165.419
169.0
172.271
175.514
178.725
181.888
185.0
187.239
189.345
191.326
193.208
195.0
195.458
195.91
196.357
196.798
197.234
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
129.405
129.197
129.0
128.954
128.931
128.929
128.953
129.0
129.74
130.568
131.519
132.651
134.0
136.857
139.857
142.943
146.01
149.0
151.66
154.291
156.892
159.462
162.0
163.823
165.549
167.172
168.658
170.0
169.798
169.336
168.754
168.262
168.0
168.909
169.972
171.097
172.137
173.0
173.077
173.108
115.752
116.0
116.379
116.766
117.164
117.574
118.0
118.572
119.159
119.76
351.276
356.362
361.0
362.852
364.423
365.753
366.932
368.0
368.034
367.959
367.854
367.841
368.0
369.119
370.346
371.625
372.862
374.0
374.674
375.322
375.93
376.493
377.0
377.209
377.411
377.607
377.803
378.0
378.199
378.398
378.599
378.8
379.0
379.061
379.103
379.12
379.087
379.0
378.03
376.924
307.753
308.0
308.565
309.167
309.79
310.406
311.0
311.448
311.885
312.3
285.495
285.739
285.918
286.0
285.312
284.521
283.668
282.814
282.0
281.34
280.679
280.045
279.476
279.0
279.289
279.677
280.125
280.579
281.0
281.262
281.514
281.743
281.91
282.0
280.734
279.228
277.557
275.79
274.0
271.413
268.607
265.757
263.163
261.0
262.777
265.215
268.006
270.703
273.0
273.798
170.556
171.364
172.0
171.407
170.67
169.822
168.922
168.0
166.816
165.629
323.502
323.957
324.36
324.709
325.0
324.832
324.609
324.366
324.152
324.0
324.16
324.344
324.547
324.767
325.0
325.396
325.826
326.264
326.665
327.0
326.862
326.657
326.415
326.186
326.0
325.991
326.007
326.031
326.034
326.0
325.809
325.61
325.406
325.202
325.0
324.8
324.601
324.404
324.204
324.0
214.087
214.076
214.047
214.0
213.818
213.638
213.451
213.241
213.0
212.606
258.242
257.449
256.629
255.811
255.0
254.205
253.426
252.648
251.844
251.0
249.848
248.655
247.435
246.213
245.0
243.798
242.598
241.4
240.201
239.0
237.798
236.593
235.389
234.191
233.0
231.966
230.97
229.993
229.009
228.0
226.813
225.581
224.334
223.13
222.0
221.669
221.495
221.396
221.258
221.0
181.821
182.229
182.624
183.0
183.222
183.425
183.616
183.805
184.0
184.205
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
3
201.039
199.962
198.929
198.0
197.545
197.122
196.729
196.355
196.0
195.794
195.6
195.41
195.213
195.0
194.638
194.258
193.86
193.441
193.0
192.276
191.522
190.731
189.893
189.0
187.812
186.615
185.41
184.204
183.0
181.797
180.595
179.395
178.197
177.0
175.805
174.613
173.42
172.217
171.0
169.464
151.919
152.351
152.784
153.219
153.656
154.094
154.534
154.975
155.418
155.863
105.192
104.611
104.0
103.223
102.423
101.609
100.798
100.0
99.4694
98.9565
98.4999
98.1682
98.0
99.2108
100.609
102.117
103.606
105.0
106.022
106.981
107.916
108.91
110.0
112.062
114.32
116.662
118.927
121.0
122.259
123.458
124.617
125.791
127.0
128.392
129.828
131.278
132.679
134.0
134.413
134.685
147.347
147.0
146.965
146.977
147.011
147.027
147.0
146.809
146.611
146.406
130.968
130.971
130.982
131.0
131.159
131.335
131.528
131.75
132.0
132.69
133.446
134.257
135.112
136.0
137.318
138.681
140.082
141.524
143.0
144.969
147.06
149.18
151.191
153.0
153.547
153.944
154.253
154.584
155.0
155.788
156.649
157.527
158.329
159.0
158.889
158.696
158.451
158.209
158.0
157.939
219.406
219.219
219.0
218.611
218.195
217.771
217.367
217.0
216.791
216.589
249.614
252.834
255.966
259.0
260.576
261.95
263.134
264.146
265.0
264.573
264.065
263.466
262.781
262.0
260.634
259.244
257.833
256.417
255.0
253.475
251.967
250.432
248.792
247.0
243.99
240.829
237.564
234.272
231.0
227.624
224.25
220.871
217.457
214.0
209.887
205.61
201.277
197.038
193.0
189.922
143.608
146.424
149.0
149.692
150.245
150.648
150.903
151.0
150.086
149.133
269.72
271.148
272.581
274.0
275.404
276.805
278.204
279.602
281.0
282.27
283.532
284.765
285.928
287.0
287.306
287.507
287.648
287.798
288.0
288.388
288.803
289.233
289.637
290.0
289.869
289.617
289.314
289.085
289.0
290.214
291.678
293.255
294.741
296.0
296.101
296.06
295.952
295.907
296.0
296.753
270.215
269.614
269.0
268.073
267.074
266.034
264.999
264.0
263.184
262.407
111.956
111.792
111.539
111.265
111.0
110.632
110.277
109.913
109.495
109.0
107.888
106.691
105.445
104.203
103.0
101.956
100.919
99.9024
98.9249
98.0
97.5258
97.1036
96.7203
96.3569
96.0
95.7872
95.5964
95.4147
95.2202
95.0
94.3323
93.5931
92.7939
91.9257
91.0
89.1061
86.9793
84.7784
82.7324
81.0
122.646
124.779
126.604
128.0
127.285
126.5
125.656
124.818
124.0
123.2
164.067
165.143
166.2
167.162
168.0
167.129
165.924
164.534
163.177
162.0
161.542
161.185
160.875
160.497
160.0
158.343
156.43
154.424
152.56
151.0
151.15
151.454
151.894
152.415
153.0
154.139
155.295
156.481
157.712
159.0
160.745
162.547
164.38
166.206
168.0
169.378
170.727
171.999
173.106
174.0
319.258
320.579
321.858
323.0
323.502
323.957
324.36
324.709
325.0
324.832
149.248
149.0
148.309
147.55
146.738
145.883
145.0
143.628
142.134
140.615
139.205
138.0
137.884
137.853
137.889
137.944
138.0
138.179
138.356
138.538
138.75
139.0
139.72
140.531
141.388
142.226
143.0
143.317
143.588
143.802
143.942
144.0
143.288
142.46
141.58
140.739
140.0
139.75
139.55
139.38
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
1
229.347
229.566
229.788
230.0
230.202
230.401
230.599
230.799
231.0
231.204
231.409
231.616
231.813
232.0
231.889
231.719
231.504
231.26
231.0
230.604
230.205
229.802
229.4
229.0
228.605
228.216
227.826
227.423
227.0
226.423
225.827
225.217
224.606
224.0
223.399
222.799
222.2
221.6
221.0
220.399
205.664
206.841
208.0
209.015
210.026
211.03
212.022
213.0
213.816
214.594
203.249
204.471
205.664
206.841
208.0
209.015
210.026
211.03
212.022
213.0
213.816
214.594
215.359
216.153
217.0
218.325
219.733
221.185
222.621
224.0
225.062
226.09
227.087
228.056
229.0
229.523
230.0
230.42
230.758
231.0
230.481
229.869
229.207
228.569
228.0
227.769
227.585
227.423
227.236
227.0
153.845
153.952
154.03
154.0
153.444
152.798
152.114
151.497
151.0
151.626
172.203
172.0
171.795
171.587
171.38
171.183
171.0
171.136
171.353
171.605
171.836
172.0
171.845
171.665
171.459
171.238
171.0
170.622
170.236
169.84
169.429
169.0
168.416
167.807
167.188
166.581
166.0
165.582
165.19
164.81
164.418
164.0
163.419
162.812
162.193
161.585
161.0
160.565
160.142
159.737
221.0
220.369
219.544
218.617
217.738
217.0
216.935
216.959
217.028
217.057
203.847
205.0
205.841
206.654
207.443
208.223
209.0
209.65
210.298
210.925
211.498
212.0
211.902
211.735
211.514
211.264
211.0
210.602
210.202
209.801
209.4
209.0
208.601
208.204
207.807
207.406
207.0
206.446
205.863
205.258
204.635
204.0
203.212
202.396
201.572
200.767
200.0
199.392
198.79
198.194
181.0
180.621
180.169
179.692
179.286
179.0
180.001
181.262
182.641
183.934
183.934
185.0
185.077
185.066
185.005
184.971
185.0
185.378
185.824
186.292
186.7
187.0
186.532
185.972
185.342
184.677
184.0
183.076
182.158
181.204
180.165
179.0
177.229
175.438
173.628
171.815
170.0
168.164
166.307
164.462
162.681
161.0
160.087
159.273
158.522
157.776
157.0
156.193
155.376
154.554
194.0
195.061
196.123
197.166
198.132
199.0
198.623
198.01
197.272
196.565
181.62
183.0
182.839
182.513
182.058
181.542
181.0
180.014
178.957
177.882
176.878
176.0
176.321
176.797
177.414
178.153
179.0
180.742
182.579
184.455
186.281
188.0
189.242
190.452
191.636
192.817
194.0
195.061
196.123
197.166
198.132
199.0
198.623
198.01
197.272
196.565
196.0
195.961
195.973
196.012
104.0
103.223
102.423
101.609
100.798
100.0
99.4694
98.9565
98.4999
98.1682
193.298
195.0
195.756
196.33
196.812
197.339
198.0
199.439
200.95
202.545
204.225
206.0
208.656
211.399
214.212
217.085
220.0
223.586
227.353
231.148
234.748
238.0
238.947
239.652
240.168
240.599
241.0
241.001
240.99
240.976
240.976
241.0
241.199
241.44
241.688
241.886
242.0
241.496
240.914
240.279
163.0
163.186
163.411
163.651
163.855
164.0
163.393
162.667
161.843
160.948
223.44
223.227
223.0
222.627
222.24
221.84
221.426
221.0
220.419
219.809
219.186
218.577
218.0
217.743
217.55
217.391
217.217
217.0
216.222
215.395
214.464
213.35
212.0
209.0
205.849
202.585
199.289
196.0
192.466
188.929
185.37
181.733
178.0
172.852
167.408
161.819
156.299
151.0
147.079
143.283
172.968
173.0
173.548
174.198
174.883
175.506
176.0
175.719
175.361
174.941
251.0
252.768
254.773
256.908
259.019
261.0
262.381
263.751
265.033
266.141
267.0
266.65
266.259
265.834
265.412
265.0
264.598
264.205
263.818
263.418
263.0
262.125
261.154
260.117
259.055
258.0
256.825
255.643
254.451
253.238
252.0
250.471
248.906
247.306
245.67
244.0
242.041
240.061
238.059
236.039
136.004
136.009
136.014
136.011
136.0
135.696
135.339
134.935
134.487
134.0
208.009
209.017
210.015
211.0
211.671
212.269
212.827
213.393
214.0
214.776
215.566
216.368
217.18
218.0
218.964
219.946
220.944
221.962
223.0
224.368
225.825
227.307
228.72
230.0
230.355
230.602
230.766
230.89
231.0
230.846
230.681
230.497
230.273
230.0
229.262
228.446
227.591
226.763
226.0
225.756
220.729
219.319
218.0
217.635
217.45
217.36
217.239
217.0
215.836
214.558
240.756
241.424
242.0
242.24
242.459
242.657
242.838
243.0
243.016
243.02
243.016
243.009
243.0
242.852
242.687
242.502
242.274
242.0
240.927
239.665
238.324
237.066
236.0
236.081
236.326
236.645
236.9
237.0
236.444
235.835
235.197
234.577
234.0
233.585
233.181
232.786
232.393
232.0
231.608
231.216
75.2105
74.0
72.6239
71.2022
69.7628
68.3528
67.0
66.1248
65.3313
64.5834
xxxxxxxxxx
4
1
glycaemiae_by_group = Dict([
2
group => [glycaemia[interval] for interval in intervals]
3
for (group, intervals) in intervals_by_group
4
])
xxxxxxxxxx
1
1
plot_intervals(glycaemia, intervals_by_group[1], mean_time(hour_by_group[1]))
xxxxxxxxxx
1
1
plot_intervals(glycaemia, intervals_by_group[2], mean_time(hour_by_group[2]))
xxxxxxxxxx
1
1
plot_intervals(glycaemia, intervals_by_group[3], mean_time(hour_by_group[3]))
2×3 Array{Float64,2}:
-0.7785798124408909 0.8576076213926156 0.28581369995861017
0.20596893623295562 0.25317697866235817 -0.8357671753585296
xxxxxxxxxx
1
1
result.centers