Example #1
0
 def __init__(self,
              ID,
              VME_crate=None,
              link=None,
              ch_up=12,
              ch_down=13,
              ch_left=15,
              ch_right=14,
              elog=None,
              z_undulator=None,
              description=None):
     self.ID = ID
     self.x_diode = Motor(ID + ":MOTOR_X1")
     self.y_diode = Motor(ID + ":MOTOR_Y1")
     self.y_target = Motor(ID + ":MOTOR_PROBE")
     self.target = EnumWrapper(ID + ":PROBE_SP")
     if VME_crate:
         self.diode_up = FeDigitizer("%s:Lnk%dCh%d" %
                                     (VME_crate, link, ch_up))
         self.diode_down = FeDigitizer("%s:Lnk%dCh%d" %
                                       (VME_crate, link, ch_down))
         self.diode_left = FeDigitizer("%s:Lnk%dCh%d" %
                                       (VME_crate, link, ch_left))
         self.diode_right = FeDigitizer("%s:Lnk%dCh%d" %
                                        (VME_crate, link, ch_right))
class Microscope:
    def __init__(self,
                 ID,
                 gonio=None,
                 rotat=None,
                 alias_namespace=None,
                 z_undulator=None,
                 description=None):
        self.ID = ID

        ### Microscope motors ###
        self.focus = Motor(ID + ":FOCUS")
        self.zoom = Motor(ID + ":ZOOM")
        #        self._smaractaxes = {
        #            'gonio': '_xmic_gon',   # will become self.gonio
        #            'rot':   '_xmic_rot'}   # """ self.rot
        self.gonio = SmarActAxis(gonio)  #TODO: can this be None?
        self.rot = SmarActAxis(rotat)  #TODO: can this be None?

    def __str__(self):
        return "Microscope positions\nfocus: %s\nzoom:  %s\ngonio: %s\nrot:   %s" % (
            self.focus.wm(), self.zoom.wm(), self.gonio.wm(), self.rot.wm())

    def __repr__(self):
        return "{'Focus': %s, 'Zoom': %s, 'Gonio': %s, 'Rot': %s}" % (
            self.focus.wm(), self.zoom.wm(), self.gonio.wm(), self.rot.wm())
Example #3
0
    def __init__(
        self,
        ID,
        VME_crate=None,
        link=None,
        ch_up=12,
        ch_down=13,
        ch_left=15,
        ch_right=14,
        elog=None,
        name=None,
    ):
        self.ID = ID
        self.name = name
        self.diode_x = Motor(ID + ":MOTOR_X1", name="diode_x")
        self.diode_y = Motor(ID + ":MOTOR_Y1", name="diode_y")
        self.target_pos = Motor(ID + ":MOTOR_PROBE", name="target_pos")
        self.target = PVEnumAdjustable(ID + ":PROBE_SP", name="target")
        if VME_crate:
            self.diode_up = FeDigitizer("%s:Lnk%dCh%d" %
                                        (VME_crate, link, ch_up))
            self.diode_down = FeDigitizer("%s:Lnk%dCh%d" %
                                          (VME_crate, link, ch_down))
            self.diode_left = FeDigitizer("%s:Lnk%dCh%d" %
                                          (VME_crate, link, ch_left))
            self.diode_right = FeDigitizer("%s:Lnk%dCh%d" %
                                           (VME_crate, link, ch_right))

        if self.name:
            self.alias = Alias(name)
            self.alias.append(self.diode_x.alias)
            self.alias.append(self.diode_y.alias)
            self.alias.append(self.target_pos.alias)
            self.alias.append(self.target.alias)
