Initial commit: merge nuescan, pymso, pybbd202, and pypewpewhops into scanengine-3
- 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>
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script for FastFrame functionality.
|
||||
"""
|
||||
|
||||
from tektronix_base import TektronixOscilloscopeBase
|
||||
|
||||
|
||||
def main():
|
||||
"""Test FastFrame 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 FastFrame state
|
||||
print("Getting current FastFrame state...")
|
||||
current_state = scope.get_fastframe_state()
|
||||
print(f"✓ Current FastFrame state: {current_state} ({'active' if current_state else 'off'})\n")
|
||||
|
||||
# Get current frame count
|
||||
print("Getting current frame count...")
|
||||
current_count = scope.get_fastframe_count()
|
||||
print(f"✓ Current frame count: {current_count}\n")
|
||||
|
||||
# Test enabling FastFrame
|
||||
print("Enabling FastFrame...")
|
||||
scope.set_fastframe_state(1)
|
||||
state = scope.get_fastframe_state()
|
||||
print(f"✓ FastFrame state: {state} ({'active' if state else 'off'})\n")
|
||||
|
||||
# Test setting frame count
|
||||
print("Setting frame count to 100...")
|
||||
scope.set_fastframe_count(100)
|
||||
count = scope.get_fastframe_count()
|
||||
print(f"✓ Frame count: {count}\n")
|
||||
|
||||
# Test using boolean for state
|
||||
print("Testing boolean state (True)...")
|
||||
scope.set_fastframe_state(True)
|
||||
state = scope.get_fastframe_state()
|
||||
print(f"✓ FastFrame state: {state} ({'active' if state else 'off'})\n")
|
||||
|
||||
print("Testing boolean state (False)...")
|
||||
scope.set_fastframe_state(False)
|
||||
state = scope.get_fastframe_state()
|
||||
print(f"✓ FastFrame state: {state} ({'active' if state else 'off'})\n")
|
||||
|
||||
# Test different frame counts
|
||||
print("Testing different frame counts:")
|
||||
test_counts = [10, 50, 200, 500]
|
||||
for test_count in test_counts:
|
||||
print(f" Setting count to {test_count}...")
|
||||
scope.set_fastframe_count(test_count)
|
||||
actual_count = scope.get_fastframe_count()
|
||||
if actual_count == test_count:
|
||||
print(f" ✓ Verified: {actual_count}")
|
||||
else:
|
||||
print(f" ✗ Mismatch: expected {test_count}, got {actual_count}")
|
||||
|
||||
# Restore original settings
|
||||
print(f"\nRestoring original settings...")
|
||||
scope.set_fastframe_state(current_state)
|
||||
scope.set_fastframe_count(current_count)
|
||||
print(f"✓ Restored FastFrame state: {scope.get_fastframe_state()}")
|
||||
print(f"✓ Restored frame count: {scope.get_fastframe_count()}")
|
||||
|
||||
# Test invalid inputs
|
||||
print("\nTesting invalid state (should raise ValueError)...")
|
||||
try:
|
||||
scope.set_fastframe_state(2)
|
||||
print("✗ ERROR: Should have raised ValueError!")
|
||||
except ValueError as e:
|
||||
print(f"✓ Correctly raised ValueError: {e}")
|
||||
|
||||
print("\nTesting invalid frame count (should raise ValueError)...")
|
||||
try:
|
||||
scope.set_fastframe_count(-1)
|
||||
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}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
if scope.is_connected:
|
||||
scope.disconnect()
|
||||
print("\n✓ Disconnected from oscilloscope")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user