Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing #86 (showing large EArrays) #87

Merged
merged 2 commits into from
Oct 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions vitables/vttables/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ def total_nrows(self):
elif shape == ():
# Node is a rank 0 array (e.g. numpy.array(5))
nrows = 1
elif isinstance(self.leaf, tables.EArray):
# Warning: the number of rows of an EArray, ea, can be different
# from the number of rows of the numpy array ea.read()
nrows = self.leaf.shape[0]
else:
nrows = self.leaf.nrows

Expand Down Expand Up @@ -237,9 +233,11 @@ def EArrayCell(self, row, col):
# get the right chunk element.
# chunk = [row0, row1, row2, ..., rowN]
# and columns can be read from a given row using indexing notation
# TODO: this method should be improved as it requires to read the
# whole array keeping the read data in memory
return self.leaf.read()[row]
# Get data for cell
cell_data = numpy.take(self.chunk, [row], axis=self.leaf.maindim)
# Remove extra dimension
cell_data = numpy.squeeze(cell_data, axis=self.leaf.maindim)
return cell_data

def arrayCell(self, row, col):
"""
Expand Down