Exemple #1
0
    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)
Exemple #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 +++++")
    28: (round(posRefX,1),round(posRefY+2.0,1),"0_6_22","0_0_0","20_10_10"),
    29: (round(posRefX,1),round(posRefY+4.0,1),"0_6_22","0_0_0","20_10_10"),
    30: (round(posRefX,1),round(posRefY+6.0,1),"0_6_22","0_0_0","20_10_10"),
    31: (round(posRefX,1),round(posRefY+9.0,1),"0_6_22","0_0_0","20_10_10"),
    32: (round(posRefX,1),round(posRefY+12.0,1),"0_6_22","0_0_0","20_10_10"),
    33: (round(posRefX,1),round(posRefY+15.0,1),"0_6_22","0_0_0","20_10_10")

}

print "Position scan" , dict_PosScan

###################################################################
########################### 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 +++++"                    
    23: (round(posPixelX + 1.0, 1), round(posPixelY, 1), "0", "0", "20"),
    24: (round(posPixelX + 2.0, 1), round(posPixelY, 1), "0", "0", "20"),
    25: (round(posPixelX + 3.0, 1), round(posPixelY, 1), "0", "0", "20"),
    26: (round(posPixelX + 4.0, 1), round(posPixelY, 1), "0", "0", "20"),
    27: (round(posPixelX + 5.0, 1), round(posPixelY, 1), "0", "0", "20"),
    28: (round(posPixelX + 6.0, 1), round(posPixelY, 1), "0", "0", "20"),
    29: (round(posPixelX + 8.0, 1), round(posPixelY, 1), "0", "0", "20")
}

print "Position scan", dict_PosScan

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

aMover = XYMover(8821)  # 8821 = motor_1 = 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"):
Exemple #5
0
dict_PosScan = {

    # center the array on the bar N = 4 (5th bar)
    0: (round(posFirstBarX-4*stepX,1),round(posFirstBarY,1),"0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33","10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10","10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10_10"),

}
print "Position scan" , dict_PosScan
'''

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

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

sys.stdout.flush()

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])
Exemple #6
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)