Skip to content

Commit

Permalink
Merge pull request #355 from vshekar/optimized-autoraster
Browse files Browse the repository at this point in the history
Optimized autoraster
  • Loading branch information
vshekar authored Apr 29, 2024
2 parents eaaa2f3 + 62d2649 commit 0754ebf
Show file tree
Hide file tree
Showing 17 changed files with 2,231 additions and 127 deletions.
8 changes: 8 additions & 0 deletions config_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# GUI default configuration
BEAM_CHECK = "beamCheck"
UNMOUNT_COLD_CHECK = "unmountColdCheck"
ON_MOUNT_OPTION = "onMountOption"
SET_ENERGY_CHECK = "setEnergyCheck"


Expand All @@ -54,6 +55,13 @@ class RasterStatus(Enum):
READY_FOR_SNAPSHOT = 3
READY_FOR_REPROCESS = 4

class OnMountAvailOptions(Enum):
"""
This enumerates the options available to the user on mounting a sample
"""
DO_NOTHING = 0 # Only mounts sample
CENTER_SAMPLE = 1 # Mounts and centers sample
AUTO_RASTER = 2 # Mounts, centers and takes 2 orthogonal rasters

HUTCH_TIMER_DELAY = 500
SAMPLE_TIMER_DELAY = 0
Expand Down
17 changes: 10 additions & 7 deletions daq_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,6 @@ def getRobotConfig():
return getPvDesc("robotGovConfig",as_string=True)


def setRobotGovState(stateString):
if (getRobotConfig() == "Robot"):
setPvDesc("robotGovGo",stateString)
else:
setPvDesc("humanGovGo",stateString)

def mountSample(sampID):
global mountCounter

Expand Down Expand Up @@ -284,6 +278,10 @@ def mountSample(sampID):
if (detDist != saveDetDist):
if (getBlConfig("HePath") == 0):
beamline_lib.mvaDescriptor("detectorDist",saveDetDist)
if getBlConfig('robot_online') and getBlConfig("queueCollect") == 0:
# Only run mount options when the robot is online and queue collect is off
daq_macros.run_on_mount_option(sampID)
gov_status = gov_lib.setGovRobot(gov_robot, 'SA')
elif(mountStat == 2):
return 2
else:
Expand All @@ -297,6 +295,10 @@ def mountSample(sampID):
mountStat = robot_lib.mountRobotSample(gov_robot, puckPos,pinPos,sampID,init=1)
if (mountStat == 1):
set_field("mounted_pin",sampID)
if getBlConfig('robot_online') and getBlConfig("queueCollect") == 0:
# Only run mount options when the robot is online and queue collect is off
daq_macros.run_on_mount_option(sampID)
gov_status = gov_lib.setGovRobot(gov_robot, 'SA')
elif(mountStat == 2):
return 2
else:
Expand Down Expand Up @@ -536,6 +538,7 @@ def collectData(currentRequest):
check_pause()
else:
logger.info("autoRaster")
daq_macros.run_loop_center_plan()
if not (daq_macros.autoRasterLoop(currentRequest)):
logger.info("could not center sample")
db_lib.updatePriority(currentRequest["uid"],-1)
Expand Down Expand Up @@ -680,7 +683,7 @@ def collect_detector_seq_hw(sweep_start,range_degrees,image_width,exposure_perio
logger.info("data directory = " + data_directory_name)
reqObj = currentRequest["request_obj"]
protocol = str(reqObj["protocol"])
sweep_start = sweep_start%360.0
sweep_start = sweep_start % 360.0 if sweep_start > 0 else sweep_start % -360
if (protocol == "vector" or protocol == "stepVector"):
beamline_lib.mvaDescriptor("omega",sweep_start)
if (image_width == 0):
Expand Down
Loading

0 comments on commit 0754ebf

Please sign in to comment.