class Table:
    def __init__(self,
                 ID,
                 alias_namespace=None,
                 z_undulator=None,
                 description=None):
        self.ID = ID

        ### ADC optical table ###
        self.x1 = Motor(ID + ":MOTOR_X1")
        self.y1 = Motor(ID + ":MOTOR_Y1")
        self.y2 = Motor(ID + ":MOTOR_Y2")
        self.y3 = Motor(ID + ":MOTOR_Y3")
        self.z1 = Motor(ID + ":MOTOR_Z1")
        self.z2 = Motor(ID + ":MOTOR_Z2")
        self.x = Motor(ID + ":W_X")
        self.y = Motor(ID + ":W_Y")
        self.z = Motor(ID + ":W_Z")
        self.pitch = Motor(ID + ":W_RX")
        self.yaw = Motor(ID + ":W_RY")
        self.roll = Motor(ID + ":W_RZ")
        self.modeSP = PV(ID + ":MODE_SP")
        self.status = PV(ID + ":SS_STATUS")

    def __str__(self):
        return "Prime Table position\nx: %s mm\ny: %s mm\nz: %s\npitch: %s mrad\nyaw: %s mrad\nmode SP: %s \nstatus: %s" % (
            self.x.wm(), self.y.wm(), self.z.wm(), self.pitch.wm(),
            self.yaw.wm(), self.modeSP.get(as_string=True), self.status.get())

    def __repr__(self):
        return "{'x': %s, 'y': %s,'z': %s,'pitch': %s, 'yaw': %s, 'mode set point': %s,'status': %s}" % (
            self.x, self.y, self.z, self.pitch, self.yaw,
            self.modeSP.get(as_string=True), self.status.get())
    def __init__(self, ID, alias_namespace=None):
        self.ID = ID

        ### motors 1.5M JF Zaber ###
        #        self.det_x = Motor(ID + ':MOT_TX')
        #        self.det_y = Motor(ID + ':MOT_TY')
        self.zaber_x = Motor(ID + ":MOT_TZ")
        self.qioptiq_zoom = Motor(ID + ":MOT_QIOPT_Z")
Example #6
0
class GPS:

    def __init__(self, ID, alias_namespace=None):
        self.ID = ID

        ### motors heavy load gps table ###
        self.xhl = Motor(ID + ":MOT_TBL_TX")
        self.zhl = Motor(ID + ":MOT_TBL_TZ")
        self.yhl = Motor(ID + ":MOT_TBL_TY")
        self.th = Motor(ID + ":MOT_MY_RYTH")
        try:
            self.rxhl = Motor(ID + ":MOT_TBL_RX")
        except:
            print("GPS.pitch not found")
            pass
        try:
            self.ryhl = Motor(ID + ":MOT_TBL_RY")
        except:
            print("GPS.roll not found")
            pass

        ### motors heavy load gonio base ###
        self.xmu = Motor(ID + ":MOT_HEX_TX")
        self.mu = Motor(ID + ":MOT_HEX_RX")
        self.tth = Motor(ID + ":MOT_NY_RY2TH")
        self.xbase = Motor(ID + ":MOT_TX")
        self.ybase = Motor(ID + ":MOT_TY")

        self.hex_x = PV("SARES20-HEX_PI:POSI-X")
        self.hex_y = PV("SARES20-HEX_PI:POSI-Y")
        self.hex_z = PV("SARES20-HEX_PI:POSI-Z")
        self.hex_u = PV("SARES20-HEX_PI:POSI-U")
        self.hex_v = PV("SARES20-HEX_PI:POSI-V")
        self.hex_w = PV("SARES20-HEX_PI:POSI-W")

    def __repr__(self):
        s = "**Heavy Load**\n"
        motors = "xmu mu tth xbase ybase".split()
        for motor in motors:
            s += " - %s %.4f\n" % (motor, getattr(self, motor).wm())

        s += " - HLX %.4f\n" % (self.xhl.wm())
        s += " - HLY %.4f\n" % (self.yhl.wm())
        s += " - HLZ %.4f\n" % (self.zhl.wm())
        s += " - HLTheta %.4f\n" % (self.th.wm())
        s += "\n"

        s += "**Gonio**\n"
        motors = "xmu mu tth xbase ybase".split()
        for motor in motors:
            s += " - %s %.4f\n" % (motor, getattr(self, motor).wm())
        s += "\n"

        s += "**Hexapod**\n"
        motors = "x y z u v w".split()
        for motor in motors:
            s += " - hex_%s %.4f\n" % (motor, getattr(self, "hex_" + motor).get())
        return s
    def __init__(self, ID, elog=None, name=None, inpos=-18.818, outpos=-5):
        self.ID = ID
        self.elog = elog
        self.name = name
        self.alias = Alias(name)
        #        append_object_to_object(self,

        self._inpos = inpos
        self._outpos = outpos
        self.mirrmotor = Motor(self.ID + ":MOTOR_1")
    def __init__(self,
                 ID,
                 alias_namespace=None,
                 z_undulator=None,
                 description=None):
        self.ID = ID

        ### Owis linear stages ###
        self.cry1 = Motor(ID + ":CRY_1")
        self.cry2 = Motor(ID + ":CRY_2")
    def __init__(self, ID):
        self.ID = ID

        ### Mirrors used in the expeirment ###
        try:
            self.phi = Motor(ID + "-M517:MOT")
        except:
            print("No Standa steering phi mirror")

        try:
            self.th = Motor(ID + "-M518:MOT")
        except:
            print("No Standa steering theta mirror")
