def measuare(): ldc = Device().get_ldc4005_instance() pm100 = Device().get_pm100_instance() ldc.ld_current_in_A_setpoint(0) time.sleep(1) ldc.on() time.sleep(3) current = list() voltage = list() power = list() set_current_array = np.linspace(0, 0.020, 50) for i in range(0, len(set_current_array)): ldc.ld_current_in_A_setpoint(str(set_current_array[i])) current.append(ldc.ld_current_reading()) voltage.append(ldc.ld_voltage_reading()) power.append(pm100.get_power()) J = np.array(current, dtype=float) V = np.array(voltage, dtype=float) L = np.array(power, dtype=float) np.savetxt('data.txt', np.c_[J, V, L], fmt='%1.12e', header=' J [A] \t V \t L [w] ') time.sleep(0.1) ldc.off()
sys.path.insert(0, "/home/pawel1/Pulpit/PyLabDevice/Device") import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import time from Device import Device ldc = Device().get_ldc4005_instance() pm100 = Device().get_pm100_instance() ldc.set_ld_current_in_amper(0.015) ldc.on() time.sleep(2) min_wavelength = pm100.get_minimum_wavelength_in_nm() max_wavelength = pm100.get_maximum_wavelength_in_nm() wavelength = np.linspace(min_wavelength, max_wavelength, max_wavelength - min_wavelength + 1) power = np.zeros(len(wavelength)) for i in range(0, len(wavelength)): pm100.set_wavelength_in_nm(wavelength[i]) time.sleep(0.1) power[i] = pm100.get_power() plt.plot(wavelength, power) plt.show()