def test(self): current_path = os.getcwd() bitstreams_path = os.path.join(current_path, 'bitstreams') host = os.getenv('HOST', '192.168.1.100') client = KClient(host) assert client.is_connected ssh = ZynqSSH(host, 'koheron') ssh.load_pl(os.path.join(bitstreams_path, 'oscillo.bit')) driver = Oscillo(client, current_mode='pwm') current = 30 #mA driver.set_laser_current(current) driver.start_laser() assert driver.get_laser_power() > 400
def connect(self): if not self.is_connected: self.client = KClient(self.host) self.connection_info.setText('Connecting to ' + self.host + ' ...') if self.client.is_connected: self.connection_info.setText('Connected to ' + self.host) self.is_connected = True self.connect_button.setStyleSheet('QPushButton {color: red;}') self.connect_button.setText('Disconnect') self.parent.connected() self.ssh = ZynqSSH(self.host, 'koheron') else: self.connection_info.setText('Failed to connect to ' + self.host) else: if hasattr(self, 'client'): self.client.__del__() self.connection_info.setText('Disconnected') self.parent.disconnected() self.connect_button.setStyleSheet('QPushButton {color: green;}') self.connect_button.setText('Connect') self.is_connected = False
import initExample from lase.core import KClient # Driver to use from lase.drivers import Oscillo # Modules to import import numpy as np import matplotlib.pyplot as plt import time # Connect to Lase host = '192.168.1.4' # Lase IP address client = KClient(host) driver = Oscillo(client) # Replace with appropriate driver # Enable laser driver.start_laser() # Set laser current current = 15 #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()