Files
phoenix_bec/phoenix_bec/scripts/phoenix.py

83 lines
2.8 KiB
Python

#from unittest import mock
import os
import sys
import time as tt
import numpy as np
#import pandas
#import pytest
#from bec_lib import messages
#import device_server
#from ophyd import Component as Cpt
from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
#from ophyd import FormattedComponent as FCpt
#from ophyd import Kind, PVPositioner, Signal
#from ophyd.flyers import FlyerInterface
#from ophyd.pv_positioner import PVPositionerComparator
#from ophyd.status import DeviceStatus, SubscriptionStatus
from bec_lib.config_helper import ConfigHelper
from bec_lib.logger import bec_logger
logger = bec_logger.logger
#import ophyd
#logger = bec_logger.logger
# load simulation
#bec.config.load_demo_config()
# .. define base path for directory with scripts
class PhoenixBL():
"""
#
# General class for PHOENIX beamline located in phoenix_bec/phoenic_bec/scripts
#
"""
def __init__(self):
"""
init PhoenixBL() in phoenix_bec/scripts
"""
import os
print('..... init PhoenixBL from phoenix_bec/scripts/phoenix.py')
# load local configuration
self.path_scripts_local = '/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/phoenix_bec/local_scripts/'
self.path_config_local = self.path_scripts_local + 'TEST_ConfigPhoenix/' # base dir for local configurations
self.path_devices_local = self.path_config_local + 'Local_device_config/' # local yamal file
self.file_devices_file_local = self.path_devices_local + 'phoenix_devices.yaml'
self.path_phoenix_bec ='/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/'
self.path_devices = self.path_phoenix_bec + 'phoenix_bec/device_configs/' # local yamal file
self.file_devices_file = self.path_phoenix_bec + 'phoenix_bec/device_configs/phoenix_devices.yaml' # local yamal file
def read_local_phoenix_config(self):
print('read file ')
print(self.file_phoenix_devices_file)
bec.config.update_session_with_file(self.file_devices_file_local)
def add_phoenix_config(self):
print('add_phoenix_config ')
print('self.file_devices_file')
bec.config.update_session_with_file(self.file_devices_file)
def add_xmap(self):
print('add xmap ')
print(self.path_devices+'phoenix_xmap.yaml')
bec.config.update_session_with_file(self.path_devices+'phoenix_xmap.yaml',timeout=100)
def add_falcon(self):
print('add_xmap')
print(self.path_devices+'/phoenix_falcon.yaml')
bec.config.wait_for_config_reply()
bec.config.update_session_with_file(self.path_devices+'/phoenix_falcon.yaml')
def show_phoenix_setup(self):
print(self.path_phoenix_bec)
os.system('cat '+self.path_phoenix_bec+'phoenix_bec/scripts/Current_setup.txt')