#!/usr/bin/env python3 """ Simple test to verify basic waveform acquisition works. """ from tektronix_base import TektronixOscilloscopeBase def main(): """Test single waveform acquisition from CH1""" scope_ip = "192.168.10.105" print(f"Connecting to {scope_ip}...") scope = TektronixOscilloscopeBase(resource_name=scope_ip, timeout=15.0) try: scope.connect() print(f"āœ“ Connected to {scope.identify()}\n") # Check current settings print("Current settings:") print(f" Data encoding: {scope.get_data_encoding()}") print(f" Data source: {scope.get_data_source()}") print(f" Record length: {scope.get_record_length()}") print(f" FastFrame state: {scope.get_fastframe_state()}\n") # Ensure FastFrame is off if scope.get_fastframe_state(): print("Disabling FastFrame...") scope.set_fastframe_state(False) # Set data source to CH1 print("Setting data source to CH1...") scope.set_data_source('CH1') # Try to acquire a single waveform print("\nAttempting to acquire waveform from CH1...") print("(This will timeout if the scope isn't responding properly)\n") waveform = scope.acquire_waveform('CH1') print(f"āœ“ SUCCESS! Acquired {len(waveform)} samples") print(f" First 10 values: {waveform[:10]}") print(f" Min: {min(waveform)}, Max: {max(waveform)}") print(f" Average: {sum(waveform)/len(waveform):.2f}") except Exception as e: print(f"\nāœ— Error: {type(e).__name__}: {e}") import traceback traceback.print_exc() finally: if scope.is_connected: scope.disconnect() print("\nāœ“ Disconnected") if __name__ == "__main__": main()