def logMxRequestParams(currentRequest): global currentIspybDCID reqObj = currentRequest["request_obj"] transmissionReadback = beamline_support.getPvValFromDescriptor("transmissionRBV") flux = beamline_support.getPvValFromDescriptor("flux") resultObj = {"requestObj":reqObj,"transmissionReadback":transmissionReadback,"flux":flux} resultID = db_lib.addResultforRequest("mxExpParams",currentRequest["uid"],owner=daq_utils.owner,result_obj=resultObj,proposalID=daq_utils.getProposalID(),beamline=daq_utils.beamline) newResult = db_lib.getResult(resultID) db_lib.beamlineInfo(daq_utils.beamline, 'currentSampleID', info_dict={'sampleID':currentRequest["sample"]}) db_lib.beamlineInfo(daq_utils.beamline, 'currentRequestID', info_dict={'requestID':currentRequest["uid"]}) logfile = open("dataColLog.txt","a+") try: logfile.write("\n\ntimestamp: " + time.ctime(currentRequest["time"])+"\n") except KeyError: print("caught key error in logging") print(currentRequest) logfile.write("protocol: " + reqObj["protocol"] +"\n") logfile.write("data prefix: " + reqObj["file_prefix"] +"\n") logfile.write("flux: " + str(flux) +"\n") logfile.write("transimission percent: " + str(transmissionReadback) +"\n") logfile.write("total current (BCU): " + str(beamline_support.getPvValFromDescriptor("totalCurrentBCU")) +"\n") logfile.write("omega start: " + str(reqObj["sweep_start"]) +"\n") logfile.write("omega end: " + str(reqObj["sweep_end"]) +"\n") logfile.write("image width: " + str(reqObj["img_width"]) +"\n") logfile.write("exposure time per image (s): " + str(reqObj["exposure_time"]) +"\n") logfile.write("detector distance: " + str(reqObj["detDist"]) +"\n") logfile.write("wavelength: " + str(reqObj["wavelength"]) +"\n") logfile.close() visitName = daq_utils.getVisitName() try: #I'm worried about unforseen ispyb db errors currentIspybDCID = ispybLib.insertResult(newResult,"mxExpParams",currentRequest,visitName) except: currentIspybDCID = 999999 print("ispyb error")
def unmountSample(): global mountCounter logger.info("unmountSample") mountCounter = 0 mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (currentMountedSampleID != ""): puckPos = mountedSampleDict["puckPos"] pinPos = mountedSampleDict["pinPos"] if (robot_lib.unmountRobotSample(puckPos, pinPos, currentMountedSampleID)): db_lib.deleteCompletedRequestsforSample(currentMountedSampleID) robot_lib.finish() set_field("mounted_pin", "") db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={ 'puckPos': 0, 'pinPos': 0, 'sampleID': "" }) return 1 else: return 0
def mountSample(sampID): global mountCounter saveDetDist = beamline_lib.motorPosFromDescriptor("detectorDist") warmUpNeeded = 0 if (getBlConfig("queueCollect") == 1): mountCounter+=1 if (mountCounter > getBlConfig("robotWarmupInterval")): warmUpNeeded = 1 mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (getBlConfig(TOP_VIEW_CHECK) == 1): logger.info("setting work pos") if (daq_utils.beamline == "amx"): setPvDesc("robotXWorkPos",getPvDesc("robotXMountPos")) setPvDesc("robotYWorkPos",getPvDesc("robotYMountPos")) setPvDesc("robotZWorkPos",getPvDesc("robotZMountPos")) setPvDesc("robotOmegaWorkPos",90.0) logger.info("done setting work pos") if (currentMountedSampleID != ""): #then unmount what's there if (sampID!=currentMountedSampleID): puckPos = mountedSampleDict["puckPos"] pinPos = mountedSampleDict["pinPos"] if (robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID)): db_lib.deleteCompletedRequestsforSample(currentMountedSampleID) set_field("mounted_pin","") db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':""}) (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(daq_utils.beamline,sampID) if (warmUpNeeded): gui_message("Warming gripper. Please stand by.") mountCounter = 0 mountStat = robot_lib.mountRobotSample(puckPos,pinPos,sampID,init=0,warmup=warmUpNeeded) if (warmUpNeeded): destroy_gui_message() if (mountStat == 1): set_field("mounted_pin",sampID) detDist = beamline_lib.motorPosFromDescriptor("detectorDist") if (detDist != saveDetDist): if (getBlConfig("HePath") == 0): beamline_lib.mvaDescriptor("detectorDist",saveDetDist) elif(mountStat == 2): return 2 else: return 0 else: return 0 else: #desired sample is mounted, nothing to do return 1 else: #nothing mounted (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(daq_utils.beamline,sampID) mountStat = robot_lib.mountRobotSample(puckPos,pinPos,sampID,init=1) if (mountStat == 1): set_field("mounted_pin",sampID) elif(mountStat == 2): return 2 else: return 0 db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':puckPos,'pinPos':pinPos,'sampleID':sampID}) return 1
def unmountSample(): mountedSampleDict = db_lib.beamlineInfo('john', 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] puckPos = mountedSampleDict["puckPos"] pinPos = mountedSampleDict["pinPos"] robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID) set_field("mounted_pin",-99) db_lib.beamlineInfo('john', 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':-99})
def clearMountedSample(): set_field("mounted_pin", "") db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={ 'puckPos': 0, 'pinPos': 0, 'sampleID': "" })
def logMxRequestParams(currentRequest, wait=True): global currentIspybDCID reqObj = currentRequest["request_obj"] transmissionReadback = getPvDesc("transmissionRBV") flux = getPvDesc("flux") resultObj = { "requestObj": reqObj, "transmissionReadback": transmissionReadback, "flux": flux } resultID = db_lib.addResultforRequest("mxExpParams", currentRequest["uid"], owner=daq_utils.owner, result_obj=resultObj, proposalID=daq_utils.getProposalID(), beamline=daq_utils.beamline) newResult = db_lib.getResult(resultID) newResult['result_obj']['requestObj']['xbeam'] = reqObj['xbeam'] newResult['result_obj']['requestObj']['ybeam'] = reqObj['ybeam'] db_lib.beamlineInfo(daq_utils.beamline, 'currentSampleID', info_dict={'sampleID': currentRequest["sample"]}) db_lib.beamlineInfo(daq_utils.beamline, 'currentRequestID', info_dict={'requestID': currentRequest["uid"]}) logfile = open("dataColLog.txt", "a+") try: logfile.write("\n\ntimestamp: " + time.ctime(currentRequest["time"]) + "\n") except KeyError: logger.error("caught key error in logging") logger.error(currentRequest) logfile.write("protocol: " + reqObj["protocol"] + "\n") logfile.write("data prefix: " + reqObj["file_prefix"] + "\n") logfile.write("flux: " + str(flux) + "\n") logfile.write("transimission percent: " + str(transmissionReadback) + "\n") logfile.write("total current (BCU): " + str(getPvDesc("totalCurrentBCU")) + "\n") logfile.write("omega start: " + str(reqObj["sweep_start"]) + "\n") logfile.write("omega end: " + str(reqObj["sweep_end"]) + "\n") logfile.write("image width: " + str(reqObj["img_width"]) + "\n") logfile.write("exposure time per image (s): " + str(reqObj["exposure_time"]) + "\n") logfile.write("detector distance: " + str(reqObj["detDist"]) + "\n") logfile.write("wavelength: " + str(reqObj["wavelength"]) + "\n") logfile.close() visitName = daq_utils.getVisitName() try: #I'm worried about unforseen ispyb db errors #rasters results are entered in ispyb by the GUI, no need to wait if wait: time.sleep(getBlConfig(ISPYB_RESULT_ENTRY_DELAY)) currentIspybDCID = ispybLib.insertResult(newResult, "mxExpParams", currentRequest, visitName) except Exception as e: currentIspybDCID = 999999 logger.error("logMxRequestParams - ispyb error: %s" % e)
def unmountCold(): mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (currentMountedSampleID != ""): puckPos = mountedSampleDict["puckPos"] pinPos = mountedSampleDict["pinPos"] if (robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID)): db_lib.deleteCompletedRequestsforSample(currentMountedSampleID) robot_lib.parkGripper() set_field("mounted_pin","") db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':""}) setPvDesc("robotGovActive",1) return 1 else: return 0
def unmountCold(): mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (currentMountedSampleID != ""): puckPos = mountedSampleDict["puckPos"] pinPos = mountedSampleDict["pinPos"] if (robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID)): db_lib.deleteCompletedRequestsforSample(currentMountedSampleID) # robot_lib.finish() robot_lib.parkGripper() set_field("mounted_pin","") db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':""}) beamline_support.setPvValFromDescriptor("robotGovActive",1) return 1 else: return 0
def unmountSample(): global mountCounter mountCounter = 0 mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (currentMountedSampleID != ""): puckPos = mountedSampleDict["puckPos"] pinPos = mountedSampleDict["pinPos"] if (robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID)): db_lib.deleteCompletedRequestsforSample(currentMountedSampleID) robot_lib.finish() set_field("mounted_pin","") db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':""}) return 1 else: return 0
def mountSample(sampID): global mountCounter warmUpNeeded = 0 if (db_lib.getBeamlineConfigParam(daq_utils.beamline,"queueCollect") == 1): mountCounter+=1 if (mountCounter > db_lib.getBeamlineConfigParam(daq_utils.beamline,"robotWarmupInterval")): warmUpNeeded = 1 mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (currentMountedSampleID != ""): #then unmount what's there if (sampID!=currentMountedSampleID): puckPos = mountedSampleDict["puckPos"] pinPos = mountedSampleDict["pinPos"] if (robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID)): db_lib.deleteCompletedRequestsforSample(currentMountedSampleID) set_field("mounted_pin","") db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':""}) (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(daq_utils.beamline,sampID) if (warmUpNeeded): gui_message("Warming gripper. Please stand by.") mountCounter = 0 mountStat = robot_lib.mountRobotSample(puckPos,pinPos,sampID,init=0,warmup=warmUpNeeded) if (warmUpNeeded): destroy_gui_message() if (mountStat == 1): set_field("mounted_pin",sampID) elif(mountStat == 2): return 2 else: return 0 else: return 0 else: #desired sample is mounted, nothing to do return 1 else: #nothing mounted (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(daq_utils.beamline,sampID) mountStat = robot_lib.mountRobotSample(puckPos,pinPos,sampID,init=1) if (mountStat == 1): set_field("mounted_pin",sampID) elif(mountStat == 2): return 2 else: return 0 db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':puckPos,'pinPos':pinPos,'sampleID':sampID}) return 1
def runDials(imgPath,reqID=None): comm_s = "dials.find_spots_client " + imgPath print comm_s dialsResultObj = xmltodict.parse("<data>\n"+os.popen(comm_s).read()+"</data>\n") print "done parsing dials output" print dialsResultObj currentRequestID = db_lib.beamlineInfo(beamline, 'currentRequestID')["requestID"] dialsResult = db_lib.addResultforRequest("dials",currentRequestID, dialsResultObj)
def mountSample(sampID): mountedSampleDict = db_lib.beamlineInfo('john', 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (currentMountedSampleID != 99): #then unmount what's there if (sampID!=currentMountedSampleID): puckPos = mountedSampleDict["puckPos"] pinPos = mountedSampleDict["pinPos"] robot_lib.unmountRobotSample(puckPos,pinPos,currentMountedSampleID) set_field("mounted_pin",sampID) (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(sampID) robot_lib.mountRobotSample(puckPos,pinPos,sampID) else: #desired sample is mounted, nothing to do return 1 else: #nothing mounted (puckPos,pinPos,puckID) = db_lib.getCoordsfromSampleID(sampID) robot_lib.mountRobotSample(puckPos,pinPos,sampID) db_lib.beamlineInfo('john', 'mountedSample', info_dict={'puckPos':puckPos,'pinPos':pinPos,'sampleID':sampID})
def runDCQueue(): #maybe don't run rasters from here??? global abort_flag autoMounted = 0 #this means the mount was performed from a runQueue, as opposed to a manual mount button push logger.info("running queue in daq server") while (1): if (getBlConfig("queueCollect") == 1 and getBlConfig("beamCheck") == 1): waitBeam() if (abort_flag): abort_flag = 0 #careful about when to reset this return currentRequest = db_lib.popNextRequest(daq_utils.beamline) if (currentRequest == {}): break logger.info("processing request " + str(time.time())) reqObj = currentRequest["request_obj"] setPvDesc("govRobotDetDist", reqObj["detDist"]) setPvDesc("govHumanDetDist", reqObj["detDist"]) if (reqObj["detDist"] >= ROBOT_MIN_DISTANCE and getBlConfig("HePath") == 0): setPvDesc("govRobotDetDistOut", reqObj["detDist"]) setPvDesc("govHumanDetDistOut", reqObj["detDist"]) sampleID = currentRequest["sample"] mountedSampleDict = db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample') currentMountedSampleID = mountedSampleDict["sampleID"] if (currentMountedSampleID != sampleID): if (getBlConfig("queueCollect") == 0): gui_message( "You can only run requests on the currently mounted sample. Remove offending request and continue." ) return mountStat = mountSample(sampleID) logger.info("automounting mp= " + currentMountedSampleID + " samp= " + str(sampleID)) if (mountStat == 1): autoMounted = 1 elif (mountStat == 2): db_lib.updatePriority(currentRequest["uid"], -1) refreshGuiTree() continue else: return 0 db_lib.updatePriority(currentRequest["uid"], 99999) currentRequest[ 'priority'] = 99999 #TODO have updatePriority return an updated request? refreshGuiTree( ) #just tells the GUI to repopulate the tree from the DB logger.info("calling collect data " + str(time.time())) colStatus = collectData(currentRequest) logger.info("done collecting data") if (autoMounted and db_lib.queueDone(daq_utils.beamline)): unmountSample()
def gotoMaxRaster(rasterResult,multiColThreshold=-1): if (rasterResult["result_obj"]["rasterCellResults"]['resultObj'] == None): # if (rasterResult["result_obj"]["rasterCellResults"]['resultObj']["data"] == None): print("no raster result!!\n") return ceiling = 0.0 floor = 100000000.0 #for resolution where small number means high score hotFile = "" scoreOption = "" print("in gotomax") # print(rasterResult) cellResults = rasterResult["result_obj"]["rasterCellResults"]['resultObj'] # cellResults = rasterResult["result_obj"]["rasterCellResults"]['resultObj']["data"]["response"] rasterMap = rasterResult["result_obj"]["rasterCellMap"] rasterScoreFlag = int(db_lib.beamlineInfo('john','rasterScoreFlag')["index"]) if (rasterScoreFlag==0): scoreOption = "spot_count" elif (rasterScoreFlag==1): scoreOption = "d_min" else: scoreOption = "total_intensity" for i in range (0,len(cellResults)): scoreVal = float(cellResults[i][scoreOption]) if (multiColThreshold>0): if (scoreVal > multiColThreshold): hitFile = cellResults[i]["image"] hitCoords = rasterMap[hitFile[:-4]] # sampID = rasterResult['result_obj']['sample_id'] parentReqID = rasterResult['result_obj']["parentReqID"] addMultiRequestLocation(parentReqID,hitCoords,i) if (scoreOption == "d_min"): if (scoreVal < floor): floor = scoreVal hotFile = cellResults[i]["image"] else: if (scoreVal > ceiling): ceiling = scoreVal hotFile = cellResults[i]["image"] if (hotFile != ""): print(ceiling) print(floor) print(hotFile) # rasterMap = rasterResult["result_obj"]["rasterCellMap"] hotCoords = rasterMap[hotFile[:-4]] x = hotCoords["x"] y = hotCoords["y"] z = hotCoords["z"] print("goto " + str(x) + " " + str(y) + " " + str(z)) mvaDescriptor("sampleX",x,"sampleY",y,"sampleZ",z)
def display_images(): currentRequestID = db_lib.beamlineInfo('john', 'currentRequestID')["requestID"] print "display images for req " + str(currentRequestID) data_directory_name = getDetPv("data_filepath_rbv") numimages = getDetPv("numimages") prefix = getDetPv("data_filename_rbv") image_period = getDetPv("image_period") numstart = getDetPv("file_number_rbv") numstart = numstart - 1 if (numimages>10 and image_period<10): sample = 10 else: sample = 1 filelist = [] for i in range (numstart,numstart+numimages,sample): filename = "%s/%s_%05d.cbf" % (data_directory_name,prefix,i) filelist.append(filename) filename = "%s/%s_%05d.cbf" % (data_directory_name,prefix,numimages+numstart-1) # last image if (len(filelist) > 0): if (filename != filelist[len(filelist)-1]): filelist.append(filename) for j in range (0,len(filelist)): filename = filelist[j] last_dot = string.rfind(filename,".") i = int(filename[last_dot-5:last_dot]) print "looking for " + filename while not (os.path.exists(filename)): os.system("ls " + data_directory_name + " >/dev/null") time.sleep(0.03) if (jpeg_needed == -99): return # time.sleep(0.1) print "found for " + filename time.sleep(.05) #got a corrupted file error in albula w/0 this, might not happen in real collection ## daq_utils.albulaDisp(filename) #why have the logger kicking off albula? Because that's what it does for now, don't bother with eiger, use monitor daq_utils.diff2jpeg(filename,JPEGfilename=None,reqID=currentRequestID) ##huh? I think the filelist takes care of this if (j%10 == 0): now = time.time() print "take xtal picture" daq_utils.runDials(filename) daq_utils.take_crystal_picture(filename=None,czoom=0,reqID=currentRequestID,omega=beamline_lib.motorPosFromDescriptor("omega")) #but this is unlikely to be synchronized with diff image
def gotoMaxRaster(rasterResult): ceiling = 0.0 floor = 100000000.0 # for resolution where small number means high score hotFile = "" scoreOption = "" print "in gotomax" print rasterResult cellResults = rasterResult["result_obj"]["rasterCellResults"]["resultObj"]["data"]["response"] rasterScoreFlag = int(db_lib.beamlineInfo("john", "rasterScoreFlag")["index"]) if rasterScoreFlag == 0: scoreOption = "spot_count" elif rasterScoreFlag == 1: scoreOption = "d_min" else: scoreOption = "total_intensity" for i in range(0, len(cellResults)): scoreVal = float(cellResults[i][scoreOption]) if scoreOption == "d_min": if scoreVal < floor: floor = scoreVal hotFile = cellResults[i]["image"] else: if scoreVal > ceiling: ceiling = scoreVal hotFile = cellResults[i]["image"] if hotFile != "": print ceiling print floor print hotFile rasterMap = rasterResult["result_obj"]["rasterCellMap"] hotCoords = rasterMap[hotFile[:-4]] x = hotCoords["x"] y = hotCoords["y"] z = hotCoords["z"] print "goto " + str(x) + " " + str(y) + " " + str(z) mva("X", x, "Y", y, "Z", z)
import beamline_lib import beamline_support from beamline_support import getPvValFromDescriptor as getPvDesc, setPvValFromDescriptor as setPvDesc import db_lib from daq_utils import getBlConfig from config_params import * import logging logger = logging.getLogger(__name__) try: import ispybLib except Exception as e: logger.error("daq_lib: ISPYB import error, %s" % e) #all keys below are created as beamlineComm PVs. if adding items here, be sure to add them to the simulator var_list = {'beam_check_flag':0,'overwrite_check_flag':1,'omega':0.00,'kappa':0.00,'phi':0.00,'theta':0.00,'distance':10.00,'rot_dist0':300.0,'inc0':1.00,'exptime0':5.00,'file_prefix0':'lowercase','numstart0':0,'col_start0':0.00,'col_end0':1.00,'scan_axis':'omega','wavelength0':1.1,'datum_omega':0.00,'datum_kappa':0.00,'datum_phi':0.00,'size_mode':0,'spcgrp':1,'state':"Idle",'state_percent':0,'datafilename':'none','active_sweep':-1,'html_logging':1,'take_xtal_pics':0,'px_id':'none','xtal_id':'none','current_pinpos':0,'sweep_count':0,'group_name':'none','mono_energy_target':1.1,'mono_wave_target':1.1,'energy_inflection':12398.5,'energy_peak':12398.5,'wave_inflection':1.0,'wave_peak':1.0,'energy_fall':12398.5,'wave_fall':1.0,'beamline_merit':0,'fprime_peak':0.0,'f2prime_peak':0.0,'fprime_infl':0.0,'f2prime_infl':0.0,'program_state':"Program Ready",'filter':0,'edna_aimed_completeness':0.99,'edna_aimed_ISig':2.0,'edna_aimed_multiplicity':'auto','edna_aimed_resolution':'auto','mono_energy_current':1.1,'mono_energy_scan_step':1,'mono_wave_current':1.1,'mono_scan_points':21,'mounted_pin':(db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample')["sampleID"]),'pause_button_state':'Pause','vector_on':0,'vector_fpp':1,'vector_step':0.0,'vector_translation':0.0,'xia2_on':0,'grid_exptime':0.2,'grid_imwidth':0.2,'choochResultFlag':"0",'xrecRasterFlag':"0"} global x_vec_start, y_vec_start, z_vec_start, x_vec_end, y_vec_end, z_vec_end, x_vec, y_vec, z_vec global var_channel_list global message_string_pv global gui_popup_message_string_pv global data_directory_name global currentIspybDCID global fastDPNodeCount fastDPNodeCount = 4 global fastDPNodeCounter fastDPNodeCounter = 0
def clearMountedSample(): set_field("mounted_pin","") db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample', info_dict={'puckPos':0,'pinPos':0,'sampleID':""})
0.99, 'edna_aimed_ISig': 2.0, 'edna_aimed_multiplicity': 'auto', 'edna_aimed_resolution': 'auto', 'mono_energy_current': 1.1, 'mono_energy_scan_step': 1, 'mono_wave_current': 1.1, 'mono_scan_points': 21, 'mounted_pin': (db_lib.beamlineInfo(daq_utils.beamline, 'mountedSample')["sampleID"]), 'pause_button_state': 'Pause', 'vector_on': 0, 'vector_fpp': 1, 'vector_step': 0.0, 'vector_translation': 0.0, 'xia2_on': 0, 'grid_exptime': 0.2, 'grid_imwidth':
def logMxRequestParams(currentRequest): resultObj = {"requestObj":currentRequest["request_obj"]} db_lib.addResultforRequest("mxExpParams",currentRequest["request_id"],resultObj) db_lib.beamlineInfo('john', 'currentSampleID', info_dict={'sampleID':currentRequest["sample_id"]}) db_lib.beamlineInfo('john', 'currentRequestID', info_dict={'requestID':currentRequest["request_id"]})
import time import string import math import daq_macros from math import * from string import * from gon_lib import * from det_lib import * import robot_lib import daq_utils import beamline_lib import beamline_support import db_lib var_list = {'beam_check_flag':0,'overwrite_check_flag':1,'omega':0.00,'kappa':0.00,'phi':0.00,'theta':0.00,'distance':10.00,'rot_dist0':300.0,'inc0':1.00,'exptime0':5.00,'file_prefix0':'lowercase','numstart0':0,'col_start0':0.00,'col_end0':1.00,'scan_axis':'omega','wavelength0':1.1,'datum_omega':0.00,'datum_kappa':0.00,'datum_phi':0.00,'xbeam':157.00,'ybeam':157.00,'size_mode':0,'spcgrp':1,'state':"Idle",'state_percent':0,'datafilename':'none','active_sweep':-1,'html_logging':1,'take_xtal_pics':0,'px_id':'none','xtal_id':'none','current_pinpos':0,'sweep_count':0,'group_name':'none','mono_energy_target':1.1,'mono_wave_target':1.1,'energy_inflection':12398.5,'energy_peak':12398.5,'wave_inflection':1.0,'wave_peak':1.0,'energy_fall':12398.5,'wave_fall':1.0,'beamline_merit':0,'fprime_peak':0.0,'f2prime_peak':0.0,'fprime_infl':0.0,'f2prime_infl':0.0,'program_state':"Program Ready",'filter':0,'edna_aimed_completeness':0.99,'edna_aimed_ISig':2.0,'edna_aimed_multiplicity':'auto','edna_aimed_resolution':'auto','mono_energy_current':1.1,'mono_energy_scan_step':1,'mono_wave_current':1.1,'mono_scan_points':21,'mounted_pin':int(db_lib.beamlineInfo('john', 'mountedSample')["sampleID"]),'pause_button_state':'Pause','grid_w':210,'grid_h':150,'grid_i':10,'grid_on':0,'vector_on':0,'vector_fpp':1,'vector_step':0.0,'vector_translation':0.0,'xia2_on':0,'grid_exptime':0.2,'grid_imwidth':0.2,'choochResultFlag':0,'xrecRasterFlag':0} global x_vec_start, y_vec_start, z_vec_start, x_vec_end, y_vec_end, z_vec_end, x_vec, y_vec, z_vec global var_channel_list global message_string_pv global data_directory_name var_channel_list = {} global abort_flag abort_flag = 0 def init_var_channels(): global var_channel_list