Qcodes icon indicating copy to clipboard operation
Qcodes copied to clipboard

Oxford Instruments ProteoxS Not able to Make a Connection

Open IliyaNYU opened this issue 11 months ago • 1 comments

Hi, Here is the code for making the connection:

import logging

import qcodes as qc
from qcodes.logger.logger import start_all_logging

from qcodes_contrib_drivers.drivers.OxfordInstruments.Proteox import oiDECS

start_all_logging()
log = logging.getLogger()

station = qc.Station()

try:
    Proteox = oiDECS('Proteox')
    Proteox.timeout(15)
except Exception as err:
    log.critical(err)
    print(f'Connection failed: {err}')

And here is the error that gives:


2025-02-11 14:32:46,281 ¦ qcodes.instrument.instrument_base.com.visa ¦ ERROR ¦ visa ¦ _connect_and_handle_error ¦ 218 ¦ [Proteox(oiDECS)] Could not connect at TCPIP::localhost::33576::SOCKET
Traceback (most recent call last):
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\qcodes\instrument\visa.py", line 214, in _connect_and_handle_error
    visa_handle, visabackend, resource_manager = self._open_resource(
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\qcodes\instrument\visa.py", line 242, in _open_resource
    resource = resource_manager.open_resource(address)
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\highlevel.py", line 3284, in open_resource
    res.open(access_mode, open_timeout)
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\resources\resource.py", line 282, in open
    self.session, status = self._resource_manager.open_bare_resource(
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\highlevel.py", line 3209, in open_bare_resource
    return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1851, in open
    ret = library.viOpen(
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 226, in _return_handler
    return self.handle_return_value(session, ret_value)  # type: ignore
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\highlevel.py", line 251, in handle_return_value
    raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.
2025-02-11 14:32:46,284 ¦ root ¦ CRITICAL ¦ 2089067012 ¦ <module> ¦ 5 ¦ ("'oiDECS' object and its delegates have no attribute 'visa_handle'", "writing 'SHUTDOWN' to <oiDECS: Proteox>")
Connection failed: ("'oiDECS' object and its delegates have no attribute 'visa_handle'", "writing 'SHUTDOWN' to <oiDECS: Proteox>")

I checked every address in the decs_visa.py code and it seems the addresses are ok. Also, the tool is connected to the computer (verified). Could someone please help me with this? P.S. : I don't have that much experience in coding!

Update: That error is gone fortunately, the error was from not having a proper IP address for the connection. But, we are facing another error:

Running on Windows-10-10.0.19045-SP0 - start subprocess without PIPEd output
2025-02-11 21:20:07,205 ¦ qcodes.instrument.instrument_base ¦ WARNING ¦ instrument ¦ get_idn ¦ 108 ¦ [Proteox(oiDECS)] Error getting or interpreting *IDN?: ''
Traceback (most recent call last):
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\qcodes\instrument\instrument.py", line 95, in get_idn
    idstr = self.ask("*IDN?")
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\qcodes_contrib_drivers\drivers\OxfordInstruments\Proteox.py", line 567, in ask
    resp = self.visa_handle.query(cmd)
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\resources\messagebased.py", line 648, in query
    return self.read()
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\resources\messagebased.py", line 486, in read
    message = self._read_raw().decode(enco)
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\resources\messagebased.py", line 442, in _read_raw
    chunk, status = self.visalib.read(self.session, size)
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\ctwrapper\functions.py", line 2337, in read
    ret = library.viRead(session, buffer, count, byref(return_count))
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 226, in _return_handler
    return self.handle_return_value(session, ret_value)  # type: ignore
  File "c:\Users\FSCV_Computer\anaconda3\envs\qcodes\lib\site-packages\pyvisa\highlevel.py", line 251, in handle_return_value
    raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_CONN_LOST (-1073807194): The connection for the given session has been lost.
Connected to: None Proteox (serial:None, firmware:None) in 0.06s

Can someone please why this error exists and how to solve it? I am using oiDECS IP address as the WS URL but it is saying that the final tool is non Proteox. (I tested the decs_visa.py code and it runs ok) Thanks!

IliyaNYU avatar Feb 11 '25 19:02 IliyaNYU

Hi IliyaNYU,

Thank you for raising your issue. Please can you share your decsvisa information. This is automatically generated in your working directory in a file called decsvisa.log if your working on Windows. This will help diagnose the issue.

Thanks

abioxinst avatar Feb 21 '25 12:02 abioxinst