Compare commits
4 Commits
565d6e5318
...
2719d49eb0
Author | SHA1 | Date | |
---|---|---|---|
2719d49eb0 | |||
a0c524326d | |||
c2285f3750 | |||
9327d1bac9 |
15
pyrelacs/dataio/buffer.py
Normal file
15
pyrelacs/dataio/buffer.py
Normal file
@ -0,0 +1,15 @@
|
||||
from collections import deque
|
||||
|
||||
from pyrelacs.util.logging import config_logging
|
||||
|
||||
log = config_logging()
|
||||
|
||||
|
||||
class DataBuffer:
|
||||
def __init__(self, channels, samples):
|
||||
self.channels = channels
|
||||
self.samples = samples
|
||||
|
||||
def create_buffer(self):
|
||||
max_len_buffer = self.channels * self.samples
|
||||
self.buffer = deque(maxlen=max_len_buffer)
|
@ -11,7 +11,7 @@ from pyrelacs.util.logging import config_logging
|
||||
log = config_logging()
|
||||
|
||||
|
||||
class MccDac:
|
||||
class MccDaq:
|
||||
"""
|
||||
Represents the Digital/Analog Converter from Meassuring Computing.
|
||||
provides methods for writing and reading the Analog / Digital input and output.
|
||||
@ -43,6 +43,7 @@ class MccDac:
|
||||
except uldaq.ul_exception.ULException:
|
||||
self.disconnect_dac()
|
||||
self.connect_dac()
|
||||
|
||||
self.ai_device = self.daq_device.get_ai_device()
|
||||
self.ao_device = self.daq_device.get_ao_device()
|
||||
self.dio_device = self.daq_device.get_dio_device()
|
@ -9,7 +9,7 @@ import matplotlib.pyplot as plt
|
||||
from scipy.signal import welch
|
||||
from scipy.signal import find_peaks
|
||||
|
||||
from pyrelacs.devices.mccdac import MccDac
|
||||
from pyrelacs.devices.mccdaq import MccDaq
|
||||
from pyrelacs.util.logging import config_logging
|
||||
|
||||
log = config_logging()
|
||||
@ -17,7 +17,7 @@ log = config_logging()
|
||||
faulthandler.enable()
|
||||
|
||||
|
||||
class Calibration(MccDac):
|
||||
class Calibration(MccDaq):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.SAMPLERATE = 40_000.0
|
||||
|
@ -11,19 +11,20 @@ from PyQt6.QtWidgets import (
|
||||
QStatusBar,
|
||||
)
|
||||
import uldaq
|
||||
import numpy as np
|
||||
import nixio as nix
|
||||
import pyqtgraph as pg
|
||||
|
||||
from pathlib import Path as path
|
||||
from scipy.signal import welch, find_peaks
|
||||
|
||||
from pyrelacs.worker import Worker
|
||||
from pyrelacs.repros.repros import Repro
|
||||
from pyrelacs.util.logging import config_logging
|
||||
from pyrelacs.dataio.buffer import DataBuffer
|
||||
|
||||
from pyrelacs.ui.about import AboutDialog
|
||||
from pyrelacs.ui.plots.calibration import CalibrationPlot
|
||||
|
||||
from pyrelacs.util.logging import config_logging
|
||||
|
||||
log = config_logging()
|
||||
_root = path(__file__).parent.parent
|
||||
|
||||
@ -51,6 +52,7 @@ class PyRelacs(QMainWindow):
|
||||
self.threadpool = QThreadPool()
|
||||
self.repros = Repro()
|
||||
|
||||
self.buffers = DataBuffer(channels=1, samples=100_000)
|
||||
self.text = QPlainTextEdit()
|
||||
self.text.setReadOnly(True)
|
||||
|
||||
@ -179,9 +181,6 @@ class PyRelacs(QMainWindow):
|
||||
except uldaq.ul_exception.ULException as e:
|
||||
log.error(f"Could not Connect to DAQ: {e}")
|
||||
self.daq_connect_button.setDisabled(True)
|
||||
else:
|
||||
log.debug("Already handeld the error")
|
||||
pass
|
||||
|
||||
def disconnect_dac(self):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user