From c15658e6ad2ab5238e641e6538435004993c65a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 16 Apr 2018 14:19:40 +0200 Subject: [PATCH] updated some test scripts --- test_adc.py | 9 ++++++--- test_adc2.py | 15 +++++++++++++++ test_dac.py | 13 ++++++++----- 3 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 test_adc2.py diff --git a/test_adc.py b/test_adc.py index 4fba2bb..be70183 100644 --- a/test_adc.py +++ b/test_adc.py @@ -14,21 +14,24 @@ with gex.Client(gex.TrxRawUSB()) as client: print(adc.get_channels()) adc.set_active_channels([1]) - rate=500 + rate=50000 fs = adc.set_sample_rate(rate) - count = 2000 + time.sleep(0.1) + count = 5000 data = adc.capture(count) print("rx, %d samples" % len(data)) data = np.add(data / 4096, -0.5) + adc.set_sample_rate(1000) + # if data is not None: # wavfile.write('file.wav', rate, data) # print("Ok") - plt.plot(data, 'r.', lw=1) + plt.plot(data, 'r-', lw=1) plt.show() else: print("Nothing rx") diff --git a/test_adc2.py b/test_adc2.py new file mode 100644 index 0000000..685267b --- /dev/null +++ b/test_adc2.py @@ -0,0 +1,15 @@ +#!/bin/env python3 +import time + +import gex +import numpy as np +from matplotlib import pyplot as plt + +from scipy.io import wavfile + +with gex.Client(gex.TrxRawUSB()) as client: + adc = gex.ADC(client, 'adc') + + for i in range(1000): + print(adc.read_raw()) + diff --git a/test_dac.py b/test_dac.py index 7bff9cd..d4b1bc1 100644 --- a/test_dac.py +++ b/test_dac.py @@ -24,11 +24,14 @@ with gex.Client(gex.TrxRawUSB()) as client: # # # dac.sync() - for i in range(0, 1000): - dac.set_frequency(1, i) - time.sleep(0.001) - - + # for i in range(0, 1000): + # dac.set_frequency(1, i) + # time.sleep(0.001) + + dac.waveform(1, 'SIN') + dac.set_frequency(1, 1000) + time.sleep(2) + dac.dc(1, 2047) # dac.waveform(1, 'SIN') # # dac.set_frequency(1, 1000)