Closed bendichter closed 5 years ago
So I believe #107 fixes tests.system.TimeSeriesIOTest/testInFromPyNWB
as I am unable to reproduce that now.
It looks like pynwb returns HDF5 Data objects instead of arrays now. Adding a check in assertContainerEqual
to see if it's a h5py.Dataset
and using slice syntax seems to work, though I'm unsure if that's the best idea.
import h5py
.
.
.
if isinstance(f1, (float, np.float32, np.float16)):
npt.assert_almost_equal(f1, f2)
elif isinstance(f1, h5py.Dataset):
self.assertEqual(f1[:], f2)
else:
self.assertEqual(f1, f2)
Yeah I think that would be fine. Alternatively, would it make sense to use pynwb's assertContainerEqual
?
That looks like it runs into the same issue. Does that one work on roundtrips?
hmm, yeah I think so, but I'm not sure where reading h5py datasets is handled. Maybe before that function.
So debugging the pynwb integration tests revealed a few interesting things: 1) The documentation for assertContainerEqual under base.py is incorrect as TestMapRoundTrip.test_roundtrip is clearly not comparing it in that order. This is important because... 2) Neither the type nor the actual contents in any read array is ever checked. In our case, this is the branch that is executed for the nwbfield "data" for TimeSeries.
Making this behavior consistent in MatNWB is easy but I don't know if that's intended or not.