You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks a lot for the implementation of this simulation!
While inspecting and playing around with the implementation I have found that the sensors sample_time affects the reported CHO and Insulin.
Using the second scenario defined in advanced_scenario.py and comparing the Dexcom (sample_size = 3.0) and GuardianRT (sample_size = 5.0), I come to the following with the Dexcom sensor:
The comparison between these two sensors shows the difference in reported CHO and insulin:
It seems that this is only a cosmetic error (I am guessing this by comparing the trajectories of BG). I am happy to provide a PR...
The logs from above have been created with with:
diff --git i/examples/advanced_tutorial.py w/examples/advanced_tutorial.py
index 1249c88..f194ad9 100644
--- i/examples/advanced_tutorial.py+++ w/examples/advanced_tutorial.py@@ -29,8 +29,8 @@ controller = BBController()
# Put them together to create a simulation object
s1 = SimObj(env, controller, timedelta(days=1), animate=False, path=path)
-results1 = sim(s1)-print(results1)+#results1 = sim(s1)+#print(results1)
# --------- Create Custom Scenario --------------
# Create a simulation environment
@@ -46,7 +46,7 @@ env = T1DSimEnv(patient, sensor, pump, scenario)
controller = BBController()
# Put them together to create a simulation object
-s2 = SimObj(env, controller, timedelta(days=1), animate=False, path=path)+s2 = SimObj(env, controller, timedelta(days=1), animate=True, path=path)
results2 = sim(s2)
print(results2)
diff --git i/simglucose/simulation/env.py w/simglucose/simulation/env.py
index 45a43cb..c96a6b1 100644
--- i/simglucose/simulation/env.py+++ w/simglucose/simulation/env.py@@ -79,6 +79,8 @@ class T1DSimEnv(object):
insulin += tmp_insulin / self.sample_time
BG += tmp_BG / self.sample_time
CGM += tmp_CGM / self.sample_time
+ print(f"\tmini_step: BG:\t{BG:4.3f}, measured CGM:\t{CGM:3.3f}, carbo (CHO):\t{CHO:3.3f} (tmp_CHO:{tmp_CHO:3.3f}), insulin:\t{insulin}")+ print(f"BG:\t{BG:4.3f}, measured CGM:\t{CGM:3.3f}, carbo (CHO):\t{CHO:3.3f}, insulin:\t{insulin}")
# Compute risk index
horizon = 1
The text was updated successfully, but these errors were encountered:
First of all, thanks a lot for the implementation of this simulation!
While inspecting and playing around with the implementation I have found that the sensors
sample_time
affects the reported CHO and Insulin.Using the second scenario defined in
advanced_scenario.py
and comparing the Dexcom (sample_size = 3.0
) and GuardianRT (sample_size = 5.0
), I come to the following with the Dexcom sensor:Note, that these are three steps around 7am, when according to the scenario 45 units of CHO are to be consumed.
The same simulation using GuardianRT:
The comparison between these two sensors shows the difference in reported CHO and insulin:
It seems that this is only a cosmetic error (I am guessing this by comparing the trajectories of BG). I am happy to provide a PR...
The logs from above have been created with with:
The text was updated successfully, but these errors were encountered: