adding calibration
This commit is contained in:
parent
971c1f4347
commit
2100a0205f
@ -0,0 +1,42 @@
|
|||||||
|
import ctypes
|
||||||
|
|
||||||
|
import uldaq
|
||||||
|
from IPython import embed
|
||||||
|
from pyrelacs.repros.repos import Repos
|
||||||
|
from pyrelacs.util.logging import config_logging
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
log = config_logging()
|
||||||
|
|
||||||
|
|
||||||
|
class Calibration(Repos):
|
||||||
|
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)
|
||||||
|
# sending stimulus
|
||||||
|
stim, ao_device = self.send_analog_dac(
|
||||||
|
data, [0, 0], SAMPLERATE, ScanOption=uldaq.ScanOption.EXTTRIGGER
|
||||||
|
)
|
||||||
|
read_data = self.read_analog_daq(
|
||||||
|
[0, 1], DURATION, SAMPLERATE, ScanOption=uldaq.ScanOption.EXTTRIGGER
|
||||||
|
)
|
||||||
|
self.digital_trigger()
|
||||||
|
ao_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, 11)
|
||||||
|
self.digital_trigger(data=0)
|
||||||
|
self.disconnect_dac()
|
||||||
|
embed()
|
||||||
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
SAMPLERATE = 40_000.0
|
||||||
|
DURATION = 5
|
||||||
|
AMPLITUDE = 3
|
||||||
|
SINFREQ = 1
|
||||||
|
daq_input = Calibration()
|
||||||
|
daq_input.run_calibration()
|
Loading…
Reference in New Issue
Block a user