UCSB-Exoplanet-Polarimetry-Lab / derp_control

Motion control for the Dual-Rotating Retarder Mueller Polarimeter
MIT License
0 stars 0 forks source link

Look into SuperK SDK for automation of laser control #3

Open Jashcraf opened 6 days ago

Jashcraf commented 6 days ago

This would be particularly helpful for "white light" polarimetry that lets us measure the dispersion of optics to see if there is a polarization dependence.

The NKT SDK can be found here https://www.nktphotonics.com/support/

And if you download the SDK and run the installer, it comes with some sample files that we can use as a template for Derpy, for example, I think this turns Emission on:

from NKTP_DLL import * 
result = registerWriteU8('COM27', 15, 0x30, 3, -1) 
print('Setting emission ON - Extreme:', RegisterResultTypes(result))
Jashcraf commented 6 days ago

Here's a script that finds the open ports that we can connect to - useful for finding the laser probably

from NKTP_DLL import *

print('Find modules on all existing and accessible ports - Might take a few seconds to complete.....')
if (getLegacyBusScanning()):
    print('Scanning following ports in legacy mode:', getAllPorts())
else:
    print('Scanning following ports in normal mode:', getAllPorts())

# Use the openPorts function with Auto & Live settings. This will scan and detect modules
# on all ports returned by the getAllPorts function.
# Please note that a port being in use by another application, will show up in this list but will
# not show any devices due to this port being inaccessible.
print(openPorts(getAllPorts(), 1, 1))

# All ports returned by the getOpenPorts function has modules (ports with no modules will automatically be closed)
print('Following ports has modules:', getOpenPorts())

# Traverse the getOpenPorts list and retrieve found modules via the deviceGetAllTypesV2 function
portlist = getOpenPorts().split(',')
for portName in portlist:
    result, devList = deviceGetAllTypesV2(portName)
    for devId in range(0, len(devList)):
        if (devList[devId] != 0):
            print('Comport:',portName,'Device type:',"0x%0.4X" % devList[devId],'at address:',devId)

# Close all ports
closeResult = closePorts('')
print('Close result: ', PortResultTypes(closeResult))
maxwellmb commented 6 days ago

Should we have a separate repository for laser control?

Jashcraf commented 6 days ago

I think the SDK is self-contained enough personally, all the controls look functionally (i.e. as functions) implemented in this one DLL that we would just be making a front-end for. My personal bias (if it isn't clear from derp_control) is to have an object-oriented interface for hardware.

It might be interesting to have an exopolab.py package (I just picked a name) that contains routines for all "common" devices that are used by multiple instruments, if that's of use. For example, the SuperK, CRED2 cameras, the Thorlabs rotation stages if we keep getting more of those. Then the instrument-specific repos can install that parent package and add some custom functionality as-needed.

maxwellmb commented 6 days ago

I like that last suggestion!

On Mon, Sep 23, 2024, 4:46 PM Jaren Ashcraft @.***> wrote:

I think the SDK is self-contained enough personally, all the controls look functionally (i.e. as functions) implemented in this one DLL that we would just be making a front-end for. My personal bias (if it isn't clear from derp_control) is to have an object-oriented interface for hardware.

It might be interesting to have an exopolab.py package (I just picked a name) that contains routines for all "common" devices that are used by multiple instruments, if that's of use. For example, the SuperK, CRED2 cameras, the Thorlabs rotation stages if we keep getting more of those. Then the instrument-specific repos can install that parent package and add some custom functionality as-needed.

— Reply to this email directly, view it on GitHub https://github.com/UCSB-Exoplanet-Polarimetry-Lab/derp_control/issues/3#issuecomment-2369790727, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEK2SJD2NAW3BRFQGUJSVV3ZYCR6DAVCNFSM6AAAAABOXBVPUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZG44TANZSG4 . You are receiving this because you commented.Message ID: @.*** com>

maxwellmb commented 6 days ago

Well. Let's dicuss. It might be leaner for each set of devices to have its own repo, or at least module, no?

On Mon, Sep 23, 2024, 4:48 PM Max Millar-Blanchaer @.***> wrote:

I like that last suggestion!

On Mon, Sep 23, 2024, 4:46 PM Jaren Ashcraft @.***> wrote:

I think the SDK is self-contained enough personally, all the controls look functionally (i.e. as functions) implemented in this one DLL that we would just be making a front-end for. My personal bias (if it isn't clear from derp_control) is to have an object-oriented interface for hardware.

It might be interesting to have an exopolab.py package (I just picked a name) that contains routines for all "common" devices that are used by multiple instruments, if that's of use. For example, the SuperK, CRED2 cameras, the Thorlabs rotation stages if we keep getting more of those. Then the instrument-specific repos can install that parent package and add some custom functionality as-needed.

— Reply to this email directly, view it on GitHub https://github.com/UCSB-Exoplanet-Polarimetry-Lab/derp_control/issues/3#issuecomment-2369790727, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEK2SJD2NAW3BRFQGUJSVV3ZYCR6DAVCNFSM6AAAAABOXBVPUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZG44TANZSG4 . You are receiving this because you commented.Message ID: @.*** com>

Jashcraf commented 5 days ago

We could submodule a exopolab repo into device-specific modules. I know some folks who like organizing that way but have not done it myself.

maxwellmb commented 4 days ago

One thing to consider in the repo vs. modules discussion is keeping the requirements slim. We don't necessarily want someone to need DM-related libraries in order to operate the camera, or vice-versa.

On Tue, Sep 24, 2024 at 12:35 PM Jaren Ashcraft @.***> wrote:

We could submodule a exopolab repo into device-specific modules. I know some folks who like organizing that way but have not done it myself.

— Reply to this email directly, view it on GitHub https://github.com/UCSB-Exoplanet-Polarimetry-Lab/derp_control/issues/3#issuecomment-2372209684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEK2SJEOY5ELFPO6OFDBFCLZYG5HPAVCNFSM6AAAAABOXBVPUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZSGIYDSNRYGQ . You are receiving this because you commented.Message ID: @.*** com>