Example #10
0
 def __init__(self,
              ID,
              elog=None,
              name=None,
              inpos=-18.818,
              outpos=-5,
              z_undulator=None,
              description=None):
     self.ID = ID
     self.elog = elog
     self.name = name
     self._inpos = inpos
     self._outpos = outpos
     self.mirrmotor = Motor(self.ID + ":MOTOR_1")
Example #11
0
class RefLaser_Aramis:
    def __init__(self,
                 ID,
                 elog=None,
                 name=None,
                 inpos=-18.818,
                 outpos=-5,
                 z_undulator=None,
                 description=None):
        self.ID = ID
        self.elog = elog
        self.name = name
        self._inpos = inpos
        self._outpos = outpos
        self.mirrmotor = Motor(self.ID + ":MOTOR_1")

    def __call__(self, *args, **kwargs):
        self.set(*args, **kwargs)

    def __repr__(self):
        status = self.get_status()
        if status:
            return "Reflaser is In."
        elif status == False:
            return "Reflaser is Out."
        elif status == None:
            return "Reflaser status not defined."

    def get_status(self):
        v = self.mirrmotor.get_current_value()
        if abs(v - self._inpos) < 0.2:
            isin = True
        elif abs(v - self._outpos) < 0.2:
            isin = False
        else:
            isin = None
        return isin

    def set(self, value):
        if type(value) is str:
            if value.lower() == "in":
                value = True
            elif value.lower() == "out":
                value = False
            else:
                print("String %s not recognized!" % value)
        if value:
            self.mirrmotor.set_target_value(self._inpos)
        else:
            self.mirrmotor.set_target_value(self._outpos)
Example #12
0
 def __init__(self, ID, name=None, elog=None):
     self.ID = ID
     self.name = name
     self._x1 = Motor(ID + ":MOT2")
     self._x2 = Motor(ID + ":MOT3")
     self._y1 = Motor(ID + ":MOT4")
     self._y2 = Motor(ID + ":MOT5")
Example #13
0
 def __init__(self, ID, name=None, elog=None):
     self.ID = ID
     self.name = name
     self._xoffs = Motor(ID + ":MOTOR_X")
     self._yoffs = Motor(ID + ":MOTOR_Y")
     self._xgap = Motor(ID + ":MOTOR_W")
     self._ygap = Motor(ID + ":MOTOR_H")
Example #14
0
 def __init__(self, ID, name=None, elog=None):
     self.ID = ID
     self.name = name
     self._x1 = Motor(ID + ":MOTOR_X1")
     self._x2 = Motor(ID + ":MOTOR_X2")
     self._y1 = Motor(ID + ":MOTOR_Y1")
     self._y2 = Motor(ID + ":MOTOR_Y2")
Example #15
0
    def __init__(self,
                 ID,
                 gonio=None,
                 rotat=None,
                 alias_namespace=None,
                 z_undulator=None,
                 description=None):
        self.ID = ID

        ### Microscope motors ###
        self.focus = Motor(ID + ":FOCUS")
        self.zoom = Motor(ID + ":ZOOM")
        #        self._smaractaxes = {
        #            'gonio': '_xmic_gon',   # will become self.gonio
        #            'rot':   '_xmic_rot'}   # """ self.rot
        self.gonio = SmarActAxis(gonio)  #TODO: can this be None?
        self.rot = SmarActAxis(rotat)  #TODO: can this be None?
