Add measles ABM template support - #16
Conversation
|
No rush to get to this @clorton. This is meant to be an example of using jenner-mcp with laser projects (@jonathanhhb). copilot agent (gpt 5.4) + jenner-mcp |
There was a problem hiding this comment.
Pull request overview
This PR adds support for generating and emitting a measles-specific ABM template (script + plotting helpers + config) and wires the CLI/ABM loader to output those artifacts when --model MEASLES is selected.
Changes:
- Added
measles.pyandmeasles_plot.pyABM template modules underlaser.init.models. - Updated ABM loader and CLI routing to recognize
MEASLESand emit measles-specific scripts/config. - Added runtime dependencies (
laser-measles,polars) and tests for measles template import/emission.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_models.py | Extends module-existence tests to include measles and measles_plot. |
| tests/test_loaders.py | Adds ABM loader tests ensuring MEASLES emits the expected scripts/config and avoids generic outputs. |
| src/laser/init/models/measles.py | New measles ABM template script using laser-measles. |
| src/laser/init/models/measles_plot.py | New measles plotting helper module for ABM outputs. |
| src/laser/init/models/init.py | Updates package docstring to mention measles templates. |
| src/laser/init/loaders/abm.py | Adds measles-specific YAML template and emission path. |
| src/laser/init/cli.py | Adds MEASLES to CLI model choices and loader mapping. |
| pyproject.toml | Declares new runtime dependencies required by measles templates. |
| CHANGELOG.md | Documents the new measles ABM template support and dependencies. |
Comments suppressed due to low confidence (1)
src/laser/init/cli.py:465
- Selecting --mode MPM with --model MEASLES will currently crash with a KeyError when indexing the loader map. It would be better to validate the (mode, model) combination and raise a ClickException with a clear message (or otherwise prevent MEASLES from being used with MPM).
"ABM/MEASLES": abm.AbmLoader,
"MPM/SI": mpm.MpmLoader,
"MPM/SIR": mpm.MpmLoader,
"MPM/SEIR": mpm.MpmLoader,
}[f"{mode.upper()}/{model.upper()}"]()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from matplotlib.backends.backend_pdf import PdfPages | ||
|
|
||
|
|
||
| def show_plots(model, scenario: pl.DataFrame, output_dir: Path | None, name: str = "measles") -> Path: |
| spatial_attack_rate, | ||
| infectious_over_time, | ||
| ] | ||
| figs = [plot_func(model, scenario) for plot_func in plots] |
|
Superseded by #24 — same content, rebased on current |
|
Supplanted by #24 |
Summary
Testing