Skip to content

Support ModelManager's post_processor hook; UQ docs#217

Merged
drbergman merged 5 commits into
mainfrom
feature/post-simulation-cleanup
Jul 8, 2026
Merged

Support ModelManager's post_processor hook; UQ docs#217
drbergman merged 5 commits into
mainfrom
feature/post-simulation-cleanup

Conversation

@drbergman

@drbergman drbergman commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • ModelManager now runs a user post_processor callback between two simulator hooks: a non-destructive postSimulationProcessing and a new destructive postSimulationCleanup, so a callback always sees intact simulation output before PCMM prunes it. This moves PCMM's pruning (previously in postSimulationProcessing) into the new postSimulationCleanup.
  • Fixes a latent bug found while testing this: pathToOutputFolder(::Integer) in src/loader.jl shadowed ModelManager's re-exported generic function instead of extending it, making the SimulationProcess-argument method (needed by a post_processor) unreachable from PCMM's namespace. Removed — PCMM now relies purely on ModelManager's pathToOutputFolder.
  • Docs: adds a monadsTable section (new ModelManager export), documents batch run(Vector) and the max_evaluations budget behavior (now enforced before each batch, and counts particles/monads not simulations), and renames the docs nav section "Experiments" → "Uncertainty Quantification" to match ModelManager's naming.
  • Bumps PhysiCellModelManager to 0.3.3.

⚠️ Dependency note

This branch was developed and tested against a local dev checkout of ModelManager (the version with postSimulationCleanup / the reordered hooks / monadsTable is not yet registered). CI on this PR will likely fail to resolve/precompile against the currently registered ModelManager 0.7.x until that version is released. Do not treat that as a regression in this PR — hold merge until the corresponding ModelManager release lands, then re-run CI.

Test plan

  • Full local suite run (Pkg.test()) against the ModelManager dev checkout, including a new PrunerTests.jl case: a post_processor reading pathToOutputFolder(sp) sees output present (via output*.mat files) during the callback, and confirms it's pruned only afterward.
  • Existing no-callback pruning assertions (Loader/Population/Substrate tests) still pass — no regression when post_processor isn't used.
  • Re-run CI once a ModelManager release with the reordered hooks is available.

🤖 Generated with Claude Code

ModelManager now runs a user post_processor callback between two
simulator hooks: a non-destructive postSimulationProcessing and a
destructive postSimulationCleanup, so a callback always sees intact
output before PCMM prunes it. This moves PCMM's pruning (previously
in postSimulationProcessing) into the new postSimulationCleanup hook,
and removes a stray pathToOutputFolder(::Integer) definition in
loader.jl that shadowed ModelManager's re-exported generic function
instead of extending it, making the SimulationProcess-argument method
unreachable from PCMM's namespace.

Also documents two other inherited ModelManager changes (batch
run(Vector) and the max_evaluations budget now enforced before each
batch), adds monadsTable docs, and renames the docs nav section
"Experiments" to "Uncertainty Quantification" to match ModelManager.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 8, 2026 16:21

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 aligns PhysiCellModelManager.jl with ModelManager’s new per-simulation hook ordering by moving PCMM’s destructive “pruning + err-file handling” work into postSimulationCleanup, ensuring a user post_processor callback runs against intact simulation outputs. It also removes a pathToOutputFolder(::Integer) definition that previously shadowed (rather than extended) ModelManager’s generic, and updates UQ documentation (including monadsTable, batch run(Vector), and max_evaluations semantics) while bumping the package version.

Changes:

  • Move destructive post-simulation behavior from postSimulationProcessing to postSimulationCleanup so post_processor sees un-pruned outputs.
  • Remove pathToOutputFolder(::Integer) from src/loader.jl to avoid shadowing ModelManager’s API.
  • Add/adjust docs for monadsTable, batched run(Vector), and max_evaluations behavior; bump version to 0.3.3.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/test-scripts/PrunerTests.jl Adds a regression test asserting outputs are intact during post_processor and pruned after cleanup.
src/simulator_interface.jl Switches PCMM’s hook implementation to extend postSimulationCleanup and updates hook docs.
src/loader.jl Removes a local pathToOutputFolder(::Integer) that shadowed ModelManager’s generic.
README.md Documents the new post_processor hook behavior and where results are stored/read.
Project.toml Bumps package version to 0.3.3.
progress.md Adds a development log entry describing the hook split and doc updates.
PRD.md Adds a feature spec section describing the post-processing hook contract and QoI behavior.
docs/src/man/querying_parameters.md Documents monadsTable as the monad-level analogue of simulationsTable.
docs/src/man/examples.md Adds recipe for batching pre-built trials into a single run(Vector) call.
docs/src/man/calibration.md Clarifies max_evaluations enforcement and that it counts particles/monads, not simulations.
docs/make.jl Renames nav section “Experiments” → “Uncertainty Quantification”.

Comment thread src/simulator_interface.jl
Comment thread src/simulator_interface.jl
Comment thread src/simulator_interface.jl
drbergman and others added 2 commits July 8, 2026 12:49
Task B: builds on the post_processor hook to give users a one-line
QoI callback for per-cell-type population counts at the final
snapshot or any indexed save, instead of requiring them to hand-write
a callback around PhysiCell loaders.

Also documents the post-processing workflow end-to-end in
analyzing_output.md (deferred until this builder existed), and notes
in CLAUDE.md/PRD.md that wiring these builders into sensitivity
analysis and calibration is a separate, not-yet-done step.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@drbergman
drbergman merged commit a408be6 into main Jul 8, 2026
12 checks passed
@drbergman
drbergman deleted the feature/post-simulation-cleanup branch July 8, 2026 21:43
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