aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/eit_with_vcsel.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/examples/eit_with_vcsel.py b/examples/eit_with_vcsel.py
new file mode 100644
index 0000000..b852f42
--- /dev/null
+++ b/examples/eit_with_vcsel.py
@@ -0,0 +1,72 @@
+import pyvisa
+import numpy as np
+import platform
+import time
+
+
+from qolab.data import TraceSetSameX, TraceXY, Trace
+from qolab.hardware.rf_generator import QOL_LMX2487
+from qolab.hardware.daq import LabJackUE9
+from qolab.hardware.power_supply.keysight_e3612a import KeysightE3612A
+
+rm = pyvisa.ResourceManager()
+instr=rm.open_resource('USB0::10893::4354::MY61001869::0::INSTR')
+ps = KeysightE3612A(instr)
+
+if platform.system() == 'Linux':
+ rfgen=QOL_LMX2487(port='/dev/ttyUSB0', speed=115200, timeout=1)
+else:
+ rfgen=QOL_LMX2487(port='COM4', speed=115200, timeout=1)
+
+daq = LabJackUE9()
+
+central_frequency = 6.83468e9
+frequency_span = 2500e3
+
+dwellTime=0.1
+Np=100
+
+print('Setting magnetic field coils currents')
+ps.setChanIout(1, 0.0)
+ps.setChanIout(2, 0.070173)
+ps.setChanIout(3, 0.01057)
+print('Done setting magnetic field coils currents')
+
+def eitSweep(central_frequency, frequency_span, Np):
+ frList = np.linspace(central_frequency-frequency_span/2, central_frequency+frequency_span/2, Np)
+ trFreq=Trace('Frequency')
+ trFreq.config['unit']='Hz'
+ trTransmission=Trace('Transmission')
+ trTransmission.config['unit']='Arb. Unit'
+ trLockin=Trace('Lockin')
+ trLockin.config['unit']='V'
+
+ trEIT = TraceSetSameX('EIT')
+
+ for fr in frList:
+ print(fr)
+ rfgen.setFreqFixed(fr)
+ time.sleep(dwellTime)
+ transmission = daq.getAIN(0)
+ lockin = daq.getAIN(1)
+
+ trFreq.addPoint(fr)
+ trTransmission.addPoint(transmission)
+ trLockin.addPoint(lockin)
+
+ trFreq.values = trFreq.values - central_frequency
+ trEIT.addTraceX(trFreq)
+ trEIT.addTrace(trTransmission)
+ trEIT.addTrace(trLockin)
+
+ return trEIT
+
+trEIT = eitSweep(central_frequency, frequency_span, Np)
+trEIT.plot()
+
+
+
+
+
+
+