def speed_test(host, n_pts=1000):
    time_array = np.zeros(n_pts)
    client = connect(host, name="oscillo")
    driver = Oscillo(client)
    driver.set_averaging(False)

    t0 = time.time()
    t_prev = t0

    for i in range(n_pts):
        if cmd == "get_adc":
            driver.get_adc()
        elif cmd == "get_num_average":
            driver.get_num_average(0)
        t = time.time()
        time_array[i] = t - t_prev
        print host, i, time_array[i]
        t_prev = t

    print "{} us".format(1e6 * np.median(time_array))
    #    assert(np.median(time_array) < 0.003)
    return time_array
def speed_test(host, n_pts=1000):
    time_array = np.zeros(n_pts)
    client = load_instrument(host, instrument='oscillo')
    driver = Oscillo(client)
    driver.set_averaging(False)

    t0 = time.time()
    t_prev = t0

    for i in range(n_pts):
        if cmd == 'get_adc':
            driver.get_adc()
        elif cmd == 'get_num_average':
            driver.get_num_average()
        t = time.time()
        time_array[i] = t - t_prev
        print host, i, time_array[i]
        t_prev = t

    print np.median(time_array)

    plt.plot(time_array)
    driver.close()
def speed_test(host, n_pts=1000):
    time_array = np.zeros(n_pts)
    client = load_instrument(host, instrument='oscillo')
    driver = Oscillo(client)
    driver.set_averaging(False)

    t0 = time.time()
    t_prev = t0

    for i in range(n_pts):
        if cmd == 'get_adc':
            driver.get_adc()
        elif cmd == 'get_num_average':
            driver.get_num_average()
        t = time.time()
        time_array[i] = t - t_prev
        print host, i, time_array[i]
        t_prev = t
        
    print np.median(time_array)

    plt.plot(time_array)
    driver.close()
host = os.getenv('HOST','192.168.1.100')
client = connect(host, name='oscillo')
driver = Oscillo(client)

current = 30 #mA

freq = 1
mod_amp = 0.2
# Modulate with a triangle waveform of period 8192 x 8 ns
n = driver.wfm_size
driver.dac[1,:] = mod_amp * signal.sawtooth(2 * np.pi * freq / n * np.arange(n), width=0.5)
driver.set_dac()

driver.start_laser()
driver.set_averaging(True)
driver.set_laser_current(current)
time.sleep(0.1)

plt.ylim([-2*np.pi, 2*np.pi])
plt.ion()
plt.show()

phase_previous_pos = 0
phase_previous_neg = 0

temperature = 20 # degrees Celsius
data = np.zeros((1000,2)) + temperature
# Hanning FFT Window
window = 0.5 * (1-np.cos(2 * np.pi * np.arange(4095) / 4095))
示例#5
0
host = os.getenv('HOST', '192.168.1.100')
client = load_instrument(host, instrument='oscillo')
driver = Oscillo(client)

current = 30  #mA

freq = 1
mod_amp = 0.2
# Modulate with a triangle waveform of period 8192 x 8 ns
driver.dac[1, :] = mod_amp * signal.sawtooth(
    2 * np.pi * freq / driver.n * np.arange(driver.n), width=0.5)
driver.set_dac()

driver.start_laser()
driver.set_averaging(True)
driver.set_laser_current(current)
time.sleep(0.1)

plt.ylim([-2 * np.pi, 2 * np.pi])
plt.ion()
plt.show()

phase_previous_pos = 0
phase_previous_neg = 0

temperature = 20  # degrees Celsius
data = np.zeros((1000, 2)) + temperature
# Hanning FFT Window
window = 0.5 * (1 - np.cos(2 * np.pi * np.arange(4095) / 4095))