@@ -605,29 +605,29 @@ def collectData(currentRequest):
605605 os .system (comm_s )
606606 logger .debug ('starting initial motions - transmission and detector distance' )
607607 daq_macros .setTrans (attenuation )
608- if not prot in ["eScan" ]:
608+ if not prot in [CollectionProtocols . E_SCAN ]:
609609 beamline_lib .mvaDescriptor ("detectorDist" ,colDist )
610610 logger .debug ('transmission and detector distance done' )
611611 # now that the detector is in the correct position, get the beam center
612612 currentRequest ['request_obj' ]['xbeam' ] = getPvDesc ('beamCenterX' )
613613 currentRequest ['request_obj' ]['ybeam' ] = getPvDesc ('beamCenterY' )
614614 db_lib .updateRequest (currentRequest )
615- if ( prot == "raster" ) :
615+ if prot == CollectionProtocols . RASTER :
616616 logger .info ('entering raster' )
617617 RE (daq_macros .snakeRaster (currentRequest ["uid" ]))
618618 status = 0
619619 logger .info ('exiting raster' )
620- elif ( prot == "stepRaster" ) :
620+ elif prot == CollectionProtocols . STEP_RASTER :
621621 status = daq_macros .snakeStepRaster (currentRequest ["uid" ])
622- elif ( prot == "vector" or prot == "stepVector" ):
622+ elif prot in ( CollectionProtocols . VECTOR , CollectionProtocols . STEP_VECTOR ):
623623 imagesAttempted = collect_detector_seq_hw (sweep_start ,range_degrees ,img_width ,exposure_period ,file_prefix ,data_directory_name ,file_number_start ,currentRequest )
624- elif ( prot == "multiCol" ) :
624+ elif prot == CollectionProtocols . MULTI_COL :
625625 RE (daq_macros .snakeRaster (currentRequest ["uid" ]))
626- elif ( prot == "rasterScreen" ) :
626+ elif prot == CollectionProtocols . RASTER_SCREEN :
627627 daq_macros .rasterScreen (currentRequest )
628- elif ( prot == "multiColQ" ) :
628+ elif prot == CollectionProtocols . MULTI_COL_Q :
629629 daq_macros .multiCol (currentRequest )
630- elif ( prot == "eScan" ) :
630+ elif prot == CollectionProtocols . E_SCAN :
631631 daq_macros .eScan (currentRequest )
632632 else : #standard, screening, or edna - these may require autoalign, checking first
633633 if (reqObj ["pos_x" ] != - 999 ):
@@ -654,7 +654,7 @@ def collectData(currentRequest):
654654 sweep_start = reqObj ["sweep_start" ]
655655 daq_macros .setTrans (attenuation )
656656
657- if (reqObj ["protocol" ] == "characterize" or reqObj [ "protocol" ] == "ednaCol" ):
657+ if (reqObj ["protocol" ] in ( CollectionProtocols . CHARACTERIZE , CollectionProtocols . EDNA_COL ):
658658 characterizationParams = reqObj ["characterizationParams" ]
659659 index_success = daq_macros .dna_execute_collection3 (0.0 ,img_width ,2 ,exposure_period ,data_directory_name + "/" ,file_prefix ,1 ,- 89.0 ,1 ,currentRequest )
660660 if (index_success ):
@@ -693,7 +693,7 @@ def collectData(currentRequest):
693693 runNum = db_lib .incrementSampleRequestCount (sampleID )
694694 newReqObj ["runNum" ] = runNum
695695 newStratRequest = db_lib .addRequesttoSample (sampleID ,newReqObj ["protocol" ],daq_utils .owner ,newReqObj ,priority = 0 ,proposalID = daq_utils .getProposalID ())
696- if (reqObj ["protocol" ] == "ednaCol" ):
696+ if (reqObj ["protocol" ] == CollectionProtocols . EDNA_COL ):
697697 logger .info ("new strat req = " )
698698 logger .info (newStratRequest )
699699 db_lib .updatePriority (currentRequest ["uid" ],- 1 )
@@ -709,7 +709,7 @@ def collectData(currentRequest):
709709 beamline_lib .mvaDescriptor ("omega" ,sweep_start )
710710 collect_detector_seq_hw (sweep_start ,range_degrees ,img_width ,exposure_period ,file_prefix ,data_directory_name ,file_number_start ,currentRequest )
711711 try :
712- if (logMe ) and prot == 'raster' :
712+ if (logMe ) and prot == CollectionProtocols . RASTER :
713713 logMxRequestParams (currentRequest ,wait = False )
714714 elif (logMe ):
715715 logMxRequestParams (currentRequest )
@@ -721,9 +721,9 @@ def collectData(currentRequest):
721721 logger .error ('caught key error in logging: %s' % e )
722722
723723 # collection finished, start processing
724- if reqObj ["protocol" ] in ("standard" , "vector" , "raster" ):
724+ if reqObj ["protocol" ] in (CollectionProtocols . STANDARD , CollectionProtocols . VECTOR , CollectionProtocols . RASTER ):
725725 send_kafka_message (topic = f'{ daq_utils .beamline } .lsdc.documents' , event = 'stop' , uuid = currentRequest ['uid' ], protocol = reqObj ["protocol" ])
726- if ( prot == "vector" or prot == "standard" or prot == "stepVector" ):
726+ if prot in ( CollectionProtocols . VECTOR , CollectionProtocols . STANDARD , CollectionProtocols . STEP_VECTOR ):
727727 if daq_utils .beamline != "nyx" :
728728 seqNum = flyer .detector .cam .sequence_id .get ()
729729 comm_s = os .environ ["LSDCHOME" ] + "/runSpotFinder4syncW.py " + data_directory_name + " " + file_prefix + " " + str (currentRequest ["uid" ]) + " " + str (seqNum ) + " " + str (currentIspybDCID )+ "&"
@@ -785,7 +785,7 @@ def collect_detector_seq_hw(sweep_start,range_degrees,image_width,exposure_perio
785785 reqObj = currentRequest ["request_obj" ]
786786 protocol = str (reqObj ["protocol" ])
787787 sweep_start = sweep_start % 360.0 if sweep_start > 0 else sweep_start % - 360
788- if ( protocol == "vector" or protocol == "stepVector" ):
788+ if protocol in ( CollectionProtocols . VECTOR , CollectionProtocols . STEP_VECTOR ):
789789 beamline_lib .mvaDescriptor ("omega" ,sweep_start )
790790 if (image_width == 0 ):
791791 number_of_images = range_degrees
@@ -807,22 +807,23 @@ def collect_detector_seq_hw(sweep_start,range_degrees,image_width,exposure_perio
807807
808808 if OPHYD_COLLECTIONS [daq_utils .beamline ]:
809809 logger .info ("ophyd collections enabled" )
810- if (protocol == "standard" ):
810+ if (protocol == CollectionProtocols . STANDARD ):
811811 RE (daq_macros .standard_plan_wrapped (currentRequest ))
812- elif (protocol == "vector" ):
812+ elif (protocol == CollectionProtocols . VECTOR ):
813813 RE (daq_macros .vector_plan_wrapped (currentRequest ))
814814 else :
815- if (protocol == "standard" or protocol == "characterize" or protocol == "ednaCol" or protocol == "burn" ):
815+ if (protocol in (CollectionProtocols .STANDARD , CollectionProtocols .CHARACTERIZE ,
816+ CollectionProtocols .EDNA_COL , CollectionProtocols .BURN ):
816817 logger .info ("vectorSync " + str (time .time ()))
817818 daq_macros .vectorSync ()
818819 logger .info ("zebraDaq " + str (time .time ()))
819820
820821 vector_params = daq_macros .gatherStandardVectorParams ()
821822 logger .debug (f"vector_params: { vector_params } " )
822823 RE (daq_macros .standard_zebra_plan (flyer ,angleStart ,number_of_images ,range_degrees ,image_width ,exposure_period ,file_prefix_minus_directory ,data_directory_name ,file_number , vector_params , file_prefix_minus_directory ))
823- elif (protocol == "vector" ):
824+ elif (protocol == CollectionProtocols . VECTOR ):
824825 RE (daq_macros .vectorZebraScan (currentRequest ))
825- elif (protocol == "stepVector" ):
826+ elif (protocol == CollectionProtocols . STEP_VECTOR ):
826827 daq_macros .vectorZebraStepScan (currentRequest )
827828 else :
828829 pass
0 commit comments