-
Notifications
You must be signed in to change notification settings - Fork 0
/
phase3test.py
51 lines (31 loc) · 1.43 KB
/
phase3test.py
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
46
47
48
49
50
51
from gym.envs.registration import register
from simglucose.sensor.cgm import CGMSensor,CGMSensorWithoutNoise
from simglucose.actuator.pump import InsulinPump
from simglucose.patient.t1dpatient import T1DPatient
from simglucose.simulation.env import T1DSimEnv
from simglucose.simulation.scenario import CustomScenario,ZeroScenario,DDPGScenario
from examples.apply_customized_controller import MyController
from simglucose.simulation.sim_engine import batch_sim,SimObjForKeras, SimObjForKeras2
from simglucose.controller.basal_bolus_ctrller import BBController
from datetime import timedelta
from datetime import datetime
register(
id='simglucose-adolescent2-v0',
entry_point='simglucose.envs:T1DSimEnv',
kwargs={'patient_name': 'adolescent#002'}
)
path = './results/phase3test1'
sim_time = timedelta(days=3)
now = datetime.now()
start_time = datetime.combine(now.date(), datetime.min.time())
patient = T1DPatient.withName('adolescent#002')
sensor = CGMSensorWithoutNoise.withName('Dexcom', seed=1)
pump = InsulinPump.withName('Insulet')
scenario = DDPGScenario(start_time=start_time,sim_time=sim_time, skip_meal=False)
print(scenario.my_scenario)
env = T1DSimEnv(patient, sensor, pump, scenario)
controller1 = MyController('simglucose-adolescent2-v0')
base_controller = BBController()
s1 = SimObjForKeras2(env, controller1, sim_time, base_controller, animate=False, path=path)
sim_instances = [s1]
results = batch_sim(sim_instances)