###################################################################
########################### Run DAQ ############################### 
###################################################################

aMover=XYMover(8820) # 8820 = motor_0 = bar or array or second pixel
print (aMover.estimatedPosition())

for seq in range(0,nseq):
    for ov in ov_values:
        for ovref in ovref_values:
            for gate in gate_values:
                for posStep, posInfo in dict_PosScan.items():

                    print "++++ Centering Bar: "+str(posStep)+": X="+str(posInfo[0])+" Y="+str(posInfo[1])+" Channels="+str(posInfo[2])+" +++++"
                    print aMover.moveAbsoluteXY(posInfo[0],posInfo[1])
                    if (aMover.moveAbsoluteXY(posInfo[0],posInfo[1]) is "error"):
                        print "== Out of range: skipping this position =="
                        continue
                    print aMover.estimatedPosition()
                    print "++++ Done +++++"                    

                    thisname = name+"_POS"+str(posStep)+"_X"+str(posInfo[0])+"_Y"+str(posInfo[1])+"_CH"+str(posInfo[2]).replace("_","-")+"_ETHR"+str(posInfo[3]).replace("_","-")+"_T1THR"+str(posInfo[4]).replace("_","-")

                    #============================================
                    #RUN("PED",t_ped,ov,ovref,gate,thisname,posInfo[2],"","")
                    RUN("PHYS",t_phys,ov,ovref,gate,thisname,posInfo[2],posInfo[3],posInfo[4]) 
                    #RUN("PED",t_ped,ov,ovref,gate,thisname,posInfo[2],"","")
                    #============================================

Exemplo n.º 2
0
from xyMover import XYMover
import time

print("++++ Testing XYMover +++++")

aMover = XYMover(8820)
#print (aMover.estimatedPosition())

print("++++ Moving to 20,25 +++++")
print(aMover.moveAbsoluteXY(20, 25))
print(aMover.estimatedPosition())
print("++++ Done +++++")

print("++++ Moving 100,30 out of bounds +++++")
print(aMover.moveAbsoluteXY(100, 30))
print(aMover.estimatedPosition())
print("++++ Done +++++")
Exemplo n.º 3
0
class XYControlPanel(npyscreen.ActionForm):
    # Constructor
    def create(self):
        self.OK_BUTTON_TEXT = 'Apply'
        self.CANCEL_BUTTON_TEXT = 'Exit'
        self.__class__.CANCEL_BUTTON_BR_OFFSET = (2, 15)

        # Add the TitleText widget to the form
        self.port = self.add(npyscreen.TitleFilename,
                             name="PORT     :",
                             value=opt.myport,
                             editable=True)
        self.xyMover = XYMover(int(self.port.value))
        xHome = round(float(self.xyMover.estimatedPosition().split(" ")[0]), 1)
        yHome = round(float(self.xyMover.estimatedPosition().split(" ")[1]), 1)
        self.xpos = self.add(npyscreen.TitleText,
                             name="X_POS       :",
                             value="%3.1f" % xHome,
                             rely=4)
        self.xposSlider = self.add(npyscreen.TitleSlider,
                                   out_of=48,
                                   name="X_POS       :",
                                   value=xHome,
                                   editable=False)
        self.ypos = self.add(npyscreen.TitleText,
                             name="Y_POS       :",
                             value="%3.1f" % yHome,
                             rely=7)
        self.yposSlider = self.add(npyscreen.TitleSlider,
                                   out_of=48,
                                   name="Y_POS       :",
                                   value=yHome,
                                   editable=False)

    def on_ok(self):
        (xpos, ypos) = self.xyMover.estimatedPosition().split(" ")
        try:
            if (round(float(xpos), 1) != round(float(self.xpos.value), 1) or
                    round(float(ypos), 1) != round(float(self.ypos.value), 1)):
                xpos = self.xpos.value
                ypos = self.ypos.value
                self.xpos.value = "Moving"
                self.ypos.value = "Moving"
                self.xpos.display()
                self.ypos.display()
                self.xyMover.moveAbsoluteXY(round(float(xpos), 1),
                                            round(float(ypos), 1))
                time.sleep(0.5)
                (xpos, ypos) = self.xyMover.estimatedPosition().split(" ")
                self.xpos.value = xpos
                self.ypos.value = ypos
                self.xposSlider.value = round(float(xpos), 1)
                self.xpos.display()
                self.ypos.display()
                self.yposSlider.value = round(float(ypos), 1)

        except ValueError as ve:
            self.xpos.value = "Invalid coordinates. Please use a float number XX.X"
            self.ypos.value = "Invalid coordinates. Please use a float number YY.Y"
            self.xpos.display()
            self.ypos.display()
        except:
            self.xpos.value = "Error moving"
            self.ypos.value = "Error moving"
            self.xpos.display()
            self.ypos.display()

    def while_waiting(self):
        pass

    def on_cancel(self):
        self.parentApp.setNextForm(None)