[Python] How to Force Initial Blood Glucose to Start at 200 mg/dL in a Diabetes Simulation...

Discussão em 'Python' iniciado por Stack, Junho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working with a diabetes simulation (using a modified Padova simulator from this respiratory) where I need the Initial blood glucose (BG) to start at 200 mg/dL instead of the default value. I am trying to implement this for people with diabetes as part of research.

    Despite trying to:

    • Override initial blood glucose in the matched patient,
    • Modify get_state() or reset() in the Scenario class,
    • Adjust the controller's initial state,

    The simulation still starts at the default value (e.g., ~150 mg/dL).

    Code for Overriding get_state() or reset():

    class CustomMealScenario(Scenario):
    def __init__(self, start_time=None):
    super().__init__(start_time)
    self.initial_glucose = 200 # Target starting glucose

    def reset(self):
    state = super().reset()
    state.G = self.initial_glucose # Try to override
    return state


    What am I doing wrong?

    Continue reading...

Compartilhe esta Página