From d6e2f8c5ba3511bc1b85cf2d99855e71ad412c18 Mon Sep 17 00:00:00 2001 From: wendtalexander Date: Wed, 25 Sep 2024 07:57:07 +0200 Subject: [PATCH] changing Repos to MccDac --- pyrelacs/repros/calbi.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pyrelacs/repros/calbi.py b/pyrelacs/repros/calbi.py index ca7aa30..9dbab01 100644 --- a/pyrelacs/repros/calbi.py +++ b/pyrelacs/repros/calbi.py @@ -3,7 +3,8 @@ import time import uldaq from IPython import embed -from pyrelacs.repros.repos import Repos +from pyrelacs.repros.repos import MccDac +from pyrelacs.repros.attcs3310 import Attenuator from pyrelacs.util.logging import config_logging import numpy as np import matplotlib.pyplot as plt @@ -11,14 +12,14 @@ import matplotlib.pyplot as plt log = config_logging() -class Calibration(Repos): +class Calibration(MccDac): def __init__(self) -> None: super().__init__() def run_calibration(self): # Stimulus - time = np.arange(0, DURATION, 1 / SAMPLERATE) - data = AMPLITUDE * np.sin(2 * np.pi * SINFREQ * time) + t = np.arange(0, DURATION, 1 / SAMPLERATE) + data = AMPLITUDE * np.sin(2 * np.pi * SINFREQ * t) # sending stimulus stim, ao_device = self.write_analog_dac( @@ -29,15 +30,14 @@ class Calibration(Repos): # [0, 1], DURATION, SAMPLERATE, ScanOption=uldaq.ScanOption.EXTTRIGGER # ) - # trigger the 0 channel to start the aqcuisition - self.write_bit(channel=0, bit=1) + self.diggital_trigger() try: ao_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, 15) except uldaq.ul_exception.ULException: log.debug("Operation timed out") + # reset the diggital trigger self.write_bit(channel=0, bit=0) - self.disconnect_dac() - self.connect_dac() + time.sleep(1) self.set_analog_to_zero() @@ -47,5 +47,4 @@ if __name__ == "__main__": AMPLITUDE = 1 SINFREQ = 100 daq_input = Calibration() - # daq_input.run_calibration() - daq_input.attenuator() + daq_input.run_calibration()