add magic for configuration load to post_startup.py
This commit is contained in:
@ -34,6 +34,7 @@ to setup the prompts.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from IPython.core.magic import register_line_magic
|
from IPython.core.magic import register_line_magic
|
||||||
|
import time as tt
|
||||||
|
|
||||||
# pylint: disable=invalid-name, unused-import, import-error, undefined-variable, unused-variable, unused-argument, no-name-in-module
|
# pylint: disable=invalid-name, unused-import, import-error, undefined-variable, unused-variable, unused-argument, no-name-in-module
|
||||||
import sys
|
import sys
|
||||||
@ -45,23 +46,11 @@ bec._ip.prompts.status = 1
|
|||||||
|
|
||||||
# make sure that edited modules are reloaded when changed
|
# make sure that edited modules are reloaded when changed
|
||||||
print('post_startup.py : set autoreload of modules')
|
print('post_startup.py : set autoreload of modules')
|
||||||
|
|
||||||
#def load_autoreload():
|
|
||||||
# bec._ip.run_line_magic("reload_ext","autoreload")
|
|
||||||
|
|
||||||
#try:
|
|
||||||
# #load_autoreload()
|
|
||||||
bec._ip.run_line_magic("reload_ext","autoreload")
|
bec._ip.run_line_magic("reload_ext","autoreload")
|
||||||
# print('1xn_line_magic("reload_ext","autoreload")
|
|
||||||
|
|
||||||
|
|
||||||
bec._ip.run_line_magic("autoreload", "2")
|
bec._ip.run_line_magic("autoreload", "2")
|
||||||
|
|
||||||
print('autoreload loaded ')
|
print('autoreload loaded ')
|
||||||
|
|
||||||
# define some adional magic for PHOENIX
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
#
|
#
|
||||||
# next lines are not ideal and likely need to be removed they are a temporary fix as we had trouble finding certain paths.
|
# next lines are not ideal and likely need to be removed they are a temporary fix as we had trouble finding certain paths.
|
||||||
@ -72,13 +61,13 @@ print('autoreload loaded ')
|
|||||||
#
|
#
|
||||||
##########
|
##########
|
||||||
|
|
||||||
print('post_startup.py : set some paths as temp fix. this needs to be solved ')
|
print('post_startup.py : set some paths as temp fix. This needs to be solved ')
|
||||||
|
|
||||||
ophyd_devices_path='/data/test/x07mb-test-bec/bec_deployment/ophyd_devices'
|
ophyd_devices_path='/data/test/x07mb-test-bec/bec_deployment/ophyd_devices'
|
||||||
p_path='/data/test/x07mb-test-bec/bec_deployment/bec_server_venv/lib/python3.11/site-packages'
|
p_path='/data/test/x07mb-test-bec/bec_deployment/bec_server_venv/lib/python3.11/site-packages'
|
||||||
|
|
||||||
print('add',ophyd_devices_path)
|
print('add ',ophyd_devices_path)
|
||||||
print('add',p_path)
|
print('add ',p_path)
|
||||||
|
|
||||||
if ophyd_devices_path not in sys.path:
|
if ophyd_devices_path not in sys.path:
|
||||||
sys.path.insert(1, os.path.expandvars(ophyd_devices_path))
|
sys.path.insert(1, os.path.expandvars(ophyd_devices_path))
|
||||||
@ -91,7 +80,7 @@ if p_path not in sys.path:
|
|||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
#
|
#
|
||||||
#... register BL specific magic comands
|
#... register BL specific magic commands
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
@ -101,7 +90,9 @@ def ph_reload(line):
|
|||||||
#
|
#
|
||||||
# this reloads certain phoenix related script to the iphython shell.
|
# this reloads certain phoenix related script to the iphython shell.
|
||||||
# useful for debugging/development to be revised for production
|
# useful for debugging/development to be revised for production
|
||||||
# aiom of this magic is to quickl reload BL related stuff for debugginf
|
# 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
|
||||||
#
|
#
|
||||||
# #######################################################################
|
# #######################################################################
|
||||||
print('reload phoenix_bec.scripts.phoenix to iphyhton console')
|
print('reload phoenix_bec.scripts.phoenix to iphyhton console')
|
||||||
@ -114,6 +105,32 @@ def ph_reload(line):
|
|||||||
#ph_config=PH.PhoenixConfighelper()
|
#ph_config=PH.PhoenixConfighelper()
|
||||||
#enddef
|
#enddef
|
||||||
|
|
||||||
|
print('register magic')
|
||||||
|
print('...... %ph_load_xmap')
|
||||||
|
@register_line_magic
|
||||||
|
def ph_load_xmap(line):
|
||||||
|
t0=tt.time()
|
||||||
|
phoenix_server.add_xmap()
|
||||||
|
print('elapsed time:', tt.time()-t0)
|
||||||
|
#enddef
|
||||||
|
|
||||||
|
print('...... %ph_load_falcon')
|
||||||
|
@register_line_magic
|
||||||
|
def ph_load_falcon(line):
|
||||||
|
t0=tt.time()
|
||||||
|
phoenix_server.add_falcon()
|
||||||
|
print('elapsed time:', tt.time()-t0)
|
||||||
|
#enddef
|
||||||
|
|
||||||
|
print('...... %ph_load_config')
|
||||||
|
@register_line_magic
|
||||||
|
def ph_load_config(line):
|
||||||
|
t0=tt.time()
|
||||||
|
phoenix_server.add_phoenix_config()
|
||||||
|
print('elapsed time:', tt.time()-t0)
|
||||||
|
#enddef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##@register_line_magic
|
##@register_line_magic
|
||||||
#def ph_post_startup(line):
|
#def ph_post_startup(line):
|
||||||
@ -130,10 +147,11 @@ def ph_reload(line):
|
|||||||
#
|
#
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
|
|
||||||
print('init phoenix_server = PhoenixBL() ... from server version ')
|
print('init phoenix_bec/scripts/phoenix.py in two different ways')
|
||||||
|
print(' 1) phoenix_server = PhoenixBL() ... takes code from server version ')
|
||||||
phoenix_server=PhoenixBL()
|
phoenix_server=PhoenixBL()
|
||||||
|
|
||||||
print('init phoenix=PH.PhoenixBL() ... on inpython shell onlz (for debugging)')
|
print(' 2) phoenix=PH.PhoenixBL() ... on inpython shell only! (for debugging)')
|
||||||
from phoenix_bec.scripts import phoenix as PH
|
from phoenix_bec.scripts import phoenix as PH
|
||||||
phoenix = PH.PhoenixBL()
|
phoenix = PH.PhoenixBL()
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# MOTORS ES1
|
# MOTORS ES1
|
||||||
#
|
#
|
||||||
|
|
||||||
ScanXX:
|
ScanX:
|
||||||
readoutPriority: baseline
|
readoutPriority: baseline
|
||||||
description: 'Horizontal sample position'
|
description: 'Horizontal sample position'
|
||||||
deviceClass: ophyd.EpicsMotor
|
deviceClass: ophyd.EpicsMotor
|
||||||
|
@ -36,8 +36,6 @@ class PhoenixBL():
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#define some epics channels
|
|
||||||
#scan_name = "phoenix_base"
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ class PhoenixBL():
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
print('init PhoenixBL from phoenix_bec/scripts/phoenix.py')
|
print('..... init PhoenixBL from phoenix_bec/scripts/phoenix.py')
|
||||||
|
|
||||||
#from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
|
#from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
|
||||||
#from ophyd import Component as Cpt
|
#from ophyd import Component as Cpt
|
||||||
@ -102,8 +100,6 @@ class PhoenixBL():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#class PhoenixConfigHelper(ConfigHelper):#
|
|
||||||
#
|
|
||||||
# def __init__(self):
|
|
||||||
# super.__init__(PhoenixConfigHelper)
|
|
||||||
#
|
|
||||||
|
Reference in New Issue
Block a user