aboutsummaryrefslogtreecommitdiff
path: root/examples/lock_eit.py
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-16 17:28:54 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-16 17:28:54 -0500
commitfb3da43e4eb939350624e4013a5d0a97be92ac64 (patch)
treeba62cc719a71210587ad5eea4662fba5b5b734c2 /examples/lock_eit.py
parent9c738a6af3d9454cd4101a8f7ceb4a773e627a39 (diff)
downloadpyExpControl-fb3da43e4eb939350624e4013a5d0a97be92ac64.tar.gz
pyExpControl-fb3da43e4eb939350624e4013a5d0a97be92ac64.zip
added save filename display
Diffstat (limited to 'examples/lock_eit.py')
-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)