OxfordIonTrapGroup / oxart-devices

ARTIQ/SiPyCo-compatible laboratory device drivers
https://oxfordiontrapgroup.github.io/oxart-devices
2 stars 3 forks source link

Failure of methods in the Thorlabs PM100A driver #2

Open mgely opened 3 years ago

mgely commented 3 years ago

When communicating via sipyco to the Thorlabs PM100A power meter, certain methods fail with the following traceback:

(Thorlabs PM100A) get_power_reading()
Remote exception:
NameError: b'The given session or object reference does not support this operation.'
  File "C:\Users\gely\anaconda3\envs\artiq-env\lib\site-packages\sipyco-1.1-py3.8.egg\sipyco\pc_rpc.py", line 568, in _process_and_pyonize
    "ret": await self._process_action(target, obj)
  File "C:\Users\gely\anaconda3\envs\artiq-env\lib\site-packages\sipyco-1.1-py3.8.egg\sipyco\pc_rpc.py", line 553, in _process_action
    ret = method(*obj["args"], **obj["kwargs"])
  File "c:\users\gely\documents\github\oxart-devices\oxart\devices\thorlabs_pm\driver.py", line 363, in get_power_reading
    self._testForError(pInvokeResult)
  File "c:\users\gely\documents\github\oxart-devices\oxart\devices\thorlabs_pm\driver.py", line 56, in _testForError
    self._throwError(status)
  File "c:\users\gely\documents\github\oxart-devices\oxart\devices\thorlabs_pm\driver.py", line 62, in _throwError
    raise NameError(c_char_p(msg.raw).value)

Other commands, such as get_wavelength() work. This problem also appears on a different windows machine (caqtus control PC) with a recent artiq-env environment, but does not appear on a windows machine with an older artiq-env (comet control PC).

mgely commented 3 years ago

Copying over C:\Program Files\IVI Foundation\VISA\Win64\Bin\TLPM_64.dll from the computer on which it worked to the computer on which it didn't work solves the problem. From this I conclude that there is either

mgely commented 3 years ago

The fact that the scripts provided by Thorlabs in C:\Program Files (x86)\IVI Foundation\VISA\WinNT\TLPM\Example\Python work, even with the newer .dll, indicate that the problem is not with the thorlabs .dll , but rather due to an incompatibility between the new .dll and the oxart driver

PeiyangHe commented 3 years ago

Writing a test script directly to import the oxart driver works.

from oxart.devices.thorlabs_pm.driver import ThorlabsPM100A tlPM = ThorlabsPM100A('USB0::0x1313::0x8079::P1002650::INSTR') power = tlPM.get_power_reading() print(power)

It seems that the problem is with sipyco.