aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/lock_eit.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py
index 8742db3..08522c5 100644
--- a/examples/lock_eit.py
+++ b/examples/lock_eit.py
@@ -233,6 +233,64 @@ async def main():
lockin_slope= await calibratingLockin()
+ async def responseToChangeOfBfieldControlVoltage():
+ apparatus.state = f'Calibrating lockin response to change of Bfield control voltage, {rfPout} dBm'
+ logger.info(apparatus.state)
+ update_webpage(apparatus=apparatus)
+ ai['pid'].setEnable(True)
+ ai['pid'].reset()
+ apparatus.gui_log.setTraces( initLog() )
+ dV = 0.01
+ ai['lockin'].AuxOut1=dV
+ apparatus.getBCurrent(); # this automatically logs value to TSDB
+
+ # initial lock
+ ai['pid'].setEnable(True)
+ ai['pid'].reset()
+ res = await asyncio.gather(
+ feedbackLoop(apparatus, nsteps=20)
+ )
+
+ # this is for the money lock
+ res = await asyncio.gather(
+ feedbackLoop(apparatus, nsteps=30)
+ )
+
+ fr0 = ai['rfgen'].getFreqFixed()
+ apparatus.getBCurrent(); # this automatically logs value to TSDB
+
+ # this is for the money lock
+ ai['lockin'].AuxOut1=0
+ ai['pid'].setEnable(True)
+ ai['pid'].reset()
+ res = await asyncio.gather(
+ feedbackLoop(apparatus, nsteps=30)
+ )
+ fr1 = ai['rfgen'].getFreqFixed()
+
+ log = apparatus.gui_log.traces
+ trE=log.getTrace('error')
+
+ df = fr0 - fr1
+ slope = df/dV
+
+ logger.info(f'df = {df}')
+ logger.info(f'response to magnetic control voltage = {slope} Hz/V')
+
+ apparatus.getBCurrent(); # this automatically logs value to TSDB
+
+ # relock to default state
+ ai['lockin'].AuxOut1=0
+ ai['pid'].setEnable(True)
+ ai['pid'].reset()
+ res = await asyncio.gather(
+ feedbackLoop(apparatus, nsteps=20)
+ )
+
+ return slope
+
+ B_response= await responseToChangeOfBfieldControlVoltage()
+
logger.info('========= Long term lock ===========')
apparatus.gui_log.setTraces( initLog() )
apparatus.gui_log.traces.config['tags']['lockin_slope']=float(lockin_slope)