Skip to content

Commit

Permalink
Import read_hdf
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjameshandley committed Jun 29, 2023
1 parent bb2ef05 commit 9426d0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions anesthetic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import anesthetic.samples
import anesthetic.plot
import anesthetic.read.chain
import anesthetic.io

import pandas
import pandas.plotting._core
Expand Down Expand Up @@ -47,4 +48,5 @@ def wrapper(backend=None):
make_2d_axes = anesthetic.plot.make_2d_axes
make_1d_axes = anesthetic.plot.make_1d_axes

read_hdf = anesthetic.io.read_hdf
read_chains = anesthetic.read.chain.read_chains
4 changes: 2 additions & 2 deletions anesthetic/io.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""Anesthetic overwrites for pandas hdf functionality."""
from pandas import HDFStore as _HDFStore
from pandas.io.pytables import to_hdf as _to_hdf, read_hdf as _read_hdf
from anesthetic import __version__
from anesthetic.samples import NestedSamples, MCMCSamples, Samples
from anesthetic.utils import adjust_docstrings


class HDFStore(_HDFStore): # noqa: D101
from anesthetic.samples import NestedSamples, MCMCSamples, Samples
anesthetic_types = {x.__name__: x
for x in [NestedSamples, MCMCSamples, Samples]}

Expand All @@ -23,6 +22,7 @@ def get(self, key, *args, **kwargs): # noqa: D102
return value

def put(self, key, value, *args, **kwargs): # noqa: D102
from anesthetic import __version__
super().put(key, value, *args, **kwargs)
storer = self.get_storer(key)
storer.attrs._metadata = {
Expand Down

0 comments on commit 9426d0b

Please sign in to comment.