tektronix / tm_devices

Test & Measurement Device Management
https://tm-devices.readthedocs.io
Apache License 2.0
49 stars 21 forks source link

[BUG]: scope.commands.measurement.deleteall.write() can not work on MSO5 #280

Open HippeLv opened 3 months ago

HippeLv commented 3 months ago

Description of the bug

scope.write("MEASurement:DELete:ALL") scope.write("MEASUREMENT:DELETEALL") scope.commands.measurement.deleteall.write() scope.commands.measurement.delete.write(num_measurements) all the upper commends can't work effectively on MSO5

Steps To Reproduce

1.connect to the ocs using IP 2.set meausrement on the MSO5 3.run the upper commend to delete the measurement, none of them works.

from tm_devices import DeviceManager
from tm_devices.drivers import MSO5
from tm_devices.helpers import PYVISA_PY_BACKEND
import time

with DeviceManager(verbose=True) as device_manager:
    # Enable resetting the devices when connecting and closing
    device_manager.setup_cleanup_enabled = True
    device_manager.teardown_cleanup_enabled = True

    # Use the PyVISA-py backend
    device_manager.visa_library = PYVISA_PY_BACKEND

    # Creating Scope driver object by providing ip address.
    scope: MSO5 = device_manager.add_scope("192.168.1.100",alias="scope1") 
    print(scope) # print scope relagated information

    print("add measurement manually and then press Enter to continue...")
    input()

    time.sleep(2)

    list_measurements = scope.commands.measurement.list.query()
    print(list_measurements)
    num_measurements = len(scope.commands.measurement.list.query().split(","))
    print(num_measurements)
    try:
        #scope.write("MEASurement:DELete:ALL")  # CANNOT DELETE ALL MEASUREMENTS
        #scope.write("MEASUREMENT:DELETEALL")  # CANNOT DELETE ALL MEASUREMENTS
        #scope.commands.measurement.deleteall.write()  # CANNOT DELETE ALL MEASUREMENTS
        #scope.commands.measurement.delete.write(num_measurements)# CANNOT DELETE ALL MEASUREMENTS
    except Exception as e:
        print(f"Error executing command: {e}")
    print("Executing deleteall command...")
    time.sleep(200)        

Environment Information

No response

Additional Information

No response

nfelt14 commented 3 months ago

@HippeLv, can you edit the description to include the code as text instead of an image? That way it can be copy-pasted to verify and try to solve the issue.

HippeLv commented 3 months ago

delete all test case in scope.txt

all the commands in the try: part doesn't work.

nfelt14 commented 3 months ago

delete all test case in scope.txt

all the commands in the try: part doesn't work.

I copied the contents of the txt file into the main issue description.