diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-15 17:19:17 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-15 17:19:17 -0500 |
commit | 37717017ad9e9c69ae9e72dfdc6676be49591010 (patch) | |
tree | 93281662aee914011cc446ae7354cfe93fe94407 /examples/lock_eit.py | |
parent | 8eddafb1a111c5935b2c59db7a8daf0f1335f7cb (diff) | |
download | qolab-37717017ad9e9c69ae9e72dfdc6676be49591010.tar.gz qolab-37717017ad9e9c69ae9e72dfdc6676be49591010.zip |
added web gui to the lock_eit
Diffstat (limited to 'examples/lock_eit.py')
-rw-r--r-- | examples/lock_eit.py | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py index 706acdd..f61e189 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -1,3 +1,4 @@ +import justpy as jp import pyvisa import numpy as np import matplotlib as mpl @@ -72,9 +73,13 @@ def adjustRFandLog(apparatus): def updateLogPlot(apparatus): log = apparatus.log - plt.clf() + f = plt.figure() + # plt.clf() log.plot() - plt.pause(.0001) + log_chart.set_figure(f) + plt.close(f) + # plt.pause(.0001) + # jp.Matplotlib(a=wp) print(f're-plotting') async def updateLogPlotLoop(apparatus): @@ -137,36 +142,45 @@ async def main(): apparatus.rfgen.setFreqFixed(freqDeltaM2+100) - print('initial lock') + print('========== Initial lock ===========') apparatus.logFileName = None apparatus.pid.reset() apparatus.runStatus = True - # feedbackLoop(apparatus, nsteps=10) res = await asyncio.gather( feedbackLoop(apparatus, nsteps=100), updateLogPlotLoop(apparatus), updateLogFileLoop(apparatus) ) print(apparatus.logFileName) updateLogPlot(apparatus) - print('long term lock') + print('========= Long term lock ===========') apparatus.log = initLog() apparatus.logFileName = None apparatus.logFileName = apparatus.getNextDataFile() apparatus.pid.reset() apparatus.runStatus = True - # feedbackLoop(apparatus, nsteps=100) - res = await asyncio.gather( feedbackLoop(apparatus, nsteps=10000), updateLogPlotLoop(apparatus), updateLogFileLoop(apparatus) ) + res = await asyncio.gather( feedbackLoop(apparatus, nsteps=1000), updateLogPlotLoop(apparatus), updateLogFileLoop(apparatus) ) print(apparatus.logFileName) updateLogPlot(apparatus) # apparatus.log.save(apparatus.logFileName, item_format='.15e') print(apparatus.logFileName) + print('========= Done working with hardware ===========') return(apparatus) +async def getPage(): + return wp + +async def jp_startup(): + jp.run_task(main()) if __name__ == '__main__': - mpl.use("TkAgg") - # apparatus=main() - apparatus = asyncio.run(main()) + wp = jp.WebPage(delete_flag=False) + d=jp.Div(text='Magnetometer lock', a=wp) + f = plt.figure() + log_chart = jp.Matplotlib(a=wp) + plt.close(f) + # mpl.use("TkAgg") + # apparatus = asyncio.run(main()) + jp.justpy(getPage, startup=jp_startup) |