Skip to content

Commit

Permalink
Add arviz version to InferenceData attrs (#1086)
Browse files Browse the repository at this point in the history
* Add arviz version to InferenceData attrs

* arviz version to attr
  • Loading branch information
ahartikainen authored Feb 23, 2020
1 parent 148b549 commit dc20591
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* **Experimental Feature**: Added `arviz.wrappers` module to allow ArviZ to
refit the models if necessary
* **Experimental Feature**: Added `reloo` function to ArviZ
* ArviZ version to InferenceData attributes. (#1086)


### Maintenance and fixes
Expand Down
6 changes: 5 additions & 1 deletion arviz/data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import xarray as xr

from .. import utils
from .. import __version__

CoordSpec = Dict[str, List[Any]]
DimSpec = Dict[str, List[str]]
Expand Down Expand Up @@ -215,7 +216,10 @@ def make_attrs(attrs=None, library=None):
dict
attrs
"""
default_attrs = {"created_at": datetime.datetime.utcnow().isoformat()}
default_attrs = {
"created_at": datetime.datetime.utcnow().isoformat(),
"arviz_version": __version__,
}
if library is not None:
library_name = library.__name__
default_attrs["inference_library"] = library_name
Expand Down

0 comments on commit dc20591

Please # to comment.