Coder Social home page Coder Social logo

Nanotrack about thorlabs_apt HOT 3 CLOSED

qpit avatar qpit commented on August 31, 2024
Nanotrack

from thorlabs_apt.

Comments (3)

mabl avatar mabl commented on August 31, 2024

Ok, it looks like this is futile since it is not exported by apt.dll...

from thorlabs_apt.

tobiasgehring avatar tobiasgehring commented on August 31, 2024

OK. APT.DLL seems to be quite limited and not documented at all. So you
either have to use the ActiveX controls :( or better, the underlying
ftdi protocol. For the latter there is a python library:
https://github.com/freespace/pyAPT
Haven't tried it myself though.

On 02/11/2016 05:55 PM, Matthias Blaicher wrote:

Ok, it looks like this is futile since it is not exported by apt.dll...


Reply to this email directly or view it on GitHub
#1 (comment).

from thorlabs_apt.

mabl avatar mabl commented on August 31, 2024

I got it working with python .net:

import clr
import sys

sys.path.append(r'C:\Program Files\Thorlabs\Kinesis')

clr.AddReference("Thorlabs.MotionControl.DeviceManagerCLI")
clr.AddReference("Thorlabs.MotionControl.GenericNanoTrakCLI")
clr.AddReference("Thorlabs.MotionControl.TCube.NanoTrakCLI")

from Thorlabs.MotionControl.DeviceManagerCLI import DeviceManagerCLI
from Thorlabs.MotionControl.GenericNanoTrakCLI import NanoTrakStatus, TIAReading, TIARangeParameters
from Thorlabs.MotionControl.TCube.NanoTrakCLI import TCubeNanoTrak

class NanoTrak:
    def __init__(self, device_id):
        DeviceManagerCLI.BuildDeviceList()
        if not DeviceManagerCLI.GetDeviceList().Contains(device_id):
            raise RuntimeError('Unknown device id')

        device = TCubeNanoTrak.CreateTCubeNanoTrak(device_id)
        device.Connect(device_id)
        if not device.IsSettingsInitialized():
            device.WaitForSettingsInitialized(5000)

        device.StartPolling(250)

        #device.SetTIARangeMode(TIARangeParameters.TIARangeModes.AutoRangeAtSelected, TIARangeParameters.OddOrEven.All);

        #nanotrak_settings = device.GetNanoTrakConfiguration(device_id)
        self._device = device

    def close(self):
        if self._device:
            self._device.StopPolling()
            self._device.Disconnect()
            self._device = None

    def __del__(self):
        self.close()

    @property
    def tracking(self):
        return self._device.GetMode() != NanoTrakStatus.OperatingModes.Latch

    @tracking.setter
    def tracking(self, enabled):
        if enabled:
            self._device.SetMode(NanoTrakStatus.OperatingModes.Tracking)
        else:
            self._device.SetMode(NanoTrakStatus.OperatingModes.Latch)


    @property
    def power(self):
        tia_reading = self._device.GetReading()
        # if tia_reading.UnderOrOverRead != TIAReading.UnderOrOver.Within:
        #     raise ValueError('TIA out of range!')
        return tia_reading.AbsoluteReading


    @property
    def cycle_position(self):
        pos = self._device.GetCirclePosition()
        return pos.HPosition, pos.VPosition

from thorlabs_apt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.