Simulator.UVAPadova package

Submodules

Simulator.UVAPadova.UVAPadovaSimulator module

class Simulator.UVAPadova.UVAPadovaSimulator.UvaPadovaSimulator(patient_name: str)[source]

Bases: object

This class can be store the current state of a simulation and can extend it by 5 minutes per step.

Note

This class was created exclusively to serve the API.

Parameters
  • patient (obj) – A VirtualPatientT1DMS object, which represents a virtual patient and controls the MATLAB engine.

  • scenario (obj) – A Scenario object, which provides a storage and interface for the simulation related information.

  • chLostFlag (bool) – A flag which indicates whether the meal could be considered according to the rules of the UvaPadovaSimulator or not.

  • tEndReal (int) – The duration of the simulation in minutes.

  • i_times (list(int)) – The list of minutes when was insulin intake.

  • meals (list(float)) – The list of the amounts of carbohydrate taken.

  • m_times (list(int)) – The list of minutes when was carbohydrate intake.

  • insulins (list(float)) – The list of the amounts of insulin taken.

  • sensor (str) – The type of the CGM sensor currently in use. Defaults to ‘guardianRT.scs’

  • pump (str) – The type of the insulin pump currently in use. Defaults to ‘Generic_1.pmp’

doSimulation(carbohydrate: float, insulin: float)[source]

This method extends the initialized simulation by 5 minutes. The method invokes the MATHLAB engine with an extended Scenario.

Parameters
  • carbohydrate (float) – The amount of carbohydrate intake, in the last five minutes (in grams). Zero if there wasn’t carbohydrate intake.

  • insulin (float) – The amount of insulin intake, in the last five minutes (in unites). Zero if there wasn’t insulin intake.

Returns

The blood glucose level value at the end of the simulation.

Simulator.UVAPadova.VirtualPatientT1DMS module

class Simulator.UVAPadova.VirtualPatientT1DMS.VirtualPatientT1DMS(patient_name: str, BGinit: list)[source]

Bases: object

VirtualPatientT1DMS class implements a virtual patient on the basis of the OE simulator, and controls the MATLAB engine.

Parameters
  • BGinit

  • patient (str) – Patient ID.

  • eng – Matlab engine for Python.

  • simulation_data (SimulationData) – Stores all the simulation related data.

  • hardwareN (dict) – Represents the “hardwareN” variable of the UVA/Padova simulator.

  • hardware (dict) – Represents the “hardware” variable of the UVA/Padova simulator.

  • rep (int) – Represents the “rep” variable of the UVA/Padova simulator.

  • bck_meals (matlab.double) – Represents the “bck_meals” variable of the UVA/Padova simulator.

  • bck_meal_announce (matlab.double) – Represents the “bck_meal_announce” variable of the UVA/Padova simulator.

  • bck_SQinsulin (dict) – Represents the “bck_SQinsulin” variable of the UVA/Padova simulator.

  • ind (int) – Represents the “ind” variable of the UVA/Padova simulator.

  • sc (dict) – Represents the “sc” variable of the UVA/Padova simulator.

  • result (dict) – Represents the “res_aux” variable of the UVA/Padova simulator.

  • bg (np.array) – Stores the simulated blood glucose trajectory.

plotHistoricalStates()[source]

Plots the result of the simulatePatient() function.

simulatePatient(simulation_data: dict)[source]

Simulates the patient based on the data given in the simulation_data argument.

Parameters

simulation_data (SimulationData) – Stores the simulation related information.

Module contents