8000 Prologix support for both USB and ethernet versions by bobmcnamara · Pull Request #887 · pyvisa/pyvisa · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Prologix support for both USB and ethernet versions #887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 4, 2025

Conversation

bobmcnamara
Copy link
Contributor
@bobmcnamara bobmcnamara commented Jan 22, 2025

Support added for Prologix GPIB adapters, both USB and ethernet. Examples of usage:

import pyvisa
rm = pyvisa.ResourceManager()
prlgx = rm.open_resource("PRLGX-TCPIP::169.254.1.80::INTFC")
instr = rm.open_resource("GPIB::17::INSTR")
instr.query("*IDN?")

Or for USB version:

import pyvisa
rm = pyvisa.ResourceManager()
prlgx = rm.open_resource("PRLGX-ASRL::/dev/cu.usbserialXXX::INTFC")
instr = rm.open_resource("GPIB::17::INSTR")
instr.query("*IDN?")

  • [n/a] Closes # (insert issue number if relevant)
  • Executed ruff check . && ruff format -c . --check with no errors
  • [ToDo] The change is fully covered by automated unit tests
  • [ToDo] Documented in docs/ as appropriate
  • Added an entry to the CHANGES file

Copy link
Member
@MatthieuDartiailh MatthieuDartiailh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing to address but LGTM otherwise.

Copy link
codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.62%. Comparing base (e0fcba1) to head (986a077).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #887      +/-   ##
==========================================
+ Coverage   79.54%   79.62%   +0.08%     
==========================================
  Files          27       27              
  Lines        5378     5400      +22     
  Branches      335      335              
==========================================
+ Hits         4278     4300      +22     
  Misses       1077     1077              
  Partials       23       23              
Flag Coverage Δ
unittests 79.53% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MatthieuDartiailh MatthieuDartiailh merged commit fddbf50 into pyvisa:main Feb 4, 2025
18 checks passed
@fenugrec
Copy link
fenugrec commented Apr 26, 2025

Very nice. Quick test however, it doesn't seem to like the 'INTFC' suffix ; I must be missing something ? :

>>> import pyvisa
... rm = pyvisa.ResourceManager()
... prlgx = rm.open_resource("PRLGX-ASRL::/dev/ttyACM0::INTFC")
... tds=rm.open_resource("GPIB::7::INSTR")
...
...
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/pyvisa_py/sessions.py", line 205, in get_session_class
    return cls._session_classes[(interface_type, resource_class)]
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: (<InterfaceType.prlgx_asrl: 34567>, 'INTFC')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<python-input-0>", line 3, in <module>
    prlgx = rm.open_resource("PRLGX-ASRL::/dev/ttyACM0::INTFC")
  File "/usr/lib/python3.13/site-packages/pyvisa/highlevel.py", line 3293, in open_resource
    res.open(access_mode, open_timeout)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pyvisa/resources/resource.py", line 282, in open
    self.session, status = self._resource_manager.open_bare_resource(
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self._resource_name, access_mode, open_timeout
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/pyvisa/highlevel.py", line 3218, in open_bare_resource
    return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pyvisa_py/highlevel.py", line 164, in open
    cls = sessions.Session.get_session_class(
        parsed.interface_type_const, parsed.resource_class
    )
  File "/usr/lib/python3.13/site-packages/pyvisa_py/sessions.py", line 207, in get_session_class
    raise ValueError(
        "No class registered for %s, %s" % (interface_type, resource_class)
    )
ValueError: No class registered for 34567, INTFC

pyvisa-info output: (cropped)

 $ pyvisa-info
PyVISA Version: 1.15.1.dev3+gb7f5010

Backends:
   ivi:
      Version: 1.15.1.dev3+gb7f5010 (bundled with PyVISA)
      Binary library: Not found
   py:
      Version: 0.7.2
      ASRL INSTR: Available via PySerial (3.5)
      TCPIP INSTR: Available
         Resource discovery:
         - VXI-11: partial (psutil not installed)
         - hislip: disabled (zeroconf not installed)
      TCPIP SOCKET: Available
      GPIB INSTR: Available via Linux GPIB (b'4.3.6')
      GPIB INTFC: Available via Linux GPIB (b'4.3.6')
      USB INSTR:
         Please install PyUSB to use this resource type.
         No module named 'usb'
      USB RAW:
         Please install PyUSB to use this resource type.
         No module named 'usb'
      VICP INSTR:
         Please install PyVICP to use this resource type.

@MatthieuDartiailh
Copy link
Member

You need to upgrade pyvisa-py to 0.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0