performance - Slicing in PyTables -
what fastest way slice arrays saved in h5 using pytables?
the scenario following:
the data saved (no need optimize here):
filters = tables.filters(complib='blosc', complevel=5) h5file = tables.open_file(hd5_filename, mode='w', title='my data', filters=filters) group = h5file.create_group(h5file.root, 'data', 'data') x_atom = tables.float32atom(shape=[50,50,50]) x = h5file.create_carray(group, 'x', atom=x_atom, title='xdata', shape=(1000,), filters=filters)the data opened :
h5file = tables.openfile(hd5_filename, mode="r") node = h5file.getnode('/', data_node) x = getattr(node, x_str)this need optimization, need make lot of following kind of array slicing cannot sorted, many many indexes , different min/max locations:
for index, min_x, min_y, min_z, max_x, max_y, max_z in my_very_long_list: current_item = x[index][min_x:max_x,min_y:max_y,min_z:max_z] do_something(current_item)
the question is: fastest way task?
Comments
Post a Comment