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()
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
import init_example
import os
import time
import numpy as np
import matplotlib.pyplot as plt
import csv
import time
from scipy import signal

from koheron import connect
from ldk.drivers import Oscillo

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)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import init_example
import os
import time
import numpy as np
import matplotlib.pyplot as plt

from koheron import connect
from ldk.drivers import Oscillo

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

driver.start_laser()
driver.set_laser_current(0)
time.sleep(0.1)

current_max = 40
currents = np.linspace(0,current_max, num=100)

laser_powers = 0 * currents
measured_currents = 0 * currents

for i, current in enumerate(currents):
    driver.set_laser_current(current)
    time.sleep(0.02)
    laser_powers[i] = driver.get_laser_power()
    measured_currents[i] = driver.get_laser_current()
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import initExample
import os
import time
import numpy as np
import matplotlib.pyplot as plt

from utilities import load_instrument
from ldk.drivers import Oscillo

host = os.getenv('HOST','192.168.1.100')
client = load_instrument(host, instrument='oscillo')
driver = Oscillo(client)

# Enable laser
driver.start_laser()

# Set laser current
current = 30  # mA
driver.set_laser_current(current)

# Modulation on DAC
amp_mod = 0.2
freq_mod = 1e6
driver.dac[1, :] = amp_mod*np.sin(2 * np.pi * freq_mod * driver.sampling.t)
driver.set_dac()

# Signal on ADC
driver.get_adc()
Beispiel #7
0
import initExample
import os
import time
import numpy as np
import matplotlib.pyplot as plt
import csv
import time
from scipy import signal

from utilities import load_instrument
from ldk.drivers import Oscillo

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)
Beispiel #8
0
"""
import initExample  # Necessary module, must be in the same
# program as the main file.
import os
import time
import numpy as np
import matplotlib.pyplot as plt

from utilities import load_instrument
from ldk.drivers import Oscillo

# Enter card IP
host = os.getenv('HOST', '10.42.0.53')

client = load_instrument(host, instrument='oscillo')
driver = Oscillo(client)

# Making a method for text input. Only small letters, commas, and punctuation marks allowed.
phrase = str(
    raw_input(
        "Please type text to be translated, using only UTF-8 characters:"))

phrase = list(phrase)  #Arranges all the leters in a list.

# Set laser current
current = float(raw_input("Please enter laser current (0ma - 40ma):"))  # mA

if current > 40:
    print "Current too high! Chose current in range 0ma - 40ma."
    os._exit(0)
Program for making the RedPitaya / Koheron laser development work as a morsecode emitter.
Code is scanned from the command line by the program, and transmitted as short and long laser-pulses.
"""
import init_example
import os
import time
import numpy as np
import matplotlib.pyplot as plt

from koheron import connect
from ldk.drivers import Oscillo

# Enter board IP
host = os.getenv('HOST','10.42.0.53')
client = connect(host, name='oscillo')
driver = Oscillo(client)

# Making a method for text input. Only small letters, commas, and punctuation marks allowed.
phrase = str(raw_input("Please type text to be translated, using only UTF-8 characters:"))

phrase = list(phrase) #Arranges all the leters in a list.

# Set laser current
current = float(raw_input("Please enter laser current (0ma - 40ma):"))  # mA

if current > 40:
	print('Current too high! Chose current in range 0ma - 40ma.')
	os._exit(0)


# Modulation on DAC
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import initExample
import os
import time
import numpy as np
import matplotlib.pyplot as plt

from utilities import load_instrument
from ldk.drivers import Oscillo

host = os.getenv('HOST', '192.168.1.100')
client = load_instrument(host, instrument='oscillo')
driver = Oscillo(client)

driver.start_laser()
driver.set_laser_current(0)
time.sleep(0.1)

current_max = 40
currents = np.linspace(0, current_max, num=100)

laser_powers = 0 * currents
measured_currents = 0 * currents

for i, current in enumerate(currents):
    driver.set_laser_current(current)
    time.sleep(0.02)
    laser_powers[i] = driver.get_laser_power()
    measured_currents[i] = driver.get_laser_current()