import time import matplotlib.pyplot as plt from fft import FFT from koheron import connect host = os.getenv('HOST', '192.168.1.11') client = connect(host, 'fft', restart=False) driver = FFT(client) print('Start test.py') n_pts = driver.n_pts fs = 250e6 psd = driver.read_psd() #plt.plot(10*np.log10(psd)) plt.plot(psd) plt.show() #freqs = np.array([0.01, 0.02, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 25, 27, 30, 33, 35, 37, 40, 43, 45, 47, 50, 53, 55, 57, 60, 63, 65, 67, 70, 73, 75, 77, 80, 83, 85, 87, 90, 93, 95, 97, 100, 103, 105, 107, 110, 113, 115, 117, 120, 123, 124]) * 1e6 freqs = np.linspace(0.01e6, 40e6,num=200) freqs = np.round(freqs / fs * n_pts) * fs / n_pts hd1 = 0.0 * freqs hd2 = 0.0 * freqs hd3 = 0.0 * freqs snr = 0.0 * freqs
ax = fig.add_subplot(111) ax.set_xlabel('Frequency (MHz)') ax.set_ylabel('Crosstalk (dB)') for j in range(2): raw_input("Connect DAC0 to ADC"+str(j)) for i, freq in enumerate(freqs): n = np.uint32(freq / fs * n_pts) driver.set_dds_freq(0, freq) driver.set_input_channel(j%2) time.sleep(0.5) psd0 = driver.read_psd() driver.set_input_channel((j+1)%2) time.sleep(0.5) psd1 = driver.read_psd() crosstalk[j,i] = 10 * np.log10(psd1[n-1] / psd0[n-1]) print freq, crosstalk[j,i] ax.plot(freqs*1e-6, crosstalk[j,:], label='ADC{} to ADC{}'.format(j%2, (j+1)%2)) ax.set_xlim([fmin * 1e-6, fmax * 1e-6]) ax.legend(loc=2)
import time import matplotlib.pyplot as plt from fft import FFT from koheron import connect host = os.getenv('HOST', '192.168.1.50') client = connect(host, 'fft', restart=False) driver = FFT(client) Rload = 50 # Ohm driver.set_fft_window(0) driver.set_input_channel(0) lpsd00 = np.sqrt(Rload * driver.read_psd(0)) # V/rtHz lpsd10 = np.sqrt(Rload * driver.read_psd(1)) # V/rtHz driver.set_input_channel(1) lpsd01 = np.sqrt(Rload * driver.read_psd(0)) # V/rtHz lpsd11 = np.sqrt(Rload * driver.read_psd(1)) # V/rtHz fig = plt.figure(figsize=(6,6)) ax = fig.add_subplot(111) ax.set_xlim([0, 125]) ax.set_ylim([0, 40]) freqs = np.arange(driver.n_pts / 2) * 250. / driver.n_pts ax.plot(freqs, lpsd00 * 1e9, label='IN0') ax.plot(freqs, lpsd01 * 1e9, label='IN1')
host = os.getenv('HOST', '192.168.1.16') client = connect(host, 'fft', restart=False) driver = FFT(client) driver.set_fft_window(0) driver.set_dds_freq(0, 0) driver.set_dds_freq(1, 0) driver.set_input_channel(0) fig = plt.figure(figsize=(6, 6)) ax = fig.add_subplot(111) ax.set_xlim([0, 125]) ax.set_ylim([0, 40]) freqs = np.arange(driver.n_pts / 2) * 250. / 8192 raw_input("Terminate ADC0 with 50 Ohm") lpsd1 = np.sqrt(50 * driver.read_psd()) # V/rtHz ax.plot(freqs, lpsd1 * 1e9, label='ADC0 terminated with 50 Ohm') raw_input("Connect DAC0 to ADC0") lpsd2 = np.sqrt(50 * driver.read_psd()) # V/rtHz ax.plot(freqs, lpsd2 * 1e9, label='ADC0 connected to DAC0') ax.set_xlabel('Frequency (MHz)') ax.set_ylabel('Voltage noise density (nV/rtHz)') ax.legend() plt.show() np.save('alpha250_noise_floor.npy', (freqs, lpsd1, lpsd2))