pymgipsim.Utilities.Scenario


Functions

load_scenario

save_scenario

Classes

controller

demographic_info

Model independent patient information.

input_generation

inputs

Stores all the possible inputs to all the possible models.

model

Model descriptor.

mscale

Model descriptor.

patient

Describes the patient/cohort.

scenario

Stores all the necessary information to uniquely define a simulation.

settings

General, simulator wide settings.

class controller(name: str, parameters: list)[source]

Bases: object

class demographic_info(body_weight_range: list = None, body_weight: list = None, renal_function_category: list = None, egfr: list = None, basal: list = None, height: list = None, total_daily_basal: list = None, carb_insulin_ratio: list = None, resting_heart_rate: list = None, correction_bolus: list = None, HbA1c: list = None, waist_size: list = None, baseline_daily_energy_intake: list = None, baseline_daily_energy_expenditure: list = None, baseline_daily_urinary_glucose_excretion: list = None)[source]

Bases: object

Model independent patient information.

Mirrors the demographic info field of the scenario JSON file.

Parameters:
  • body_weight – Body weights of the patients [kg].

  • egfr – Glomural filtration rates [mL/min/1.73 m^2 BSA]

  • basal – Basal insulin rates [U/hr].

  • height – Height [m].

  • total_daily_basal – [U]

class input_generation(fraction_cho_intake: list = None, fraction_cho_as_snack: list = None, net_calorie_balance: list = None, daily_energy_intake: list = None, meal_duration: list = None, snack_duration: list = None, breakfast_time_range: list = None, lunch_time_range: list = None, dinner_time_range: list = None, total_carb_range: list = None, am_snack_time_range: list = None, pm_snack_time_range: list = None, sglt2i_dose_magnitude: list = None, sglt2i_dose_time_range: list = None, breakfast_carb_range: list = None, lunch_carb_range: list = None, dinner_carb_range: list = None, am_snack_carb_range: list = None, pm_snack_carb_range: list = None, running_start_time: list = None, running_duration: list = None, running_incline: list = None, running_speed: list = None, cycling_start_time: list = None, cycling_duration: list = None, cycling_power: list = None)[source]

Bases: object

class inputs(meal_carb: Events = None, snack_carb: Events = None, sgl2i: Events = None, basal_insulin: Events = None, bolus_insulin: Events = None, bodyweighteffect: Events = None, heart_rate: Events = None, taud: Events = None, running_speed: Events = None, running_incline: Events = None, cycling_power: Events = None, METACSM: Events = None, energy_expenditure: Events = None, daily_energy_intake: Events = None, daily_energy_expenditure: Events = None, daily_urinary_glucose_excretion: Events = None)[source]

Bases: object

Stores all the possible inputs to all the possible models.

Mirrors the patient field of the scenario JSON file.

Note

Undefined/ not required inputs for a specific model are None.

Parameters:
  • meal_carb (Events) – Carb content of the meals [g].

  • snack_carb (Events) – Carb content of the snacks [g].

  • sgl2i (Events) – SGL2i drug intakes [mg].

  • basal_insulin (Events) – Basal insulin rates [U/hr].

  • bolus_insulin (Events) – Bolus insulin intakes [U].

  • heart_rate (Events) – Heart rate values [BPM].

  • taud (Events) – Meal carb absorption times [min].

class model(name: str = None, parameters: list = None, initial_conditions: list = None)[source]

Bases: object

Model descriptor.

Mirrors the model field of the scenario JSON file.

Parameters:
  • name – Name of the model (T1DM.Hovorka, T1DM.IVP, T2DM.Jauslin)

  • parameters – Array of model specific parameter values.

  • initial_conditions – Array of initial states for the simulation

class mscale(models: list = None, parameters: list = None)[source]

Bases: object

Model descriptor.

Mirrors the model field of the scenario JSON file.

Parameters:
  • name – Name of the model (T1DM.Hovorka, T1DM.IVP, T2DM.Jauslin)

  • parameters – Array of model specific parameter values.

  • initial_conditions – Array of initial states for the simulation

class patient(demographic_info: None = None, model: None = None, mscale: None = None, files: list = None, number_of_subjects: int = None)[source]

Bases: object

Describes the patient/cohort.

Mirrors the patient field of the scenario JSON file.

Parameters:
  • demographic_info (demographic_info) – Stores the model independent patient information.

  • model (model) – Model descriptor.

class scenario(settings: settings, input_generation: input_generation, inputs: inputs, patient: patient, controller: controller)[source]

Bases: object

Stores all the necessary information to uniquely define a simulation.

Mirrors the scenario JSON file.

Note

Undefined/ not required field are None.

Parameters:
  • settings (settings) – General, simulator wide settings.

  • input_generation (input_generation) – Defines parameters for random input generation.

  • inputs (inputs) – Defines the events (start time, magnitude and duration) of specific inputs.

  • patient (patient) – Describes the simulated virtual cohort.

class settings(sampling_time: int, simulator_name: str, solver_name: str, save_directory: str, start_time: int, end_time: int, random_seed: int, random_state: dict)[source]

Bases: object

General, simulator wide settings.

Mirrors the settings field of the scenario JSON file.

Parameters:
  • sampling_time – Sampling time of the simulation [min].

  • solver_name – ODE solver name (Euler or RK4)

  • number_of_subjects – Cohort simulation size.

  • start_time – Start time of the simulation in %d-%m-%Y %H:%M:%S datetime format.

  • end_time – End time of the simulation in %d-%m-%Y %H:%M:%S datetime format.

  • simulator_name – Currently openloop single scale, will be extended with more capabilities.