adjusted some overlooked import paths, moved eco init into slic.utils.eco_components
This commit is contained in:
50
bernina.py
50
bernina.py
@ -1,54 +1,20 @@
|
|||||||
from slic.utils.eco_components.config import initFromConfigList
|
import sys
|
||||||
from epics import PV
|
|
||||||
from slic.utils.eco_components import ecocnf
|
|
||||||
from slic.utils.eco_components.aliases import NamespaceCollection
|
|
||||||
import logging
|
import logging
|
||||||
|
from epics import PV
|
||||||
|
|
||||||
|
from slic.utils.eco_components.aliases import NamespaceCollection
|
||||||
|
from slic.utils.eco_components.ecoinit import ecoinit
|
||||||
|
|
||||||
from devices import components, config
|
from devices import components, config
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
_namespace = globals()
|
|
||||||
|
|
||||||
_mod = sys.modules[__name__]
|
|
||||||
|
|
||||||
_scope_name = "bernina"
|
_scope_name = "bernina"
|
||||||
|
_namespace = globals()
|
||||||
|
_mod = sys.modules[__name__]
|
||||||
alias_namespaces = NamespaceCollection()
|
alias_namespaces = NamespaceCollection()
|
||||||
|
|
||||||
def init(*args,lazy=None):
|
|
||||||
if args:
|
|
||||||
allnames = [tc['name'] for tc in components]
|
|
||||||
comp_toinit = []
|
|
||||||
for arg in args:
|
|
||||||
if not arg in allnames:
|
|
||||||
raise Exception(f'The component {arg} has no configuration defined!')
|
|
||||||
else:
|
|
||||||
comp_toinit.append(components[allnames.index(arg)])
|
|
||||||
else:
|
|
||||||
comp_toinit = components
|
|
||||||
|
|
||||||
if lazy is None:
|
ecoinit(_mod=_mod, alias_namespaces=alias_namespaces, components=components)
|
||||||
lazy=ecocnf.startup_lazy
|
|
||||||
|
|
||||||
op = {}
|
|
||||||
for key, value in initFromConfigList(comp_toinit, components, lazy=lazy).items():
|
|
||||||
# _namespace[key] = value
|
|
||||||
_mod.__dict__[key] = value
|
|
||||||
op[key]= value
|
|
||||||
|
|
||||||
|
|
||||||
if not ecocnf.startup_lazy:
|
|
||||||
try:
|
|
||||||
for ta in value.alias.get_all():
|
|
||||||
alias_namespaces.bernina.update(
|
|
||||||
ta["alias"], ta["channel"], ta["channeltype"]
|
|
||||||
)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
# alias_namespaces.bernina.store()
|
|
||||||
return op
|
|
||||||
|
|
||||||
init()
|
|
||||||
|
|
||||||
|
|
||||||
|
55
devices.py
55
devices.py
@ -23,7 +23,7 @@ _eco_lazy_init = False
|
|||||||
|
|
||||||
config = Configuration(
|
config = Configuration(
|
||||||
# "/sf/bernina/config/eco/bernina_config_slic.devices.json", name="bernina_config"
|
# "/sf/bernina/config/eco/bernina_config_slic.devices.json", name="bernina_config"
|
||||||
"./slickits/bernina/config/config.json", name="bernina_config"
|
"./bernina/config/config.json", name="bernina_config"
|
||||||
)
|
)
|
||||||
|
|
||||||
components = [
|
components = [
|
||||||
@ -387,33 +387,35 @@ components = [
|
|||||||
"desc": "epics channel list",
|
"desc": "epics channel list",
|
||||||
"type": "slic.utils.eco_components.config:ChannelList",
|
"type": "slic.utils.eco_components.config:ChannelList",
|
||||||
# "kwargs": {"file_name":"/sf/bernina/config/channel_lists/default_channel_list_epics"},
|
# "kwargs": {"file_name":"/sf/bernina/config/channel_lists/default_channel_list_epics"},
|
||||||
"kwargs": {"file_name":"./slickits/bernina/config/channel_list"},
|
"kwargs": {"file_name":"./bernina/config/channel_list"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"args": [],
|
"args": [],
|
||||||
"name": "epics_daq",
|
"name": "epics_daq",
|
||||||
"z_und": 142,
|
"z_und": 142,
|
||||||
"desc": "epics data acquisition",
|
"desc": "epics data acquisition",
|
||||||
"type": "slic.daq.epics:Epics",
|
"type": "slic.core.acquisition:PVAcquisition",
|
||||||
"kwargs": {
|
"kwargs": {
|
||||||
"channel_list": Component("epics_channel_list"),
|
"instrument": "bernina",
|
||||||
"default_file_path": f"/sf/bernina/data/{config['pgroup']}/res/epics_daq/",
|
"pgroup": config["pgroup"],
|
||||||
|
"default_channels": Component("epics_channel_list"),
|
||||||
|
"default_dir": f"/sf/bernina/data/{config['pgroup']}/res/epics_daq/",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"args": [],
|
"args": [],
|
||||||
"name": "daq",
|
"name": "daq",
|
||||||
"desc": "server based acquisition",
|
"desc": "server based acquisition",
|
||||||
"type": "slic.daq.dia_new:DIA",
|
"type": "slic.core.acquisition:DIAAcquisition",
|
||||||
"kwargs": {
|
"kwargs": {
|
||||||
"instrument": "bernina",
|
"instrument": "bernina",
|
||||||
"api_address": config["daq_address"],
|
|
||||||
"pgroup": config["pgroup"],
|
"pgroup": config["pgroup"],
|
||||||
"pedestal_directory": config["jf_pedestal_directory"],
|
"api_address": config["daq_address"],
|
||||||
"gain_path": config["jf_gain_path"],
|
# "pedestal_directory": config["jf_pedestal_directory"],
|
||||||
"config_default": config["daq_dia_config"],
|
# "gain_path": config["jf_gain_path"],
|
||||||
"jf_channels": config["jf_channels"],
|
# "config_default": config["daq_dia_config"],
|
||||||
"default_file_path": None,
|
"default_channels": config["jf_channels"],
|
||||||
|
"default_dir": None,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -424,8 +426,11 @@ components = [
|
|||||||
], #'SARFE10-PBPG050:HAMP-INTENSITY-CAL',[60,700],.7],
|
], #'SARFE10-PBPG050:HAMP-INTENSITY-CAL',[60,700],.7],
|
||||||
"name": "checker",
|
"name": "checker",
|
||||||
"desc": "checker functions for data acquisition",
|
"desc": "checker functions for data acquisition",
|
||||||
"type": "slic.checkers.cachecker:CAChecker",
|
"type": "slic.core.condition:PVCondition",
|
||||||
"kwargs": {},
|
"kwargs": {
|
||||||
|
"wait_time": 0.1,
|
||||||
|
"required_fraction": 0.8,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"args": [],
|
"args": [],
|
||||||
@ -436,8 +441,8 @@ components = [
|
|||||||
"data_base_dir": "scan_data",
|
"data_base_dir": "scan_data",
|
||||||
"scan_info_dir": f"/sf/bernina/data/{config['pgroup']}/res/scan_info",
|
"scan_info_dir": f"/sf/bernina/data/{config['pgroup']}/res/scan_info",
|
||||||
"default_acquisitions": [Component("daq")],
|
"default_acquisitions": [Component("daq")],
|
||||||
"checker": Component("checker"),
|
"condition": Component("checker"),
|
||||||
"scan_directories": True,
|
"make_scan_sub_dir": True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -449,8 +454,8 @@ components = [
|
|||||||
"data_base_dir": "scan_data",
|
"data_base_dir": "scan_data",
|
||||||
"scan_info_dir": f"/sf/bernina/data/{config['pgroup']}/res/epics_daq/scan_info",
|
"scan_info_dir": f"/sf/bernina/data/{config['pgroup']}/res/epics_daq/scan_info",
|
||||||
"default_acquisitions": [Component("epics_daq")],
|
"default_acquisitions": [Component("epics_daq")],
|
||||||
"checker": Component("checker"),
|
"condition": Component("checker"),
|
||||||
"scan_directories": True,
|
"make_scan_sub_dir": True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -488,7 +493,7 @@ components = [
|
|||||||
"desc": "Bernina default channels, used in daq",
|
"desc": "Bernina default channels, used in daq",
|
||||||
"type": "slic.utils.eco_components.config:ChannelList",
|
"type": "slic.utils.eco_components.config:ChannelList",
|
||||||
# "kwargs": {"file_name":"/sf/bernina/config/channel_lists/default_channel_list"},
|
# "kwargs": {"file_name":"/sf/bernina/config/channel_lists/default_channel_list"},
|
||||||
"kwargs": {"file_name":"./slickits/bernina/config/channel_list"},
|
"kwargs": {"file_name":"./bernina/config/channel_list"},
|
||||||
"lazy": False,
|
"lazy": False,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -497,7 +502,7 @@ components = [
|
|||||||
"desc": "Bernina default bs channels, used by bs_daq",
|
"desc": "Bernina default bs channels, used by bs_daq",
|
||||||
"type": "slic.utils.eco_components.config:ChannelList",
|
"type": "slic.utils.eco_components.config:ChannelList",
|
||||||
# "kwargs": {"file_name":"/sf/bernina/config/channel_lists/default_channel_list_bs"},
|
# "kwargs": {"file_name":"/sf/bernina/config/channel_lists/default_channel_list_bs"},
|
||||||
"kwargs": {"file_name":"./slickits/bernina/config/channel_list"},
|
"kwargs": {"file_name":"./bernina/config/channel_list"},
|
||||||
"lazy": False,
|
"lazy": False,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -506,19 +511,21 @@ components = [
|
|||||||
"desc": "",
|
"desc": "",
|
||||||
"type": "slic.utils.eco_components.config:ChannelList",
|
"type": "slic.utils.eco_components.config:ChannelList",
|
||||||
# "kwargs": {"file_name":"/sf/bernina/config/channel_lists/channel_list_PSSS_projection"},
|
# "kwargs": {"file_name":"/sf/bernina/config/channel_lists/channel_list_PSSS_projection"},
|
||||||
"kwargs": {"file_name":"./slickits/bernina/config/channel_list"},
|
"kwargs": {"file_name":"./bernina/config/channel_list"},
|
||||||
"lazy": False,
|
"lazy": False,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"args": [],
|
"args": [],
|
||||||
"name": "bs_daq",
|
"name": "bs_daq",
|
||||||
"desc": "bs daq writer (locally!)",
|
"desc": "bs daq writer (locally!)",
|
||||||
"type": "slic.daq.bs:BS",
|
"type": "slic.core.acquisition:BSAcquisition",
|
||||||
"kwargs": {
|
"kwargs": {
|
||||||
"default_channel_list": {
|
"instrument": "bernina",
|
||||||
|
"pgroup": config["pgroup"],
|
||||||
|
"default_channels": {
|
||||||
"bernina_default_channels_bs": Component("default_channel_list_bs")
|
"bernina_default_channels_bs": Component("default_channel_list_bs")
|
||||||
},
|
},
|
||||||
"default_file_path": f"/sf/bernina/data/{config['pgroup']}/res/%s",
|
"default_dir": f"/sf/bernina/data/{config['pgroup']}/res/%s",
|
||||||
},
|
},
|
||||||
"lazy": False,
|
"lazy": False,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user