We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b6c00a commit fae2e4dCopy full SHA for fae2e4d
arviz/tests/base_tests/test_data.py
@@ -1652,3 +1652,19 @@ def test_subset_samples(self):
1652
post = extract(idata, num_samples=10)
1653
assert post.sizes["sample"] == 10
1654
assert post.attrs == idata.posterior.attrs
1655
+
1656
1657
+def test_convert_to_inference_data_with_array_like():
1658
+ class ArrayLike:
1659
+ def __init__(self, data):
1660
+ self._data = np.asarray(data)
1661
1662
+ def __array__(self):
1663
+ return self._data
1664
1665
+ array_like = ArrayLike(np.random.randn(4, 100))
1666
+ idata = convert_to_inference_data(array_like, group="posterior")
1667
1668
+ assert hasattr(idata, "posterior")
1669
+ assert "x" in idata.posterior.data_vars
1670
+ assert idata.posterior["x"].shape == (4, 100)
0 commit comments