Example #16
0
class VonHamosBragg:
    def __init__(self,
                 ID,
                 alias_namespace=None,
                 z_undulator=None,
                 description=None):
        self.ID = ID

        ### Owis linear stages ###
        self.cry1 = Motor(ID + ":CRY_1")
        self.cry2 = Motor(ID + ":CRY_2")

    def __str__(self):
        return "von Hamos positions\nCrystal 1: %s mm\nCrystal 2: %s mm" % (
            self.cry1.wm(), self.cry2.wm())

    def __repr__(self):
        return "{'Crystal 1': %s, 'Crystal 2': %s}" % (self.cry1.wm(),
                                                       self.cry2.wm())
Example #17
0
 def __init__(self,
              ID,
              name=None,
              elog=None,
              z_undulator=None,
              description=None):
     self.ID = ID
     self.name = name
     self._x1 = Motor(ID + ":MOTOR_X1")
     self._x2 = Motor(ID + ":MOTOR_X2")
     self._y1 = Motor(ID + ":MOTOR_Y1")
     self._y2 = Motor(ID + ":MOTOR_Y2")
Example #18
0
class SlitPosWidth_old:
    def __init__(self,
                 ID,
                 name=None,
                 elog=None,
                 z_undulator=None,
                 description=None):
        self.ID = ID
        self.name = name
        self._xoffs = Motor(ID + ":MOTOR_X")
        self._yoffs = Motor(ID + ":MOTOR_Y")
        self._xgap = Motor(ID + ":MOTOR_W")
        self._ygap = Motor(ID + ":MOTOR_H")

    def get_hg(self):
        return self._xgap.get_current_value()

    def get_vg(self):
        return self._ygap.get_current_value()

    def get_ho(self):
        return self._xoffs.get_current_value()

    def get_vo(self):
        return self._yoffs.get_current_value()

    def set_hg(self, value):
        c = self._xgap.set_target_value(value)
        return c

    def set_vg(self, value):
        c = self._ygap.set_target_value(value)
        return c

    def set_ho(self, value):
        c = self._xoffs.set_target_value(value)
        return c

    def set_vo(self, value):
        c = self._yoffs.set_target_value(value)
        return c

    def __call__(self, width, height):
        self.set_hg(width)
        self.set_vg(height)

    def __repr__(self):
        string1 = "gap: (%g,%g) mm" % (self.get_hg(), self.get_vg())
        string2 = "pos: (%g,%g) mm" % (self.get_ho(), self.get_vo())
        return "\n".join((string1, string2))
    def __init__(self, ID, bshost=None, bsport=None):
        self.ID = ID
        try:
            self.zoom = Motor("SARES20-EXP:MOT_NAV_Z.VAL")
        except:
            print("X-Ray eye zoom motor not found")
            pass
        try:
            self.cam = CameraCA(ID)
        except:
            print("X-Ray eye Cam not found")
            pass

        if bshost:
            self.camBS = CameraBS(host=bshost, port=bsport)
Example #20
0
    def __init__(self, ID, E_min=1500, sleeptime=1, name=None, limits=[-52, 2], pulse_picker=None):
        self.ID = ID
        self._pv_status_str = PV(ID + ":MOT2TRANS.VALD")
        self._pv_status_int = PV(ID + ":IDX_RB")
        self.E_min = E_min
        self._sleeptime = sleeptime
        self.name = name
        self.alias = Alias(name)
        self.pulse_picker = pulse_picker

        self.motors = [Motor(f"{self.ID}:MOTOR_{n+1}", name=f"motor{n+1}") for n in range(6)]
        for n, mot in enumerate(self.motors):
            self.__dict__[f"motor_{n+1}"] = mot
            self.alias.append(mot.alias)
            if limits:
                mot.set_epics_limits(*limits)
Example #21
0
    def __init__(self, ID, name="Alvra DCM", **kwargs):
        super().__init__(ID, name=name, **kwargs)

        self.theta = Motor(ID + ":RX12")
        self.x = Motor(ID + ":TX12")
        self.gap = Motor(ID + ":T2")
        self.roll1 = Motor(ID + ":RZ1")
        self.roll2 = Motor(ID + ":RZ2")
        self.pitch2 = Motor(ID + ":RX2")

        self.energy = DoubleCrystalMonoEnergy(ID, name=name)
