Skip to content

Fix basal pump units and Gym action-space limits - #99

Open
LI-Jialu wants to merge 1 commit into
jxx123:masterfrom
LI-Jialu:fix/pump-unit-contract
Open

Fix basal pump units and Gym action-space limits#99
LI-Jialu wants to merge 1 commit into
jxx123:masterfrom
LI-Jialu:fix/pump-unit-contract

Conversation

@LI-Jialu

Copy link
Copy Markdown

Summary

  • convert basal requests from U/min to U/hour before applying the pump increment and limits
  • expose basal limits in controller units (U/min) and use them in Gym and Gymnasium action spaces
  • document the action units and add Insulet, Cozmo, Gym, and Gymnasium regression tests
  • regenerate the deterministic trajectory fixture and its derived risk expectations

Rationale

pump_params.csv stores basal increments and limits in U/hour, while controller actions and the patient model use U/min. The previous implementation multiplied basal rates by the U-to-pmol conversion constant before applying the pump parameters, so realistic rates were effectively not quantized and the Gym upper bound was exposed as 30 U/min instead of 30 U/hour.

This addresses the basal/action-space portion of #71. Bolus behavior is intentionally unchanged because its interval/amount API semantics require a separate compatibility discussion. Patient equations, meals, rewards, and termination thresholds are unchanged.

Behavior impact

  • Insulet maximum basal action: 0.5 U/min (30 U/hour)
  • Cozmo maximum basal action: 35/60 U/min
  • deterministic 48-hour adolescent#001 fixture: BG RMSE 0.87 mg/dL versus the old fixture, maximum absolute BG change 1.56 mg/dL, and 70-180 mg/dL TIR remains 100%

Testing

Ran the full unittest suite: 20 tests passed in 302.845 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants