[dataio/nix] adding sleep while writing
This commit is contained in:
parent
6d2eb09c65
commit
33f046c072
@ -1,3 +1,4 @@
|
||||
import time
|
||||
from IPython import embed
|
||||
import nixio
|
||||
|
||||
@ -17,15 +18,21 @@ class NixWriter:
|
||||
chunk = 1000
|
||||
log.debug("Starting the writing")
|
||||
self.write = True
|
||||
|
||||
total_count = self.buffer.totalcount()
|
||||
while self.write:
|
||||
# log.debug(items)
|
||||
try:
|
||||
data, _ = self.buffer.read(items, extend=chunk)
|
||||
self.data_array.append(data)
|
||||
except IndexError as e:
|
||||
# log.debug(f"{e}")
|
||||
if total_count - items >= chunk:
|
||||
log.debug(items)
|
||||
try:
|
||||
data, _ = self.buffer.read(items, extend=chunk)
|
||||
self.data_array.append(data)
|
||||
except IndexError as e:
|
||||
time.sleep(0.01)
|
||||
log.debug(f"{e}")
|
||||
items += chunk
|
||||
else:
|
||||
time.sleep(0.01)
|
||||
continue
|
||||
items += chunk
|
||||
log.debug("Stoppint the writing")
|
||||
log.debug(f"Samples written {items}")
|
||||
self.nix_file.close()
|
||||
|
Loading…
Reference in New Issue
Block a user