Example #22
0
    def __init__(self,
                 ID,
                 alias_namespace=None,
                 z_undulator=None,
                 description=None,
                 name="Prime Sample Manipulator"):
        self.ID = ID

        ### Huber sample stages ###
        self.x = Motor(ID + ":MOTOR_X1", name + " X")
        self.y = Motor(ID + ":MOTOR_Y1", name + " Y")
        self.z = Motor(ID + ":MOTOR_Z1", name + " Z")
    def __init__(self):
        ID = "SLAAR11-LMOT"
        super().__init__(ID, "Experiment laser hardware",
                         "Laser motor positions", 122)

        # Laser repetition rate
        self.repRate = PVAdjustable("SIN-TIMAST-TMA:Evt-20-Freq-I")
        self.darkRate = PVAdjustable("SIN-TIMAST-TMA:Evt-23-Freq-I")

        # Waveplates
        self.wpTopas = Motor(ID + "-M442:MOT")
        self.wpHarmonics = Motor(ID + "-M432:MOT")

        # Delay stages
        self.pumpTopas_delay = DelayStage(ID + "-M451:MOTOR_1",
                                          "Delay Pump Topas")
        self.pumpHarmonics_delay = DelayStage(ID + "-M453:MOTOR_1",
                                              "Delay Pump Harmonics")
        self.globalglobi_delay = DelayStage(ID + "-M452:MOTOR_1",
                                            "Delay Global Globi")

        # PALM delay stages
        self.palm_delay = DelayStage(ID + "-M423:MOT")
        self.palmEO_delay = DelayStage(ID + "-M422:MOT")

        # PSEN delay stage
        self.psen_delay = DelayStage(ID + "-M424:MOT")

        # Experimental compressor delay stage
        self.compressorExp_delay = Motor(ID + "-M431:MOT")

        # Experimental compressor delay stage
        self.compressorDiag_delay = Motor(ID + "-M421:MOT")

        # variable OD filter
        self.vODfilter = Motor(ID + "-M444:MOT", "Variable OD Filter")

        # Experiment-FEL timing delay stage
        self.pump_toFEL_delay = DelayStage(ID + "-M441:MOT")

        # Experiment focussing lens position
        self.pump_lens_focus = Motor(ID + "-M443:MOT")

        # Globi electronic timing PV from Edwin
        self.eTiming = ETiming(ID + "-eTiming")

        # FROG
        FROG_motor = SmarActAxis("SLAAR11-LMTS-FROG1")
        FROG_delay = Delay(FROG_motor)
        self.FROG = SimpleDevice("FROG", motor=FROG_motor, delay=FROG_delay)
Example #24
0
    def __init__(self,
                 ID="CDCMEWTC",
                 name="Alvra DCM coupled to FEL energy with time correction",
                 limit_low=None,
                 limit_high=None):
        self.wait_time = 0.1

        self.limit_low = limit_low
        self.limit_high = limit_high

        pvname_setvalue = "SAROP11-ARAMIS:ENERGY_SP"  #_USER" #TODO: where did the _USER go?
        pvname_readback = "SAROP11-ARAMIS:ENERGY"
        #        pvname_moving   = "SGE-OP2E-ARAMIS:MOVING"
        pvname_moving = "SAROP11-ODCM105:MOVING"
        pvname_coupling = "SGE-OP2E-ARAMIS:MODE_SP"

        pv_setvalue = PV(pvname_setvalue)
        pv_readback = PV(pvname_readback)
        pv_moving = PV(pvname_moving)
        pv_coupling = PV(pvname_coupling)

        self.timing = Motor("SLAAR11-LMOT-M452:MOTOR_1")
        self.electron_energy_rb = PV("SARCL02-MBND100:P-READ")
        self.electron_energy_sv = PV("SGE-OP2E-ARAMIS:E_ENERGY_SP")

        units = pv_readback.units
        super().__init__(ID, name=name, units=units)

        self.pvnames = SimpleNamespace(setvalue=pvname_setvalue,
                                       readback=pvname_readback,
                                       moving=pvname_moving,
                                       coupling=pvname_coupling)

        self.pvs = SimpleNamespace(setvalue=pv_setvalue,
                                   readback=pv_readback,
                                   moving=pv_moving,
                                   coupling=pv_coupling)
