diff --git a/bernina.py b/bernina.py index 050e880..774524e 100644 --- a/bernina.py +++ b/bernina.py @@ -1,54 +1,20 @@ -from slic.utils.eco_components.config import initFromConfigList -from epics import PV -from slic.utils.eco_components import ecocnf -from slic.utils.eco_components.aliases import NamespaceCollection +import sys 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 -import sys -_namespace = globals() - -_mod = sys.modules[__name__] - _scope_name = "bernina" - +_namespace = globals() +_mod = sys.modules[__name__] 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: - 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 +ecoinit(_mod=_mod, alias_namespaces=alias_namespaces, components=components) - 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() - diff --git a/devices.py b/devices.py index 6eeff27..64989ea 100755 --- a/devices.py +++ b/devices.py @@ -23,7 +23,7 @@ _eco_lazy_init = False config = Configuration( # "/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 = [ @@ -387,33 +387,35 @@ components = [ "desc": "epics channel list", "type": "slic.utils.eco_components.config:ChannelList", # "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": [], "name": "epics_daq", "z_und": 142, "desc": "epics data acquisition", - "type": "slic.daq.epics:Epics", + "type": "slic.core.acquisition:PVAcquisition", "kwargs": { - "channel_list": Component("epics_channel_list"), - "default_file_path": f"/sf/bernina/data/{config['pgroup']}/res/epics_daq/", + "instrument": "bernina", + "pgroup": config["pgroup"], + "default_channels": Component("epics_channel_list"), + "default_dir": f"/sf/bernina/data/{config['pgroup']}/res/epics_daq/", }, }, { "args": [], "name": "daq", "desc": "server based acquisition", - "type": "slic.daq.dia_new:DIA", + "type": "slic.core.acquisition:DIAAcquisition", "kwargs": { "instrument": "bernina", - "api_address": config["daq_address"], "pgroup": config["pgroup"], - "pedestal_directory": config["jf_pedestal_directory"], - "gain_path": config["jf_gain_path"], - "config_default": config["daq_dia_config"], - "jf_channels": config["jf_channels"], - "default_file_path": None, + "api_address": config["daq_address"], +# "pedestal_directory": config["jf_pedestal_directory"], +# "gain_path": config["jf_gain_path"], +# "config_default": config["daq_dia_config"], + "default_channels": config["jf_channels"], + "default_dir": None, }, }, { @@ -424,8 +426,11 @@ components = [ ], #'SARFE10-PBPG050:HAMP-INTENSITY-CAL',[60,700],.7], "name": "checker", "desc": "checker functions for data acquisition", - "type": "slic.checkers.cachecker:CAChecker", - "kwargs": {}, + "type": "slic.core.condition:PVCondition", + "kwargs": { + "wait_time": 0.1, + "required_fraction": 0.8, + }, }, { "args": [], @@ -436,8 +441,8 @@ components = [ "data_base_dir": "scan_data", "scan_info_dir": f"/sf/bernina/data/{config['pgroup']}/res/scan_info", "default_acquisitions": [Component("daq")], - "checker": Component("checker"), - "scan_directories": True, + "condition": Component("checker"), + "make_scan_sub_dir": True, }, }, { @@ -449,8 +454,8 @@ components = [ "data_base_dir": "scan_data", "scan_info_dir": f"/sf/bernina/data/{config['pgroup']}/res/epics_daq/scan_info", "default_acquisitions": [Component("epics_daq")], - "checker": Component("checker"), - "scan_directories": True, + "condition": Component("checker"), + "make_scan_sub_dir": True, }, }, { @@ -488,7 +493,7 @@ components = [ "desc": "Bernina default channels, used in daq", "type": "slic.utils.eco_components.config:ChannelList", # "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, }, { @@ -497,7 +502,7 @@ components = [ "desc": "Bernina default bs channels, used by bs_daq", "type": "slic.utils.eco_components.config:ChannelList", # "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, }, { @@ -506,19 +511,21 @@ components = [ "desc": "", "type": "slic.utils.eco_components.config:ChannelList", # "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, }, { "args": [], "name": "bs_daq", "desc": "bs daq writer (locally!)", - "type": "slic.daq.bs:BS", + "type": "slic.core.acquisition:BSAcquisition", "kwargs": { - "default_channel_list": { + "instrument": "bernina", + "pgroup": config["pgroup"], + "default_channels": { "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, },