Skip to content

Model Output API#608

Draft
TimothyWillard wants to merge 15 commits intodevfrom
model-output-api
Draft

Model Output API#608
TimothyWillard wants to merge 15 commits intodevfrom
model-output-api

Conversation

@TimothyWillard
Copy link
Contributor

@TimothyWillard TimothyWillard commented Aug 21, 2025

Describe your changes.

This pull request adds gempyor.output for interacting with model outputs programmatically.

Blocked by #601.

Does this pull request make any user interface changes? If so please describe.

The user interface changes are...

Those are reflected in updates to the documentation in ...

What does your pull request address? Tag relevant issues.

This pull request addresses GH-...

@TimothyWillard TimothyWillard self-assigned this Aug 21, 2025
Fix `TypeError` caused by providing the subpopulation populations,
`list[int]`, to `check_parameter_positivity` by providing the
subpopulation names, `list[str]`. This would cause an error when trying
to construct an error message when it tried to join the subpopulation
names together. The exception was: `sequence item 0: expected str
instance, numpy.int64 found`.
Fixed typo in the name of the distribution creation helper in two places
in `inference_parameter.py`. Also corrected call to use
`DistributionABC.sample` method because a specific size was required.
Added a `support` property to the `DistributionABC` class which returns
a tuple of two numbers representing the upper and lower bounds
respectively. This property pulls said bounds from either the
`_lower/upper_bound` attributes if defined by the implementation or
`_lower/upper` properties if overridden by the implementation. Added to
the current examples to demonstrate usage. Minor modifications to the
commond distributions test was required.
Incorporated bounds provided by `DistributionABC.support` into the
`InferenceParameters` class for lower/upper bounds used in proposal
rejection. Also converted lower/upper bounds representation from list of
floats to numpy arrays of floats for performance reasons.
Used the 'simple_usa_statelevel' example to demonstrate how inference on
modifiers now supports more than 'truncnorm' distributions. Changed the
'truncnorm' usage in the seir modifiers section to use a 'gamma'
distribution with the same mean and variance.
Added unit tests and changed the API of
`gempyor.NPI.helpers.get_spatial_groups`. The API change moves away from
requiring a confuse configview to use the function, which pushes the
confuse wrangling to the caller. Improves unit testing and general
purpose usage and makes the function more stable as we move away from
confuse. Also simplified/improved the logic and enhanced the
documentation and type hints.
For ease of constructing and manipulating modifier spatial groups
converted the `SpatialGroups` typed dict to a frozen data class. This
allows for the continued typing support as well as adding support for
iterating over a `SpatialGroups` class in a consistent way. Also
migrated `get_spatial_groups` into the
`SpatialGroups.from_subpopulations` class method. Added corresponding
documentation and unit tests.
* Address suggestions from `pylint` to make the code more readable as
	well as add documentation/type hints.
* Added initial, highly targeted unit tests. Including for the
	`inject_proposal` method.
* Consolidated `hit_*` methods into the `check_in_bound` method.
* Made the `{l/u}bs` attributes private and extract them from the
	distribution object on behalf of the user in `add_single_parameter`.
* Added steps, including script, to run simulation and create a ground
	truth file from it.
* Added a `Makefile` to quickly run everything in the folder.
* Added the EMCEE and R inference configuration files.
* Add `--from-chains` option to `flepimop simulate` to read a `Chains`
	object from a pickle file.
* Rename `nchains` to `nslots` in `gempyor.simulate`.
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.

1 participant