Compare commits
3 Commits
6d2eb09c65
...
e4e86cbc49
Author | SHA1 | Date | |
---|---|---|---|
e4e86cbc49 | |||
e36db5e7b0 | |||
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()
|
||||
|
@ -38,12 +38,7 @@ class SinProducer:
|
||||
|
||||
log.debug(f"duration sinus {end_time-start_time}")
|
||||
log.debug(f"Stimulation time {t}")
|
||||
log.debug(f"{self.buffer.totalcount()}")
|
||||
# data = self.buffer.get_all()
|
||||
# log.debug(data.shape[0])
|
||||
# log.debug(data.shape[0] / self.buffer.samplerate)
|
||||
# plt.plot(np.arange(data.size) / self.buffer.samplerate, data)
|
||||
# plt.show()
|
||||
log.debug(f"Total samples produced {self.buffer.totalcount()}")
|
||||
|
||||
def stop_request(self):
|
||||
self.stop = True
|
||||
|
@ -13,6 +13,7 @@ from PyQt6.QtWidgets import (
|
||||
QStatusBar,
|
||||
)
|
||||
|
||||
from pyqtgraph.Qt.QtCore import QThread
|
||||
import uldaq
|
||||
import nixio as nix
|
||||
import pyqtgraph as pg
|
||||
@ -100,12 +101,11 @@ class PyRelacs(QMainWindow):
|
||||
mutex=self.mutex,
|
||||
)
|
||||
self.continously_plot = Continously(self.figure, self.buffer)
|
||||
self.continously_plot.plot()
|
||||
# self.continously_plot.plot()
|
||||
|
||||
if self.config.settings.daq:
|
||||
log.debug("Creating Daq Generator")
|
||||
self.daq_producer = DaqProducer(self.buffer, self.mccdaq.daq_device, [1, 1])
|
||||
|
||||
log.debug("Creating Sinus Generator")
|
||||
self.sinus_producer = SinProducer(self.buffer)
|
||||
|
||||
|
@ -53,6 +53,7 @@ class Continously:
|
||||
self.last_plotted_index,
|
||||
extend=self.CHUNK_PLOT,
|
||||
)
|
||||
|
||||
self.time = np.concatenate((self.time, times))[-self.PLOT_HISTORY :]
|
||||
self.data = np.concatenate((self.data, items))[-self.PLOT_HISTORY :]
|
||||
self.line.setData(
|
||||
|
Loading…
Reference in New Issue
Block a user