Skip to content

Add measles ABM template support - #16

Closed
krosenfeld-IDM wants to merge 2 commits into
laser-base:mainfrom
krosenfeld-IDM:laser-measles-template
Closed

Add measles ABM template support#16
krosenfeld-IDM wants to merge 2 commits into
laser-base:mainfrom
krosenfeld-IDM:laser-measles-template

Conversation

@krosenfeld-IDM

Copy link
Copy Markdown
Collaborator

Summary

  • add a measles-specific ABM template and plotting helpers
  • route the ABM loader and CLI to emit measles model files and config
  • add runtime dependencies and tests covering measles template generation

Testing

  • not run

@krosenfeld-IDM

krosenfeld-IDM commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator Author

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

@jonathanhhb
jonathanhhb requested a review from Copilot July 31, 2026 02:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py and measles_plot.py ABM template modules under laser.init.models.
  • Updated ABM loader and CLI routing to recognize MEASLES and 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]
@jonathanhhb

Copy link
Copy Markdown
Collaborator

Superseded by #24 — same content, rebased on current main with three conflicts resolved. Original authorship credit noted in the new PR. Closing this one.

@jonathanhhb

Copy link
Copy Markdown
Collaborator

Supplanted by #24

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.

4 participants