|
|
|
@ -1,4 +1,7 @@
|
|
|
|
|
"""
|
|
|
|
|
FILE
|
|
|
|
|
phoenix_bec.bec_iphyton_client
|
|
|
|
|
|
|
|
|
|
Post startup script for the BEC client. This script is executed after the
|
|
|
|
|
IPython shell is started. It is used to load the beamline specific
|
|
|
|
|
information and to setup the prompts.
|
|
|
|
@ -10,6 +13,11 @@ While command-line arguments have to be set in the pre-startup script, the
|
|
|
|
|
post-startup script can be used to load beamline specific information and
|
|
|
|
|
to setup the prompts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#################################################################
|
|
|
|
|
# OLD CODE FROM CSAXS ONLY AS EXAMPLE NEXT LINES CAN BE IGNORED
|
|
|
|
|
################################################################
|
|
|
|
|
from bec_lib.logger import bec_logger
|
|
|
|
|
|
|
|
|
|
logger = bec_logger.logger
|
|
|
|
@ -24,13 +32,14 @@ to setup the prompts.
|
|
|
|
|
|
|
|
|
|
_session_name = "LamNI"
|
|
|
|
|
lamni = LamNI(bec)
|
|
|
|
|
logger.success("LamNI session loaded.")
|
|
|
|
|
logger.succ#ess("LamNI session loaded.")
|
|
|
|
|
|
|
|
|
|
elif _args.session.lower() == "csaxs":
|
|
|
|
|
print("Loading cSAXS session")
|
|
|
|
|
from csaxs_bec.bec_ipython_client.plugins.cSAXS import *
|
|
|
|
|
|
|
|
|
|
logger.success("cSAXS session loaded.")
|
|
|
|
|
#####################################################################
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -42,23 +51,24 @@ from IPython.core.magic import register_line_magic
|
|
|
|
|
from bec_lib.logger import bec_logger
|
|
|
|
|
|
|
|
|
|
logger = bec_logger.logger
|
|
|
|
|
logger = bec_logger.LOGLEVEL.TRACE
|
|
|
|
|
#logger = bec_logger.LOGLEVEL.TRACE
|
|
|
|
|
|
|
|
|
|
#pylint: disable=invald-name, unused-import, import-error, undefined-variable, unused-variable, unused-argument, no-name-in-module
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_session_name = "session_phoenix"
|
|
|
|
|
# SETUP PROMPTS
|
|
|
|
|
bec._ip.prompts.username = "PHOENIX"
|
|
|
|
|
bec._ip.prompts.status = 1
|
|
|
|
|
|
|
|
|
|
# make sure that edited modules are reloaded when changed
|
|
|
|
|
print('post_startup.py : set autoreload of modules')
|
|
|
|
|
print('phoenix_bec/bec_iphyon_client/startup/post_startup.py')
|
|
|
|
|
print('... set autoreload of modules')
|
|
|
|
|
bec._ip.run_line_magic("reload_ext","autoreload")
|
|
|
|
|
bec._ip.run_line_magic("autoreload", "2")
|
|
|
|
|
|
|
|
|
|
print('autoreload loaded ')
|
|
|
|
|
|
|
|
|
|
###########
|
|
|
|
|
################################################################
|
|
|
|
|
#
|
|
|
|
|
# next lines are not ideal and likely need to be removed they are a temporary fix as
|
|
|
|
|
# we had trouble finding certain paths.
|
|
|
|
@ -67,7 +77,7 @@ print('autoreload loaded ')
|
|
|
|
|
# path to ophyd devices is only way to find default ophyd devices
|
|
|
|
|
# path to python packages not ideal but only way to add pyp5 and pandas packages
|
|
|
|
|
#
|
|
|
|
|
##########
|
|
|
|
|
##############################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print('post_startup.py : set some paths as temp fix. This needs to be solved ')
|
|
|
|
@ -92,17 +102,7 @@ if p_path not in sys.path:
|
|
|
|
|
#... register BL specific magic commands
|
|
|
|
|
#
|
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
|
|
@register_line_magic
|
|
|
|
|
def ph_reload(line):
|
|
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
|
#
|
|
|
|
|
# this reloads certain phoenix related script to the iphython shell.
|
|
|
|
|
# useful for debugging/development to be revised for production
|
|
|
|
|
# aim of this magic is to quickl reload BL related stuff for debugging
|
|
|
|
|
# Most likely there are better ways to do this (possibly bec.reload_user_script()
|
|
|
|
|
# but syntax not clear, error messages. Here we know what we do.
|
|
|
|
|
# not clear, error messages. Here we know what we do.
|
|
|
|
|
#
|
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
|
@ -118,8 +118,9 @@ def ph_reload(line):
|
|
|
|
|
#ph_config=PH.PhoenixConfighelper()
|
|
|
|
|
#enddef
|
|
|
|
|
|
|
|
|
|
print('##################################################################')
|
|
|
|
|
print('register magic')
|
|
|
|
|
print('...... %ph_load_xmap')
|
|
|
|
|
print('...... %ph_load_xmap ... to reload xmap configuration')
|
|
|
|
|
@register_line_magic
|
|
|
|
|
def ph_load_xmap(line):
|
|
|
|
|
|
|
|
|
@ -132,7 +133,7 @@ def ph_load_xmap(line):
|
|
|
|
|
print('elapsed time:', tt.time()-t0)
|
|
|
|
|
#enddef
|
|
|
|
|
|
|
|
|
|
print('...... %ph_load_falcon')
|
|
|
|
|
print('...... %ph_load_falcon ... to reload falcon configuration')
|
|
|
|
|
@register_line_magic
|
|
|
|
|
def ph_load_falcon(line):
|
|
|
|
|
|
|
|
|
@ -143,7 +144,7 @@ def ph_load_falcon(line):
|
|
|
|
|
print('elapsed time:', tt.time()-t0)
|
|
|
|
|
#enddef
|
|
|
|
|
|
|
|
|
|
print('...... %ph_load_config')
|
|
|
|
|
print('...... %ph_load_config ... to reload phoenix default configuration')
|
|
|
|
|
@register_line_magic
|
|
|
|
|
def ph_load_config(line):
|
|
|
|
|
t0=tt.time()
|
|
|
|
@ -164,9 +165,10 @@ def ph_load_config(line):
|
|
|
|
|
# .................. phoenix_server=PhoenixBL()
|
|
|
|
|
# and in ipython shell only as
|
|
|
|
|
# .............. phoenix = Ph.Pheonix(BL()
|
|
|
|
|
#
|
|
|
|
|
##
|
|
|
|
|
#####################################################################################
|
|
|
|
|
|
|
|
|
|
print('###############################################################')
|
|
|
|
|
print('init phoenix_bec/scripts/phoenix.py in two different ways')
|
|
|
|
|
print(' 1) phoenix_server = PhoenixBL() ... takes code from server version ')
|
|
|
|
|
phoenix_server=PhoenixBL()
|
|
|
|
|