Skip to content

KDE plot and various tweaks. - #307

Open
Averydx wants to merge 18 commits into
2.0-betafrom
KDE
Open

Averydx wants to merge 18 commits into
2.0-betafrom
KDE

Conversation

@Averydx

@Averydx Averydx commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This branch contains the KDE plot and tweaks allowing the user to choose whether to cycle the kwargs over the geo or quantity. The notebooks plotting_example.ipynb and pf_v_enkf.ipynb show a number of examples of plots in action.
Note these notebooks need to be removed before merge commit.

JeffreyCovington and others added 6 commits March 24, 2026 10:04
Includes ForecastSimulator, ParticleFilterSimulator, and EnsembleKalmanFilterSimulator as top-level interfaces.
* Edited comments and date range

* fix_missing added to ADRIO

* Edits to ADRIO messaging and type usage based on Tyler's comments

* Changed valid date range to start at 1-1-2020.

* Ruff linting
* Implement RandomLocationsAndRandomSeed class

Added RandomLocationsAndRandomSeed class for random infection seeding.

* Fixed formatting.
Co-authored-by: Tyler Coles <tyler.coles@nau.edu>
Refactor and reorganization of the filtering-to-forecasting workflow. Class names are now more explicit and the API is more consistent across classes. Also includes plotting functionality for the output of pipeline simulations.

* Implementation of the filtering and forecasting pipeline subsystem.

Includes ForecastSimulator, ParticleFilterSimulator, and EnsembleKalmanFilterSimulator as top-level interfaces.

* Updated type annotations. Added ABC to abstract classes.

* Added override decorator as appropriate. Updated operations on dictionaries of unknown parameters to have consistent usage of keys when iterating over them.

* Added validation upon construction for only using a `Gaussian` likelihood with an `EnsembleKalmanFilterSimulator`.

* Renamed likelihoods to be more explicit. Reparameterized the Gaussian likelihood in terms of standard deviation for consistency. Added and updated documentation and annotations.

* Updated type annotations. Added ABC to abstract classes.

* Added override decorator as appropriate. Updated operations on dictionaries of unknown parameters to have consistent usage of keys when iterating over them.

* Added validation upon construction for only using a `Gaussian` likelihood with an `EnsembleKalmanFilterSimulator`.

* Renamed likelihoods to be more explicit. Reparameterized the Gaussian likelihood in terms of standard deviation for consistency. Added and updated documentation and annotations.

* Updated line formatting.

* Updated documentation.

* Changed validation of dynamic parameters  to work properly with array-valued hyperparameters.

* Changed the `posterior_values` of the particle filter and EnKF to have "realizations" as the first dimension.

* Forecasting code cleanup (#293)

* Plotting functionality.

* Error correction.

* Typing

* modified:   epymorph/forecasting/filter_plot.py

* Finally?

* EnKF refactor (#294)

* Refactor filter to reduce code repetition.

* Added support for non-Gaussian likelihoods in the EnKF.

* Added support for observing multiple strata.

* Allow unknown params to use wildcards.

* Refactor filter to reduce code repetition.

* Added support for non-Gaussian likelihoods in the EnKF.

* Added support for observing multiple strata.

* Allow unknown params to use wildcards.

* Cleaned up redundant shape calculations.

* Messaging and refactor of pipeline simulators. (#295)

* Refactor filter code.

* Moved pipeline_messaging

* Typing updates.

* Updated documentation.

* Formatting.

* Reorganized internal forecasting utility functions.

* Updated typing in FilterOutput.

* Added support for movement data by visit or home node in pipeline simulators.

* Typing and doc improvements in the munge.

* modified:   tests/fast/tools/data_test.py

* modified:   epymorph/forecasting/munge_realizations.py

* Updated typing, documentation, and naming conventions for pipeline plots.

* Fixed incorrect import.

* Adjusted typing for plotting on multiple matplotlib axes.

* Updated documentation and typing.

---------

Co-authored-by: Avery Drennan <aad473@nau.edu>
Co-authored-by: averydx <avery.drennan@gmail.com>
…gs cycle over the geos or the quantities in *_plt functions. The notebooks plotting_example.ipynb and pf_v_enkf.ipynb contain a number of examples. Note these notebooks should be removed before final merge.
@Averydx
Averydx requested a review from JeffreyCovington July 6, 2026 01:35

@JeffreyCovington JeffreyCovington left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See comments.

Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py
@Averydx

Averydx commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

I noticed some issues with the way I was deleting yticks from unused subplots. If sharey = True this deletes the global yticks from the plot. Also, we could just delete unused subplots but if sharex = True and the unused plots are in the last row then labels for a column will be omitted.

@Averydx

Averydx commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

The notebooks for testing various plots are linked below.

plotting_example.ipynb
pf_v_enkf.ipynb

@Averydx Averydx self-assigned this Jul 10, 2026
@Averydx Averydx added the enhancement New feature or request label Jul 10, 2026
Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated

@JavadocMD JavadocMD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Whoops, I forgot to "start review" with the above comments, but see above comments. I think some of the guidance on docstring style should be applied broadly across the different plot functions.

Averydx added 2 commits July 30, 2026 09:06
…ctions. Docstrings have been updated, and some small refactors have been made.
@Averydx

Averydx commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@JavadocMD JavadocMD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See inline.

Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated

return ax_list

def spaghetti(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Docstring describes spaghetti plot as "Produces a spaghetti plot of a filter output. This is a plot where each realization corresponds to a specific line on a plot." I worry this isn't clear enough for users not already familiar with the plot -- is there a better phrasing?

Comment thread epymorph/forecasting/filter_plot.py Outdated
@@ -279,9 +315,11 @@ def spaghetti_plt(
quantity: QuantityStrategy | ParameterStrategy,
*,
legend: LegendOption = "auto",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Discussion: The basic Output plot renderer doesn't accept legend as an option in its "_plt" variant, assuming the user will be happy to draw the legend themselves if they're using the plt version. I don't have very strong opinions about which of these is correct, but I feel like it should be consistent. What do you think?

Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated
Comment thread epymorph/forecasting/filter_plot.py Outdated

return num_nodes

def _promote_axs(self, axs):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need types.

# Any other combo doesn't need to be or can't be mapped.
return actual, identity

def _check_num_nodes(self, geo):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this is not correctly handling GeoSelections (sans grouping or aggregation), and I'd suggest making this a GeoStrategy method.

@JeffreyCovington JeffreyCovington self-assigned this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants