Creating RL Agents for simglucose/PadovaT1D simulator.
-
Set up virtual environment
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Install simglucose in editable mode:
cd simglucose pip install -e . --config-settings editable_mode=compat cd ..
Installing simglucose in editable mode within the project directory allows for direct imports and potential modifications to the source code. This gives us much greater control for customization and enables effective debugging.
-
Run scripts from root dir
python -m src.main --cfg=<path to config file>
We use pytest for unit testing. Tests should be stored in the tests directory and should test basic functionality of any new helper functions added to the codebase. To run all tests:
cd tests
pytest -v --color=yesWe use pre-commit with ruff to check formatting and linting before commits are pushed. You can check this before making commits to the repository with the following:
pre-commit run --all-files.
├── .github/ # GitHub workflows for CI/CD tests
├── configs/ # Training and evaluation configuration YAMLs
├── results/ # Output from experiments: plots, logs, metrics, etc.
├── scripts/ # Bash scripts for launching jobs, one-off experiments, etc.
│ ├── experiments/ # Scripts and setups for running controlled experiments
│ └── watgpu/ # WatGPU bash scripts
├── simglucose/ # Custom fork of simglucose package
├── src/
│ ├── agents/ # Creating, loading, and managing agents
│ ├── environments/ # Custom Gym environments and reward functions
│ ├── training/ # Orchestration of training, prediction, and evaluation
│ ├── utils/ # Generic helper utilities
│ ├── __init__.py
│ └── main.py # Entry point for training/evaluation
├── tests/ # Unit and integration tests
├── .gitignore
├── .pre-commit-config.yaml # Pre-commit checks configuration
├── README.md
├── requirements.txt # Python package dependencies
└── setup.py # Install script to register `src` as a moduleThis repository includes simglucose as a git subtree. If you need to update or push changes to the simglucose fork, use the following commands in the root directory.
If the upstream simglucose repository has updates, you can pull them into the subtree:
git subtree pull --prefix=simglucose https://github.com/Blood-Glucose-Control/simglucose.git master --squashTo push changes made to simglucose back to the forked repository:
git subtree push --prefix=simglucose https://github.com/Blood-Glucose-Control/simglucose.git master