[dataview] fix data_fetched counter

This commit is contained in:
Jan Grewe 2021-01-18 10:36:16 +01:00
parent c8fe616c44
commit 93d90ddba8

View File

@ -18,7 +18,6 @@ class DataView():
def request_more(self): def request_more(self):
if self.fully_loaded: if self.fully_loaded:
print("all data fetched")
return return
# first make sure, that the count is valid, i.e. inside data # first make sure, that the count is valid, i.e. inside data
valid_count = self._file_handler.valid_count(self._full_shape, self._offset, self._count) valid_count = self._file_handler.valid_count(self._full_shape, self._offset, self._count)
@ -31,7 +30,7 @@ class DataView():
new_ofst[i] = sum(x) new_ofst[i] = sum(x)
self._offset = tuple(new_ofst) self._offset = tuple(new_ofst)
self._fetched_data = tuple([sum(x) for x in zip(self._fetched_data, self._count)]) self._fetched_data = tuple([sum(x) for x in zip(self._fetched_data, valid_count)])
def init_chunking(self): def init_chunking(self):
"""decides on the chunks size for reading. Heuristic is based on the dimensionality of the data and the "best xdim" if available. """decides on the chunks size for reading. Heuristic is based on the dimensionality of the data and the "best xdim" if available.
@ -63,13 +62,13 @@ class DataView():
print("init buffer") print("init buffer")
@property @property
def fully_loaded(self): def fully_loaded(self):
return np.all(self._buffer is not None and self._fetched_data == self._full_shape) return np.all(self._buffer is not None and self._fetched_data == self._full_shape)
def __str__(self) -> str: def __str__(self) -> str:
r = self._item_descriptor.name + " " + str(self._item_descriptor.entity_type) r = self._item_descriptor.name + " " + str(self._item_descriptor.entity_type)
r += "buffer size: " + str(self._buffer.shape) if self._buffer is not None else "" + "\n" r += " buffer size: " + str(self._buffer.shape) if self._buffer is not None else "" + "\n"
r += "chunk size:" + str(self._count) r += " max chunk size: " + str(self._count)
r += "is fully loaded: " + str(self.fully_loaded) r += " is fully loaded: " + str(self.fully_loaded)
return r return r