Example #25
0
class Huber:
    def __init__(self,
                 ID,
                 alias_namespace=None,
                 z_undulator=None,
                 description=None,
                 name="Prime Sample Manipulator"):
        self.ID = ID

        ### Huber sample stages ###
        self.x = Motor(ID + ":MOTOR_X1", name + " X")
        self.y = Motor(ID + ":MOTOR_Y1", name + " Y")
        self.z = Motor(ID + ":MOTOR_Z1", name + " Z")

    def __str__(self):
        return "Huber Sample Stage %s\nx: %s mm\ny: %s mm\nz: %s mm" % (
            self.ID, self.x.wm(), self.y.wm(), self.z.wm())

    def __repr__(self):
        return "{'X': %s, 'Y': %s, 'Z': %s}" % (self.x.wm(), self.y.wm(),
                                                self.z.wm())
Example #26
0
    def __init__(self,
                 ID,
                 timeAdjustable=None,
                 timeReferenceEnergy=None,
                 timeReference=None):
        self.ID = ID
        self.theta = Motor(ID + ":RX12")
        self.x = Motor(ID + ":TX12")
        self.gap = Motor(ID + ":T2")
        self.roll1 = Motor(ID + ":RZ1")
        self.roll2 = Motor(ID + ":RZ2")
        self.pitch2 = Motor(ID + ":RX2")

        self.energy_rbk = PV(ID + ":ENERGY")
        self.energy_sp = PV(ID + ":ENERGY_SP")
        self.moving = PV(ID + ":MOVING")
        self._stop = PV(ID + ":STOP.PROC")
        self.crystal_type = EnumWrapper(ID + ":CRYSTAL_SP")
        self.beam_offset = PV(ID + ":BEAM_OFFSET")
        self.timeAdjustable = timeAdjustable
        self.timeReferenceEnergy = timeReferenceEnergy
        self.timeReference = timeReference
        self.correctTime = False
Example #27
0
    def __init__(self, ID, z_undulator=None, description=None):
        self.ID = ID

        self.x = Motor(ID + ":W_X")
        self.y = Motor(ID + ":W_Y")
        self.pitch = Motor(ID + ":W_RY")
        self.roll = Motor(ID + ":W_RZ")
        self.yaw = Motor(ID + ":W_RX")
        self.bend1 = Motor(ID + ":BU")
        self.bend2 = Motor(ID + ":BD")

        #self.mode = PV(ID[:11] + ":MODE").enum_strs[PV(ID[:11] + ":MODE").value]

        #### actual motors ###
        self._Y1 = Motor(ID + ":TY1")
        self._Y2 = Motor(ID + ":TY2")
        self._Y3 = Motor(ID + ":TY3")
        self._X1 = Motor(ID + ":TX1")
        self._X2 = Motor(ID + ":TX2")
Example #28
0
 def __init__(self, ID, name=None, elog=None):
     self.ID = ID
     self.name = name
     self._ax1 = Motor(ID + ":MOTOR_AX1")
     self._ax2 = Motor(ID + ":MOTOR_AX2")
     self._ay1 = Motor(ID + ":MOTOR_AY1")
     self._ay2 = Motor(ID + ":MOTOR_AY2")
     self._bx1 = Motor(ID + ":MOTOR_BX1")
     self._bx2 = Motor(ID + ":MOTOR_BX2")
     self._by1 = Motor(ID + ":MOTOR_BY1")
     self._by2 = Motor(ID + ":MOTOR_BY2")
