示例#1
0
import os
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')
示例#2
0
fig = plt.figure(figsize=(6,6))
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))