[ui/mainwindow] adding unitconversion

This commit is contained in:
wendtalexander 2024-10-16 08:52:16 +02:00
parent e16211b988
commit f576f33cc5

View File

@ -17,6 +17,7 @@ import uldaq
import nixio as nix
import pyqtgraph as pg
import numpy as np
import quantities as pq
from pyrelacs.dataio.daq_producer import DaqProducer
@ -39,8 +40,9 @@ from IPython import embed
class PyRelacs(QMainWindow):
def __init__(self):
def __init__(self, config):
super().__init__()
self.config = config
self.setToolButtonStyle(
Qt.ToolButtonStyle.ToolButtonTextBesideIcon
) # Ensure icons are displayed with text
@ -79,9 +81,16 @@ class PyRelacs(QMainWindow):
widget.setLayout(layout)
self.setCentralWidget(widget)
SAMPLERATE = 40_000
SAMPLERATE = pq.Quantity(
self.config.pyrelacs.data.input.inputsamplerate,
self.config.pyrelacs.data.input.inputsamplerateunit,
)
INPUTTRACECAPACITY = pq.Quantity(
self.config.pyrelacs.data.input.inputtracecapacity,
self.config.pyrelacs.data.input.inputtracecapacityunit,
)
start = time.time()
BUFFERSIZE = SAMPLERATE * 10 * 60
BUFFERSIZE = (SAMPLERATE * INPUTTRACECAPACITY).simplified
end = time.time()
log.debug(f"Buffer allocation took {end - start}")