feat(arviz): add arviz import and export#32
Draft
davecwright3 wants to merge 1 commit intonanograv:mainfrom
Draft
feat(arviz): add arviz import and export#32davecwright3 wants to merge 1 commit intonanograv:mainfrom
davecwright3 wants to merge 1 commit intonanograv:mainfrom
Conversation
13 tasks
Author
|
Tests are failing because the minimum arviz version I specified is too high for these python versions. I'll lower the arviz version bound. |
Author
|
Also I should raise a warning if an inference data object is imported that doesn't have all of the usual PTMCMC fields defined. This is just so users are aware some methods may fail that depend on those fields existing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a very basic import and export scheme with ArviZ.
Checks for new file types
If it finds netcdf ".nc" or zarr ".zarr" files, it tries to read them with ArviZ.
la_forge/la_forge/core.py
Lines 118 to 126 in 6d23069
Converts ArviZ data and metadata into a single "chain" for La Forge to consume
It filters out any parameters that do not correspond to samples in the chain. This means that the number of parameters always equals the number of columns in the chain. It therefore skips the check later on that would add extra PTMCMC parameters, such as
lnpost.In this implementation, you need to have already named your variables in the ArviZ
InferenceDataobject to their desired final names. I would recommend naming them to their usual PTMCMC values for backwards compatibility.la_forge/la_forge/core.py
Lines 127 to 129 in 6d23069
Adds an
arvizcached_propertyto theCoreclassAssuming you have a
Corenamedmy_core, callingmy_core.arvizwill return an ArviZInferenceDataobject populated with theCore's data.la_forge/la_forge/core.py
Lines 687 to 713 in 6d23069
Self contained example