Exemplo n.º 1
0
from koheron import connect
from koheron import Alpha250

host = os.getenv('HOST', '192.168.1.50')
client = connect(host, 'fft', restart=False)
driver = FFT(client)
alpha = Alpha250(client)

print(driver.get_fs())

# clk_200MHz = {'idx': 0, 'fs': 200E6}
# clk_250MHz = {'idx': 1, 'fs': 250E6}

# clock = clk_250MHz
# alpha.set_sampling_frequency(clock['idx'])

# for _ in range(300):
#     print("-----")
#     driver.read_psd_raw(0)
#     print (driver.get_acq_cycle_index(0))
#     driver.read_psd_raw(1)
#     print (driver.get_acq_cycle_index(1))

driver.set_fft_window(1)
driver.set_input_channel(0)

freqs = np.arange(driver.n_pts / 2) * 250. / driver.n_pts
plt.loglog(freqs, driver.read_psd_raw(0))
plt.loglog(freqs, driver.read_psd_raw(1))
plt.show()
Exemplo n.º 2
0
import numpy as np
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
Exemplo n.º 3
0
    f, axarr = plt.subplots(2, sharex=True)
    axarr[0].plot(voltages, off_raw)
    axarr[0].plot(voltages, gain_lsb * voltages + offset_lsb)
    axarr[1].plot(voltages, residuals)
    axarr[0].set_ylabel("ADC raw value")
    axarr[1].set_ylabel("ADC INL")
    axarr[1].set_xlabel("Input voltage (V)")
    plt.show()

    return gain_lsb, offset_lsb


if __name__ == "__main__":
    gene = Keysight33600A()
    host = os.getenv('HOST', '192.168.1.18')
    client = connect(host, 'fft', restart=False)
    driver = FFT(client)

    driver.set_fft_window(Window.FLAT_TOP)

    for channel_under_test in range(2):
        gene.set_channel(channel_under_test + 1)
        driver.set_in_channel(channel_under_test)
        time.sleep(1)

        gain, offset = calibrate_offset_gain(gene, driver, channel_under_test)
        p = calibrate_transfer_function(gene, driver)

        cal_coeffs = np.float32(np.concatenate((np.array([gain, offset]), p)))
        print cal_coeffs