aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/lock_eit.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py
index 5d48dd1..91ae6f4 100644
--- a/examples/lock_eit.py
+++ b/examples/lock_eit.py
@@ -107,7 +107,6 @@ freqZero = 6834686400
freqDeltaM2 = 6835387100
async def main():
- apparatus = BasicInstrument()
apparatus.config['Device type'] = 'QOL VAMPIRE HighPower magnetometer'
apparatus.config['Device model'] = 'v0.1'
apparatus.config['FnamePrefix'] = 'locked_magnetometer'
@@ -148,6 +147,7 @@ async def main():
update_webpage(apparatus=apparatus)
apparatus.log = initLog()
apparatus.logFileName = None
+ wp.data['log_file_name'] = apparatus.logFileName
apparatus.pid.reset()
apparatus.runStatus = True
res = await asyncio.gather( feedbackLoop(apparatus, nsteps=100), updateLogPlotLoop(apparatus), updateLogFileLoop(apparatus) )
@@ -158,8 +158,9 @@ async def main():
apparatus.state = 'Long term lock'
update_webpage(apparatus=apparatus)
apparatus.log = initLog()
- apparatus.logFileName = None
- # apparatus.logFileName = apparatus.getNextDataFile()
+ # apparatus.logFileName = None
+ apparatus.logFileName = apparatus.getNextDataFile()
+ wp.data['log_file_name'] = apparatus.logFileName
apparatus.pid.reset()
apparatus.runStatus = True
res = await asyncio.gather( feedbackLoop(apparatus, nsteps=100000), updateLogPlotLoop(apparatus), updateLogFileLoop(apparatus) )
@@ -186,14 +187,27 @@ async def getPage():
async def jp_startup():
jp.run_task(main())
+async def clear_log(self, msg):
+ apparatus.log = initLog()
+
+button_classes = 'm-2 p-2 text-red-700 bg-white hover:bg-red-200 hover:text-red-500 border focus:border-red-500 focus:outline-none'
+
if __name__ == '__main__':
wp = jp.WebPage(delete_flag=False)
+ apparatus = BasicInstrument()
d=jp.Div(text='Magnetometer log', a=wp, classes='text-white bg-blue-500 text-center text-xl')
div_status = jp.Div(classes='text-xl flex m0 p-1 space-x-4 bg-gray-300 font-mono', a=wp)
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)
+ b_clear_log = jp.Button(text='Clear log', a=div_log, classes=button_classes, click=clear_log)
+
f = plt.figure()
log_chart = jp.Matplotlib(a=wp)
plt.close(f)