Example #29
0
class SlitFourBlades_old:
    def __init__(self, ID, name=None, elog=None):
        self.ID = ID
        self.name = name
        self._ax1 = Motor(ID + ":MOTOR_AX1")
        self._ax2 = Motor(ID + ":MOTOR_AX2")
        self._ay1 = Motor(ID + ":MOTOR_AY1")
        self._ay2 = Motor(ID + ":MOTOR_AY2")
        self._bx1 = Motor(ID + ":MOTOR_BX1")
        self._bx2 = Motor(ID + ":MOTOR_BX2")
        self._by1 = Motor(ID + ":MOTOR_BY1")
        self._by2 = Motor(ID + ":MOTOR_BY2")

    def get_hg(self):
        return self._ax2.get_current_value() - self._ax1.get_current_value()

    def get_vg(self):
        return self._ay2.get_current_value() - self._ay1.get_current_value()

    def get_ho(self):
        return (self._ax1.get_current_value() +
                self._ax2.get_current_value()) / 2

    def get_vo(self):
        return (self._ay1.get_current_value() +
                self._ay2.get_current_value()) / 2

    def set_hg(self, value):
        ho = self.get_ho()
        c1 = self._ax1.set_target_value(ho - value / 2)
        c2 = self._ax2.set_target_value(ho + value / 2)
        c3 = self._bx1.set_target_value(ho - value / 2)
        c4 = self._bx2.set_target_value(ho + value / 2)
        return c1, c2, c3, c4

    def set_vg(self, value):
        vo = self.get_vo()
        c1 = self._ay1.set_target_value(vo - value / 2)
        c2 = self._ay2.set_target_value(vo + value / 2)
        c3 = self._by1.set_target_value(vo - value / 2)
        c4 = self._by2.set_target_value(vo + value / 2)
        return c1, c2, c3, c4

    def set_ho(self, value):
        hg = self.get_hg()
        c1 = self._ax1.set_target_value(value - hg / 2)
        c2 = self._ax2.set_target_value(value + hg / 2)
        c3 = self._bx1.set_target_value(value - hg / 2)
        c4 = self._bx2.set_target_value(value + hg / 2)
        return c1, c2, c3, c4

    def set_vo(self, value):
        vg = self.get_vg()
        c1 = self._ay1.set_target_value(value - vg / 2)
        c2 = self._ay2.set_target_value(value + vg / 2)
        c3 = self._by1.set_target_value(value - vg / 2)
        c4 = self._by2.set_target_value(value + vg / 2)
        return c1, c2, c3, c4

    def __call__(self, width, height):
        self.set_hg(width)
        self.set_vg(height)

    def __str__(self):
        string1 = "gap: (%g,%g) mm" % (self.get_hg(), self.get_vg())
        string2 = "pos: (%g,%g) mm" % (self.get_ho(), self.get_vo())
        return "\n".join((string1, string2))

    def __repr__(self):
        return self.__str__()
Example #30
0
class SlitBladesJJ_old:
    def __init__(self, ID, name=None, elog=None):
        self.ID = ID
        self.name = name
        self._x1 = Motor(ID + ":MOT2")
        self._x2 = Motor(ID + ":MOT3")
        self._y1 = Motor(ID + ":MOT4")
        self._y2 = Motor(ID + ":MOT5")

    def get_hg(self):
        return -(self._x2.get_current_value() - self._x1.get_current_value())

    def get_vg(self):
        return -(self._y2.get_current_value() - self._y1.get_current_value())

    def get_ho(self):
        return (self._x1.get_current_value() +
                self._x2.get_current_value()) / 2

    def get_vo(self):
        return (self._y1.get_current_value() +
                self._y2.get_current_value()) / 2

    def set_hg(self, value):
        ho = self.get_ho()
        c1 = self._x1.set_target_value(ho + value / 2)
        c2 = self._x2.set_target_value(ho - value / 2)
        return c1, c2

    def set_vg(self, value):
        vo = self.get_vo()
        c1 = self._y1.set_target_value(vo + value / 2)
        c2 = self._y2.set_target_value(vo - value / 2)
        return c1, c2

    def set_ho(self, value):
        hg = self.get_hg()
        c1 = self._x1.set_target_value(-(-value - hg / 2))
        c2 = self._x2.set_target_value(-(-value + hg / 2))
        return c1, c2

    def set_vo(self, value):
        vg = self.get_vg()
        c1 = self._y1.set_target_value(value + vg / 2)
        c2 = self._y2.set_target_value(value - vg / 2)
        return c1, c2

    def __call__(self, width, height):
        self.set_hg(width)
        self.set_vg(height)

    def __repr__(self):
        string1 = "gap: (%g,%g) mm" % (self.get_hg(), self.get_vg())
        string2 = "pos: (%g,%g) mm" % (self.get_ho(), self.get_vo())
        return "\n".join((string1, string2))