def pybass_init(): global message_string_pv daq_utils.init_environment() daq_lib.init_var_channels() det_lib.init_detector() daq_lib.message_string_pv = beamline_support.pvCreate( daq_utils.beamlineComm + "message_string") daq_lib.gui_popup_message_string_pv = beamline_support.pvCreate( daq_utils.beamlineComm + "gui_popup_message_string") beamline_lib.read_db() logger.info("init mots") beamline_lib.init_mots() #for now logger.info("init done mots") daq_lib.init_diffractometer() try: sitefilename = os.environ["LSDC_SITE_FILE"] except KeyError: gui_message( "\$LSDC_SITE_FILE not defined. Questionable defaults in effect.") if (sitefilename != ""): if (os.path.exists(sitefilename) == 0): error_msg = "\$LSDC_SITE_FILE: %s does not exist. Questionable defaults in effect." % sitefilename gui_message(error_msg) else: process_command_file(sitefilename)
def pybass_init(): global message_string_pv daq_utils.init_environment() init_var_channels() # init_diffractometer() det_lib.init_detector() daq_lib.message_string_pv = beamline_support.pvCreate(daq_utils.beamline + "_comm:message_string") daq_lib.gui_popup_message_string_pv = beamline_support.pvCreate( daq_utils.beamline + "_comm:gui_popup_message_string" ) if 1: # if (daq_lib.has_beamline): # for now try: read_db() print "init mots" # beamline_support.init_motors() init_mots() # for now print "init done mots" init_diffractometer() # init_counters() #for now # newfile("scandata") except CaChannelException, status: print ca.message(status) gui_message( "EPICS motor Initialization Error. Exit and try again. If problem persists, EPICS may need to be restarted." )
def pybass_init(): global message_string_pv daq_utils.init_environment() init_var_channels() # init_diffractometer() det_lib.init_detector() daq_lib.message_string_pv = beamline_support.pvCreate(daq_utils.beamlineComm + "message_string") daq_lib.gui_popup_message_string_pv = beamline_support.pvCreate(daq_utils.beamlineComm + "gui_popup_message_string") if (1): # if (daq_lib.has_beamline): # for now # try: read_db() print("init mots") # beamline_support.init_motors() init_mots() #for now print("init done mots") init_diffractometer() # init_counters() #for now # newfile("scandata") ## except CaChannelException as status: ## print(ca.message(status)) ## gui_message("EPICS motor Initialization Error. Exit and try again. If problem persists, EPICS may need to be restarted.") try: sitefilename = os.environ["CBASS_SITE_FILE"] except KeyError: gui_message("\$CBASS_SITE_FILE not defined. Questionable defaults in effect.") if (sitefilename != ""): if (os.path.exists(sitefilename) == 0): error_msg = "\$CBASS_SITE_FILE: %s does not exist. Questionable defaults in effect." % sitefilename gui_message(error_msg) else: process_command_file(sitefilename)
def init_var_channels(): global var_channel_list,beamlineStateChannel beamlineStateChannel = beamline_support.pvCreate(beamline + "_comm:beamlineState") beamline_support.pvPut(beamlineStateChannel,0) for varname in stateVars.keys(): var_channel_list[varname] = beamline_support.pvCreate(beamline + "_comm:" + varname) # beamline_support.pvPut(var_channel_list[varname],stateVars[varname]) add_callback(var_channel_list[varname],var_list_item_changeCb,varname)
def run_server(): _thread.start_new_thread(process_immediate_commands,(.25,)) comm_pv = beamline_support.pvCreate(daq_utils.beamlineComm + "command_s") beamline_support.pvPut(comm_pv,"\n") immediate_comm_pv = beamline_support.pvCreate(daq_utils.beamlineComm + "immediate_command_s") beamline_support.pvPut(immediate_comm_pv,"\n") comm_pv.add_callback(comm_cb) immediate_comm_pv.add_callback(comm2_cb) process_commands(0.5)
def run_server(): # thread.start_new_thread(print_status_thread,(.25,)) #really used to calculate percentage done of current collection thread.start_new_thread(process_commands, (0.05,)) thread.start_new_thread(process_immediate_commands, (0.25,)) comm_pv = beamline_support.pvCreate(daq_utils.beamline + "_comm:command_s") beamline_support.pvPut(comm_pv, "\n") immediate_comm_pv = beamline_support.pvCreate(daq_utils.beamline + "_comm:immediate_command_s") beamline_support.pvPut(immediate_comm_pv, "\n") beamline_support.add_callback(comm_pv, comm_cb, 0) beamline_support.add_callback(immediate_comm_pv, comm2_cb, 0)
def run_server(): # _thread.start_new_thread(process_commands,(.05,)) _thread.start_new_thread(process_immediate_commands,(.25,)) comm_pv = beamline_support.pvCreate(daq_utils.beamlineComm + "command_s") beamline_support.pvPut(comm_pv,"\n") immediate_comm_pv = beamline_support.pvCreate(daq_utils.beamlineComm + "immediate_command_s") beamline_support.pvPut(immediate_comm_pv,"\n") comm_pv.add_callback(comm_cb) immediate_comm_pv.add_callback(comm2_cb) process_commands(0.5)
def init_var_channels(): global var_channel_list for varname in list(var_list.keys()): # print(varname) var_channel_list[varname] = beamline_support.pvCreate(daq_utils.beamlineComm + varname) beamline_support.pvPut(var_channel_list[varname],var_list[varname])
def init_var_channels(): global var_channel_list for varname in list(var_list.keys()): logger.debug('initing %s' % varname) var_channel_list[varname] = beamline_support.pvCreate(daq_utils.beamlineComm + varname) if (varname != 'size_mode'): beamline_support.pvPut(var_channel_list[varname],var_list[varname])
def set_epics_pv(motcode,field_name,value): #sets a pv and makes sure motors are done moving. mcode = "%s%s.%s" % (beamline_support.beamline_designation,motcode,field_name) try: motor_val_channel = beamline_support.pvCreate(mcode) beamline_support.pvPut(motor_val_channel,value) wait_for_motors() except CaChannelException, status: print ca.message(status) print "\n\nHandled Epics Error in set pv " + mcode + "\n\n"
def init_var_channels(): global var_channel_list for varname in var_list.keys(): var_channel_list[varname] = beamline_support.pvCreate(daq_utils.beamline + "_comm:" + varname) beamline_support.pvPut(var_channel_list[varname],var_list[varname])
def lib_init_diffractometer(): global beamline,head_alldone # beamline = beamline_support.beamline_designation head_alldone = beamline_support.pvCreate(beamline_support.beamline_designation+"gonioDone") dt_gon.dt_init()