[dataio/nix] adding sleep while writing

This commit is contained in:
wendtalexander 2024-10-21 10:28:25 +02:00
parent 6d2eb09c65
commit 33f046c072

View File

@ -1,3 +1,4 @@
import time
from IPython import embed from IPython import embed
import nixio import nixio
@ -17,15 +18,21 @@ class NixWriter:
chunk = 1000 chunk = 1000
log.debug("Starting the writing") log.debug("Starting the writing")
self.write = True self.write = True
total_count = self.buffer.totalcount()
while self.write: while self.write:
# log.debug(items) if total_count - items >= chunk:
log.debug(items)
try: try:
data, _ = self.buffer.read(items, extend=chunk) data, _ = self.buffer.read(items, extend=chunk)
self.data_array.append(data) self.data_array.append(data)
except IndexError as e: except IndexError as e:
# log.debug(f"{e}") time.sleep(0.01)
continue log.debug(f"{e}")
items += chunk items += chunk
else:
time.sleep(0.01)
continue
log.debug("Stoppint the writing") log.debug("Stoppint the writing")
log.debug(f"Samples written {items}") log.debug(f"Samples written {items}")
self.nix_file.close() self.nix_file.close()