aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/lock_eit.py46
1 files changed, 41 insertions, 5 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py
index aadfe7f..4fcadfa 100644
--- a/examples/lock_eit.py
+++ b/examples/lock_eit.py
@@ -136,10 +136,10 @@ async def main():
rfgen = AgilentE8257D(instr_rfgen)
instr_lockin=rm.open_resource('TCPIP::192.168.0.51::INSTR')
lockin = SRS_SR865A(instr_lockin)
- print('------ Header start -------------')
- print(str.join('\n', scope.getHeader()))
- print(str.join('\n', rfgen.getHeader()))
- print('------ Header ends -------------')
+ # print('------ Header start -------------')
+ # print(str.join('\n', scope.getHeader()))
+ # print(str.join('\n', rfgen.getHeader()))
+ # print('------ Header ends -------------')
# ch1 = scope.getTrace(1)
# traces = scope.getAllTraces()
# pid = PID(100,400,0, sign=-1); # goom for dm=-2 resonance
@@ -165,7 +165,7 @@ async def main():
rfPstop = 10
rfPowerList = np.linspace(rfPstart, rfPstop, 11)
rfPower0 = rfPstart
- rfPower0 = 3.4
+ rfPower0 = 9
ai['rfgen'].setRFAmplitude(rfPower0)
d=getConfig(apparatus)
@@ -178,11 +178,47 @@ async def main():
update_webpage(apparatus=apparatus)
apparatus.gui_log.setTraces( initLog() )
ai['pid'].reset()
+ ai['pid'].setEnable(True)
apparatus.runStatus = True
res = await asyncio.gather(
feedbackLoop(apparatus, nsteps=200)
)
+ async def calibratingLockin():
+ apparatus.state = f'Calibrating lockin response at RF power {rfPout} dBm'
+ logger.info(apparatus.state)
+ update_webpage(apparatus=apparatus)
+ ai['pid'].setEnable(True)
+ ai['pid'].reset()
+ apparatus.gui_log.setTraces( initLog() )
+ res = await asyncio.gather(
+ feedbackLoop(apparatus, nsteps=20)
+ )
+
+ fr0 = ai['rfgen'].getFreqFixed()
+ df = 10
+ ai['pid'].setEnable(False)
+ ai['pid'].reset()
+ ai['rfgen'].setFreqFixed(fr0+df)
+ res = await asyncio.gather(
+ feedbackLoop(apparatus, nsteps=20)
+ )
+
+ log = apparatus.gui_log.traces
+ trE=log.getTrace('error')
+
+ e1 = np.mean(trE.y.values[0:20])
+ e2 = np.mean(trE.y.values[20:])
+ dE = e2-e1
+ slope = dE/df
+
+ logger.info(f'dE = {dE}')
+ logger.info(f'slope = {slope}')
+
+ return slope
+
+ lockin_slope= await calibratingLockin()
+
logger.info('========= Long term lock ===========')
apparatus.gui_log.setTraces( initLog() )
apparatus.runStatus = True