diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/lock_eit.py | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py index d68c31a..bca68e1 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -62,6 +62,13 @@ def initLog(): eitLog.x = timeTrace eitLog.y = eitTrace + rfPoutTrace = Trace("rfPout") + rfPoutTrace.config['unit']='dBm' + rfPoutLog = TraceXY("rfPout") + rfPoutLog.config['type'] = 'timestamp' + rfPoutLog.x = timeTrace + rfPoutLog.y = rfPoutTrace + log = TraceSetSameX("timelog") log.config['type'] = 'timestamp' @@ -69,6 +76,7 @@ def initLog(): log.addTrace(freqLog) log.addTrace(feedbackLog) log.addTrace(eitLog) + log.addTrace(rfPoutLog) log.config['tags']['apparatus']=getConfig(apparatus) return log @@ -99,10 +107,13 @@ def adjustRFandLog(apparatus): rfgen.setFreqFixed(freq) # print(f'error = {err}, feedback = {fdbck}, request freq = {freq}') + rfPout = ai['rfgen'].getRFAmplitude() + log.addPointToTrace(timenow) log.addPointToTrace(err, "error") log.addPointToTrace(freq0, "frequency") log.addPointToTrace(fdbck, "feedback") + log.addPointToTrace(rfPout, "rfPout") log.addPointToTrace(eit, "eit") @@ -156,7 +167,10 @@ async def main(): logger.info('========== Initial lock ===========') - apparatus.state = 'Initial lock' + ai['rfgen'].setRFAmplitude(0) + rfPout = ai['rfgen'].getRFAmplitude() + apparatus.state = f'Initial lock RF power {rfPout} dBm' + logger.info(apparatus.state) update_webpage(apparatus=apparatus) apparatus.gui_log.setTraces( initLog() ) ai['pid'].reset() @@ -166,20 +180,25 @@ async def main(): ) logger.info('========= Long term lock ===========') - apparatus.state = 'Long term lock' - update_webpage(apparatus=apparatus) apparatus.gui_log.setTraces( initLog() ) - ai['pid'].reset() - apparatus.runStatus = True - res = await asyncio.gather( - feedbackLoop(apparatus, nsteps=100000) - ) + for p in np.linspace(0,9, 110): + ai['rfgen'].setRFAmplitude(p) + rfPout = ai['rfgen'].getRFAmplitude() + apparatus.state = f'Long term lock RF power {rfPout} dBm' + logger.info(apparatus.state) + update_webpage(apparatus=apparatus) + ai['pid'].reset() + apparatus.runStatus = True + res = await asyncio.gather( + feedbackLoop(apparatus, nsteps=50) + ) apparatus.state = 'Done working with hardware' + logger.info(apparatus.state) apparatus.gui_log.stop_tasks() task_wp_update_loop.cancel() - logger.info("done") + logger.info("exiting main loop") return(apparatus) def update_webpage(byWhom=None, apparatus=None): |