diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/lock_eit.py | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py index 47e8975..6b52c50 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -46,7 +46,7 @@ async def feedbackLoop(apparatus, nsteps): # while True: for i in range(0,nsteps): adjustRFandLog(apparatus) - await asyncio.sleep(0.001) + await asyncio.sleep(0.1) apparatus.runStatus = False def adjustRFandLog(apparatus): @@ -103,7 +103,6 @@ async def main(): apparatus.scope = scope apparatus.rfgen = rfgen apparatus.pid = pid - apparatus.log = initLog() apparatus.state = None apparatus.runStatus = False @@ -118,36 +117,26 @@ async def main(): print('========== Initial lock ===========') apparatus.state = 'Initial lock' update_webpage(apparatus=apparatus) - apparatus.gui_log.traces = initLog() - apparatus.logFileName = None - wp.data['log_file_name'] = apparatus.logFileName + apparatus.gui_log.setTraces( initLog() ) apparatus.pid.reset() apparatus.runStatus = True res = await asyncio.gather( - feedbackLoop(apparatus, nsteps=1000) + feedbackLoop(apparatus, nsteps=100) ) print('========= Long term lock ===========') apparatus.state = 'Long term lock' update_webpage(apparatus=apparatus) - apparatus.gui_log.traces = initLog() - apparatus.logFileName = None - # apparatus.logFileName = apparatus.getNextDataFile() - wp.data['log_file_name'] = apparatus.logFileName + apparatus.gui_log.setTraces( initLog() ) apparatus.pid.reset() apparatus.runStatus = True res = await asyncio.gather( - feedbackLoop(apparatus, nsteps=10000) - # , updateLogPlotLoop(apparatus), - # updateLogFileLoop(apparatus) + feedbackLoop(apparatus, nsteps=100000) ) - print(apparatus.logFileName) - # updateLogPlot(apparatus) - # apparatus.log.save(apparatus.logFileName, item_format='.15e') apparatus.state = 'Done working with hardware' - # update_webpage(apparatus=apparatus) - task_gui_log_update_loop.cancel() + + apparatus.gui_log.stop_tasks() task_wp_update_loop.cancel() print("done") return(apparatus) @@ -182,12 +171,6 @@ if __name__ == '__main__': clock_upd = jp.Div(text='Clock Loading...', classes='text-xl bg-gray-400', a=div_status) status_line = jp.Div(text='Status Loading...',classes='text-xl', a=div_status) - div_save = jp.Div(classes='flex', a=wp) - div_log_file_name = jp.Div(model=[wp,'log_file_name'], a=div_save) - wp.data['log_file_name'] = None - - div_log = jp.Div(classes='flex', a=wp) - # mpl.use("TkAgg") # apparatus = asyncio.run(main()) jp.justpy(getPage, startup=jp_startup) |