diff options
Diffstat (limited to 'examples/lock_eit.py')
-rw-r--r-- | examples/lock_eit.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py index 6b52c50..7d92ab1 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -1,3 +1,7 @@ +import logging +# this should be done before justpy is called or log formatter does not work +logging.basicConfig(format='%(asctime)s %(levelname)8s %(name)s: %(message)s', datefmt='%m/%d/%Y %H:%M:%S') + import justpy as jp import pyvisa import numpy as np @@ -14,6 +18,11 @@ from qolab.hardware.rf_generator import AgilentE8257D from qolab.feedback import PID from qolab.data import TraceSetSameX, TraceXY, Trace +l = logging.getLogger('qolab.gui.web') +l.setLevel(logging.INFO) +logger = logging.getLogger('Magnetometer') +logger.setLevel(logging.INFO) + def initLog(): errorTrace = Trace("error") errorTrace.config['unit']='V' @@ -86,7 +95,7 @@ async def main(): apparatus.gui_log = gui.QOLTimeLog(a=wp) apparatus.gui_log.save_controls.getNextDataFile = apparatus.getNextDataFile - print("testing") + logger.info("Accessing hardware") rm = pyvisa.ResourceManager() instr_scope=rm.open_resource('TCPIP::192.168.0.61::INSTR') scope = SDS1104X(instr_scope) @@ -114,7 +123,7 @@ async def main(): # apparatus.rfgen.setFreqFixed(freqZero) - print('========== Initial lock ===========') + logger.info('========== Initial lock ===========') apparatus.state = 'Initial lock' update_webpage(apparatus=apparatus) apparatus.gui_log.setTraces( initLog() ) @@ -124,7 +133,7 @@ async def main(): feedbackLoop(apparatus, nsteps=100) ) - print('========= Long term lock ===========') + logger.info('========= Long term lock ===========') apparatus.state = 'Long term lock' update_webpage(apparatus=apparatus) apparatus.gui_log.setTraces( initLog() ) @@ -138,7 +147,7 @@ async def main(): apparatus.gui_log.stop_tasks() task_wp_update_loop.cancel() - print("done") + logger.info("done") return(apparatus) def update_webpage(byWhom=None, apparatus=None): @@ -162,6 +171,7 @@ async def jp_startup(): jp.run_task(main()) if __name__ == '__main__': + logger.info('========== Start up ===========') wp = jp.WebPage(delete_flag=False) apparatus = BasicInstrument() |