From 1a2185d5e4137ba8032017d8f4d5a8e42aac4633 Mon Sep 17 00:00:00 2001 From: wendtalexander Date: Wed, 25 Sep 2024 15:31:15 +0200 Subject: [PATCH] trying to fix seg fault --- pyrelacs/repros/calbi.py | 4 ++-- pyrelacs/repros/mccdac.py | 37 +++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/pyrelacs/repros/calbi.py b/pyrelacs/repros/calbi.py index 16cd7b1..77faec1 100644 --- a/pyrelacs/repros/calbi.py +++ b/pyrelacs/repros/calbi.py @@ -50,12 +50,12 @@ class Calibration(MccDac): # sending stimulus log.debug(f"{data}, {data.shape}") - embed() - exit() # self.set_attenuation_level(db_channel1=0.0, db_channel2=0.0) # self.set_analog_to_zero() # time.sleep(1) log.debug(self.ao_device) + embed() + exit() self.write_analog( data, diff --git a/pyrelacs/repros/mccdac.py b/pyrelacs/repros/mccdac.py index 8f813ad..fc80e76 100644 --- a/pyrelacs/repros/mccdac.py +++ b/pyrelacs/repros/mccdac.py @@ -95,23 +95,23 @@ class MccDac: log.debug(f"Created C_double data {data_analog_output}") log.info(self.ao_device) - try: - err = self.ao_device.a_out_scan( - channels[0], - channels[1], - Range, - int(len(data)), - samplerate, - ScanOption, - AOutScanFlag, - data_analog_output, - ) - # self.diggital_trigger() - # self.ao_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, 11) - except Exception as e: - print(f"{e}") - self.set_analog_to_zero() - self.disconnect_dac() + + err = self.ao_device.a_out_scan( + channels[0], + channels[1], + Range, + int(len(data)), + samplerate, + ScanOption, + AOutScanFlag, + data_analog_output, + ) + # self.diggital_trigger() + # self.ao_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, 11) + # except Exception as e: + # print(f"{e}") + # self.set_analog_to_zero() + # self.disconnect_dac() def set_analog_to_zero(self, channels: list[int] = [0, 1]): try: @@ -132,11 +132,12 @@ class MccDac: def diggital_trigger(self, channel: int = 0) -> None: bit_channel = self.read_bit(channel) + log.debug(bit_channel) if not bit_channel: self.write_bit(channel, 1) else: self.write_bit(channel, 0) - time.time_ns() + time.sleep(1) self.write_bit(channel, 1) def write_bit(self, channel: int = 0, bit: int = 1) -> None: