Playing around with your example:
test2 = f['data']
print test2
print test2.shape
print test2[0:3,2:5]
print test2[slice(None,3,None),slice(2,5,None)] # ok
print test2[slice_obj[0],slice_obj[1]] # ok
print test2[tuple(slice_obj)] # ok
print test2[[slice(None,3,None),slice(2,5,None)]] # fail
print f['data'][tuple(slice_obj)] 3 ok
So it looks like h5py
arrays can use slices, but cannot split a list into its elements. But it does take a tuple. My guess is that there is minor difference in how getitem
is implemented.
You are doing advanced indexing. numpy
doc says:
Advanced indexing is triggered when the selection object, obj,... a tuple with at least one sequence object.... when the selection object is not a tuple, it will be referred to as if it had been promoted to a 1-tuple, which will be called the selection tuple.
h5py
may not be doing this promoting to tuple. Otherwise it appears to do advance indexing just fine.