Ejemplo n.º 1
0
    async def __aenter__(self):
        await super().__aenter__()
        self._leadpitch = await self._getLeadPitch()
        self.velocity = await self.getVelocity()
        self._updateFuture = ensure_weakly_binding_future(self.updateStatus)

        return self
Ejemplo n.º 2
0
    def __init__(self, resource, ethernet=False):
        """
        Parameters
        ----------
        resource : Resource
            PyVisa Resource object of the connected device.
        ethernet : bool
            Indicates if the connection to the device is an ethernet connection.
        """

        super().__init__(objectName=None, loop=None)
        self.resource = resource
        self.ethernet = ethernet
        self.resource.timeout = 1000
        #self.resource.set_visa_attribute(pyvisa_consts.VI_ATTR_SUPPRESS_END_EN, pyvisa_consts.VI_FALSE)

        if ethernet:
            self.resource.read_termination = chr(0)
        else:
            self.resource.read_termination = ''

        self.resource.write_termination = chr(0)

        self.observe(self.setParameter, traitlets.All)

        self._traitChangesDueToStatusUpdate = True
        self._lock = Lock()

        self._statusUpdateFuture = ensure_weakly_binding_future(
            self.contStatusUpdate)
Ejemplo n.º 3
0
 async def __aenter__(self):
     await super().__aenter__()
     await self.initializeControlUnit()
     await self.getControlUnitInfo()
     await self.statusUpdate()
     self._statusUpdateFuture = ensure_weakly_binding_future(
         self.continuousStatusUpdate)
     return self
Ejemplo n.º 4
0
    async def __aenter__(self):
        await super().__aenter__()

        await self.send("absol" + str(self.axis))
        self._microstepResolution = await self.queryAxisVariable('mcstp')
        self._updateFuture = ensure_weakly_binding_future(self.updateStatus)

        return self
Ejemplo n.º 5
0
 async def __aenter__(self):
     await self.singleUpdate()
     self.getMaxVelocity()
     self.observe(self.setMaxVelocity, 'maxVelocity')
     self.getAcceleration()
     self.observe(self.setAcceleration, 'acceleration')
     #await self.enableOperation()
     self._updateFuture = ensure_weakly_binding_future(self.updateStatus)
     return self
Ejemplo n.º 6
0
 def __init__(self, resource, objectName=None, loop=None):
     super().__init__(objectName=None, loop=None)
     self.resource = resource
     self.resource.timeout = 1000
     self.observe(self.setParameter, traitlets.All)
     self._traitChangesDueToStatusUpdate = True
     self._lock = Lock()
     self._statusUpdateFuture = ensure_weakly_binding_future(
         self.contStatusUpdate)
Ejemplo n.º 7
0
    async def __aenter__(self):
        await super().__aenter__()

        if self.transport is None:
            raise RuntimeError("Can't initialize the Hydra when no connection "
                               "was made!")

        await self.initialize()
        self._updateFuture = ensure_weakly_binding_future(self.updateStatus)

        return self
Ejemplo n.º 8
0
    async def __aenter__(self):
        await super().__aenter__()

        self._identification = await self.send(b'*IDN?', includeAxis=False)
        self._hardwareMinimum = await self.send(b'TMN?')
        self._hardwareMaximum = await self.send(b'TMX?')
        self.velocity = Q_(await self.send(b'VEL?'), 'mm/s')
        self._isReferenced = bool(await self.send(b'FRF?'))

        await self.send("RON", 1)
        await self.send("SVO", 1)

        self._updateFuture = ensure_weakly_binding_future(self.updateStatus)

        return self
Ejemplo n.º 9
0
    def __init__(self, axis=0, encoderMode=EncoderMode.A_BSignal4fold,
                 objectName=None, loop=None):
        super().__init__(objectName, loop)
        self.setPreferredUnits(ureg.deg, ureg.deg / ureg.s)
        if Goniometer.connection is None:
            Goniometer.connection = GonioConn()
        self.cdll = Goniometer.connection.dll

        self.axis = axis
        self.cdll.InitEncoder(self.axis, encoderMode.value)
        self.cdll.SetEncoder(self.axis, 0)
        self.cdll.SetRunFreeFrq(self.axis, 100)
        self.cdll.SetRunFreeSteps(self.axis, 32000)

        # don't know if important
        self.cdll.SetPosition(self.axis, 0)
        self.set_trait('value', self._stepToDeg(
                                             self.cdll.GetPosition(self.axis)))
        self.velocity = Q_(5, 'deg/s')

        self._statusRefresh = 0.1
        self._isMovingFuture = asyncio.Future()
        self._isMovingFuture.set_result(None)
        self._updateFuture = ensure_weakly_binding_future(self.updateStatus)
Ejemplo n.º 10
0
 async def __aenter__(self):
     await super().__aenter__()
     self._updateFuture = ensure_weakly_binding_future(self._update)
     return self
Ejemplo n.º 11
0
 async def __aenter__(self):
     await super().__aenter__()
     self._continuousUpdateFut = \
         ensure_weakly_binding_future(self._continuousRead)
     return self