diff --git a/phoenix_bec/bec_ipython_client/startup/post_startup.py b/phoenix_bec/bec_ipython_client/startup/post_startup.py index db967ac..318ad9a 100644 --- a/phoenix_bec/bec_ipython_client/startup/post_startup.py +++ b/phoenix_bec/bec_ipython_client/startup/post_startup.py @@ -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() diff --git a/phoenix_bec/devices/xmap_phoenix_no_hdf5.py b/phoenix_bec/devices/xmap_phoenix_no_hdf5.py index fe56c04..e3ea8a8 100644 --- a/phoenix_bec/devices/xmap_phoenix_no_hdf5.py +++ b/phoenix_bec/devices/xmap_phoenix_no_hdf5.py @@ -364,6 +364,3 @@ class XMAPphoenix(PSIDetectorBase): pixels_per_run = Cpt(EpicsSignal, "PixelsPerRun") #nd_array_mode = Cpt(EpicsSignal, "NDArrayMode") print('DONE connecton chanels in XMAPphoenix') - -if __name__ == "__main__": - xmap = XMAPphoenix(name="xmap", prefix="X07MB-XMAP:", sim_mode=True) diff --git a/phoenix_bec/local_scripts/Examples/DefiningEpics_Channels.py b/phoenix_bec/local_scripts/Examples/DefiningEpics_Channels.py deleted file mode 100644 index d2b635f..0000000 --- a/phoenix_bec/local_scripts/Examples/DefiningEpics_Channels.py +++ /dev/null @@ -1,40 +0,0 @@ -from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO -from ophyd import Component as Cpt - -#option I via direct acces to classes - -ScanX = EpicsMotor(name='ScanX',prefix='X07MB-ES-MA1:ScanX') -ScanY = EpicsMotor(name='ScanY',prefix='X07MB-ES-MA1:ScanY') -DIODE = EpicsSignal(name='SI',read_pv='X07MB-OP2-SAI_07:MEAN') -SMPL = EpicsSignal(name='SMPL',read_pv='X07MB-OP2:SMPL') -CYCLES = EpicsSignal(name='SMPL',read_pv='X07MB-OP2:TOTAL-CYCLES',write_pv='X07MB-OP2:TOTAL-CYCLES') - -# Option 2 using component - -class StageXY(Device): - x = Cpt(EpicsMotor, 'ScanX') - y = Cpt(EpicsMotor, 'ScanY') - -xy_stage = StageXY('X07MB-ES-MA1:', name='stage') - -############################################# -# This is basic bluesky -# Epics motor def seems to use init params in device, whcih are -# __init__( -# self, -# prefix="", -# *, -# name, -# kind=None, -# read_attrs=None, -# configuration_attrs=None, -# parent=None, -# **kwargs, -# ): -# -######################################################### - -# to move motor use -# stage.x.move(0) -# to see all dict -# stage.x.__dict__ diff --git a/phoenix_bec/local_scripts/Examples/Learn_about_bec_shell/bec_commands.py b/phoenix_bec/local_scripts/Examples/Learn_about_bec_shell/bec_commands.py new file mode 100644 index 0000000..7125180 --- /dev/null +++ b/phoenix_bec/local_scripts/Examples/Learn_about_bec_shell/bec_commands.py @@ -0,0 +1,13 @@ + +print('#######################################') +print('bec.show_global_vars()') +bec.show_global_vars() + +print('#######################################') +print('bec.show_all_commands()') +bec.show_all_commands() + + +print('#######################################') +print('bec.list_user_scripts()') +bec.list_user_scripts() diff --git a/phoenix_bec/local_scripts/Examples/Learn_about_bec_shell/command_line_tricks.py b/phoenix_bec/local_scripts/Examples/Learn_about_bec_shell/command_line_tricks.py new file mode 100644 index 0000000..f38103f --- /dev/null +++ b/phoenix_bec/local_scripts/Examples/Learn_about_bec_shell/command_line_tricks.py @@ -0,0 +1,2 @@ +print('Work with unix shell comands :') +print('use %ls %mkdir etc ')