fc43fbe4b0
- Merged four separate hardware control projects into unified platform - Created unified requirements.txt with all dependencies - Added comprehensive .gitignore - Added project overview README Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script for acquisition mode get/set functions.
|
|
"""
|
|
|
|
from tektronix_base import TektronixOscilloscopeBase
|
|
|
|
|
|
def main():
|
|
"""Test acquisition mode functions on oscilloscope at 192.168.10.105"""
|
|
|
|
scope_ip = "192.168.10.105"
|
|
|
|
print(f"Connecting to oscilloscope at {scope_ip}...")
|
|
|
|
scope = TektronixOscilloscopeBase(resource_name=scope_ip)
|
|
|
|
try:
|
|
# Connect to scope
|
|
scope.connect()
|
|
print(f"✓ Connected to {scope.identify()}\n")
|
|
|
|
# Get current acquisition mode
|
|
print("Getting current acquisition mode...")
|
|
current_mode = scope.get_acquire_mode()
|
|
print(f"✓ Current acquisition mode: {current_mode}\n")
|
|
|
|
# Test setting different acquisition modes
|
|
print("Testing acquisition mode changes:")
|
|
test_modes = ['SAMple', 'HIRes', 'AVErage', 'PEAKdetect', 'ENVelope']
|
|
|
|
for mode in test_modes:
|
|
print(f"\n Setting mode to: {mode}")
|
|
scope.set_acquire_mode(mode)
|
|
|
|
# Verify the change
|
|
actual_mode = scope.get_acquire_mode()
|
|
if actual_mode == mode:
|
|
print(f" ✓ Verified: {actual_mode}")
|
|
else:
|
|
print(f" ✗ Mismatch: expected {mode}, got {actual_mode}")
|
|
|
|
# Restore original mode
|
|
print(f"\nRestoring original mode: {current_mode}")
|
|
scope.set_acquire_mode(current_mode)
|
|
print(f"✓ Restored to: {scope.get_acquire_mode()}")
|
|
|
|
# Test invalid mode
|
|
print("\nTesting invalid mode (should raise ValueError)...")
|
|
try:
|
|
scope.set_acquire_mode("INVALID")
|
|
print("✗ ERROR: Should have raised ValueError!")
|
|
except ValueError as e:
|
|
print(f"✓ Correctly raised ValueError: {e}")
|
|
|
|
except Exception as e:
|
|
print(f"✗ Error: {type(e).__name__}: {e}")
|
|
finally:
|
|
if scope.is_connected:
|
|
scope.disconnect()
|
|
print("\n✓ Disconnected from oscilloscope")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|