Skip to content

Rename latent process classes and update tests and documentation#781

Merged
cdc-mitzimorris merged 40 commits intomainfrom
mem_778_rename
Apr 13, 2026
Merged

Rename latent process classes and update tests and documentation#781
cdc-mitzimorris merged 40 commits intomainfrom
mem_778_rename

Conversation

@cdc-mitzimorris
Copy link
Copy Markdown
Collaborator

This PR implements the first set of name changes in issue #778:

class SharedInfections -> PopulationInfections
class HierarchicalInfections -> SubpopulationInfections
constructor arg initial_log_rt_rv -> log_rt_time_0_rv.

The tests and documentation have been updated accordingly.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Renames latent infection process classes and constructor arguments to better match epidemiological terminology, updating tests and tutorials to reflect the new public-facing API.

Changes:

  • Renamed SharedInfectionsPopulationInfections and HierarchicalInfectionsSubpopulationInfections, including updated exports.
  • Renamed constructor arg initial_log_rt_rvlog_rt_time_0_rv and propagated through model builder, tests, and integration coverage.
  • Updated documentation/tutorials and navigation to reference the new class/argument names.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/test_subpopulation_infections.py Updates unit tests to use SubpopulationInfections + renamed constructor arg and trace-site prefixes.
test/test_pyrenew_builder.py Updates builder tests to configure SubpopulationInfections and new arg name.
test/test_population_infections.py Migrates unit tests from SharedInfections to PopulationInfections and updates deterministic-site expectations.
test/test_interface_coverage.py Updates interface coverage to instantiate SubpopulationInfections and use renamed arg.
test/integration/test_population_infections_he.py Updates integration test to new deterministic variable names for PopulationInfections.
test/integration/conftest.py Updates integration model builder wiring to PopulationInfections + new arg/process param names.
test/conftest.py Replaces latent fixtures with subpopulation_infections and adds population_infections fixture.
pyrenew/model/pyrenew_builder.py Updates docstring example for latent class naming.
pyrenew/model/multisignal_model.py Updates docstring example for latent class naming.
pyrenew/latent/subpopulation_infections.py Renames class and constructor arg; updates sampling to use log_rt_time_0_rv.
pyrenew/latent/population_infections.py Renames class and constructor arg; renames process parameter and deterministic-site names.
pyrenew/latent/base.py Updates base-class docs to reference new class names.
pyrenew/latent/init.py Updates public exports to PopulationInfections and SubpopulationInfections.
docs/tutorials/latent_subpopulation_infections.qmd Renames tutorial content and examples to SubpopulationInfections / PopulationInfections + new arg name.
docs/tutorials/latent_infections.qmd Updates single-population latent tutorial to PopulationInfections and new arg/process parameter names.
docs/tutorials/building_multisignal_models.qmd Updates builder tutorial examples and narrative to SubpopulationInfections + log_rt_time_0_rv.
docs/tutorials/.pages Updates tutorials nav entry to latent_subpopulation_infections.md.
docs/index.md Updates docs landing page links to new tutorial names.
Comments suppressed due to low confidence (5)

pyrenew/latent/population_infections.py:3

  • Module docstring has a typo: "Populaton-level" should be "Population-level".
    pyrenew/latent/population_infections.py:30
  • The class docstring math markup has an extra space ("$\ mathcal{R}(t)$"), which may render incorrectly in generated docs. Consider changing it to "$\mathcal{R}(t)$".
    docs/tutorials/latent_subpopulation_infections.qmd:116
  • This tutorial text still references the old initial-condition name initial_log_rt. It should be updated to log_rt_time_0 to match the renamed constructor argument (log_rt_time_0_rv).
    docs/tutorials/latent_subpopulation_infections.qmd:183
  • This print statement labels the value as "Log Rt" but prints exp(log_rt_time_0), which is Rt (not log Rt). Update the label or the printed value so they match.
    pyrenew/latent/subpopulation_infections.py:30
  • After renaming the class to SubpopulationInfections, several docstrings in this module still use the old phrasing "hierarchical infections" (e.g., init/validate/sample docstrings). Updating these strings will keep the generated API docs consistent with the new public name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.44%. Comparing base (0078fbd) to head (f0de42f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #781   +/-   ##
=======================================
  Coverage   98.44%   98.44%           
=======================================
  Files          51       51           
  Lines        1675     1675           
=======================================
  Hits         1649     1649           
  Misses         26       26           
Flag Coverage Δ
unittests 98.44% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 11, 2026

Thank you for your contribution @cdc-mitzimorris 🚀! Your github-pages is ready for download 👉 here 👈!
(The artifact expires on 2026-04-20T18:25:50Z. You can re-generate it by re-running the workflow here.)

* **The shape is set by `initial_log_rt`**.<br>
`initial_log_rt` enters the model in two places: it is the starting point of
* **The shape is set by `log_rt_time_0`**.<br>
`log_rt_time_0` enters the model in two places: it is the starting point of
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The latex explanation below still uses the old name $e^{\text{initial\_log\_rt}}$. Perhaps search the codebase for any latex versions of the olde names.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good catch. thanks!

Copy link
Copy Markdown
Collaborator

@damonbayer damonbayer left a comment

Choose a reason for hiding this comment

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

Please review the latex portions of the tutorials / docs for any names that should have been changed. Otherwise, this looks good!

@cdc-mitzimorris cdc-mitzimorris merged commit e47ba44 into main Apr 13, 2026
8 checks passed
@cdc-mitzimorris cdc-mitzimorris deleted the mem_778_rename branch April 13, 2026 18:49
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.

3 participants