catalystneuro / lazy_ops

Lazy transposing and slicing of h5py and Zarr Datasets
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

error with transpose? #13

Closed bendichter closed 4 years ago

bendichter commented 4 years ago

Why doesn't this work?

assert_array_equal(dset[slice_list[1]].T, dsetview.lazy_slice[slice_list[1]].lazy_transpose())

Am I making a mistake or should these be equal?

d-sot commented 4 years ago

lazy_transpose() returns a DatasetView. So if replaced with dsetview.lazy_slice[slice_list[1]].lazy_transpose()[:] to read the data it works.

bendichter commented 4 years ago

Thanks for the clarification. I would like a Datasetview object to test correctly against an h5py.Dataset. I'm looking into why this isn't working

d-sot commented 4 years ago

In 31aa2f4808623cd680c4e845851b309eca8d0f02, read_direct method is implemented to work correctly with lazy operations. In turn it allows Dataset.__array__ to work correctly, which leads to numpy's assert_array_equal working without having to explicitly convert a DatasetView to numpy.