Skip to content
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

[BUG]: scope.commands.ch[<channel>].probe.selfcal.state.query() incorrectly expects an argument #297

Open
jpritcha-tektronix opened this issue Sep 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jpritcha-tektronix
Copy link

Description of the bug

This bug appears to be the result of the documentation being incorrect. This query does not support an argument.
image

Steps To Reproduce

NOTE: Reproducing this bug does not require a probe supporting selfcal connected to the instrument. The valid query will always return PASSED on any channel without a probe.

  1. Using the query without an argument:
from tm_devices import DeviceManager
from tm_devices.drivers import MSO6
from tm_devices.helpers import PYVISA_PY_BACKEND

with DeviceManager(verbose=False) as dm:
    # Enable resetting the devices when connecting and closing
    dm.setup_cleanup_enabled = True
    dm.teardown_cleanup_enabled = True
    # Use the PyVISA-py backend
    dm.visa_library = PYVISA_PY_BACKEND

    scope: MSO6 = dm.add_scope("mso64-qu100004", alias="scope1")
    print(scope.commands.ch[1].probe.selfcal.state.query())

Results in an error from tm_devices:
builtins.TypeError: SCPICmdReadWithArguments.query() missing 1 required positional argument: 'argument'

  1. Using the query with the documented argument:
from tm_devices import DeviceManager
from tm_devices.drivers import MSO6
from tm_devices.helpers import PYVISA_PY_BACKEND
import pyvisa

with DeviceManager(verbose=False) as dm:
    # Enable resetting the devices when connecting and closing
    dm.setup_cleanup_enabled = True
    dm.teardown_cleanup_enabled = True
    # Use the PyVISA-py backend
    dm.visa_library = PYVISA_PY_BACKEND

    scope: MSO6 = dm.add_scope("mso64-qu100004", alias="scope1")
    try:
        print(scope.commands.ch[1].probe.selfcal.state.query("EXECUTE"))
    except pyvisa.errors.Error:
        esr = scope.ieee_cmds.esr()
        allev = scope.commands.allev.query()
        raise RuntimeError(f"{esr}, {allev}")

Results in a visa timeout (query does not return)
Catching this and then checking ESR/ALLEV shows that the query does not allow a parameter:
ESR: 32, ALLEV: 108,"Parameter not allowed; Too many parameters; CH1:PRObe:SELFCal:State? E"

  1. Using the raw PI query:
from tm_devices import DeviceManager
from tm_devices.drivers import MSO6
from tm_devices.helpers import PYVISA_PY_BACKEND
import pyvisa

with DeviceManager(verbose=False) as dm:
    # Enable resetting the devices when connecting and closing
    dm.setup_cleanup_enabled = True
    dm.teardown_cleanup_enabled = True
    # Use the PyVISA-py backend
    dm.visa_library = PYVISA_PY_BACKEND

    scope: MSO6 = dm.add_scope("mso64-qu100004", alias="scope1")
    print(scope.query("CH1:PROBE:SELFCAL:STATE?"))

Results in PASSED being printed

Environment Information

No response

Additional Information

No response

@jpritcha-tektronix jpritcha-tektronix added the bug Something isn't working label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant