changing Repos to MccDac
This commit is contained in:
parent
8e73b2ae1f
commit
d6e2f8c5ba
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user