From fdf0d60a6b2f3bc1d6ec5852dc6e30cbf48aa3c2 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 22 Dec 2021 15:46:03 -0500 Subject: made subfunctions for simplier code setup --- examples/lock_eit.py | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'examples/lock_eit.py') diff --git a/examples/lock_eit.py b/examples/lock_eit.py index 71c9d6b..aadfe7f 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -158,9 +158,15 @@ async def main(): SweepSpan = 10000 ai['rfgen'].stopFrequencySweep() # ai['rfgen'].setFreqFixed(freqDeltaMm2) - ai['rfgen'].setFreqFixed(freqZero) - # ai['rfgen'].setFreqFixed(freqDeltaMp2) - ai['rfgen'].setRFAmplitude(0) + # ai['rfgen'].setFreqFixed(freqZero) + ai['rfgen'].setFreqFixed(freqDeltaMp2) + + rfPstart = -10 + rfPstop = 10 + rfPowerList = np.linspace(rfPstart, rfPstop, 11) + rfPower0 = rfPstart + rfPower0 = 3.4 + ai['rfgen'].setRFAmplitude(rfPower0) d=getConfig(apparatus) instruments_config=gui.QOLDictionary(a=wp, name='Instruments configs', container=d) @@ -174,31 +180,39 @@ async def main(): ai['pid'].reset() apparatus.runStatus = True res = await asyncio.gather( - feedbackLoop(apparatus, nsteps=100) + feedbackLoop(apparatus, nsteps=200) ) logger.info('========= Long term lock ===========') apparatus.gui_log.setTraces( initLog() ) apparatus.runStatus = True - # apparatus.state = f'Long term lock RF power {rfPout} dBm' - # logger.info(apparatus.state) - # update_webpage(apparatus=apparatus) - # res = await asyncio.gather( - # feedbackLoop(apparatus, nsteps=100000) - # ) - for p in np.linspace(0,9, 110): - # for p in np.linspace(0,9, 11): - ai['rfgen'].setRFAmplitude(p) - rfPout = ai['rfgen'].getRFAmplitude() + + async def longTermLock(): 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) + feedbackLoop(apparatus, nsteps=100000) ) - + return res + + async def sweepRFPower(): + # for p in np.linspace(-10,10, 110): + for p in rfPowerList: + 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) + ) + return res + + # await sweepRFPower() + await longTermLock() apparatus.state = 'Done working with hardware' logger.info(apparatus.state) -- cgit v1.2.3