Oscilloscope¶
Main oscilloscope control class for SCPI communication
Main Oscilloscope class for controlling Siglent oscilloscopes.
Supports multiple Siglent oscilloscope series including SDS800X HD, SDS1000X-E, SDS2000X Plus, and SDS5000X.
Oscilloscope
¶
Oscilloscope(host: str, port: int = 5024, timeout: float = 5.0, connection: Optional[BaseConnection] = None)
Main class for controlling Siglent oscilloscopes.
This class provides a high-level interface for controlling oscilloscope functions including channels, triggers, waveform acquisition, and measurements.
Supports multiple Siglent oscilloscope series with automatic model detection and capability-based feature availability.
Example
scope = Oscilloscope('192.168.1.100') scope.connect() print(scope.identify()) print(f"Model: {scope.model_capability.model_name}") print(f"Channels: {scope.model_capability.num_channels}") scope.disconnect()
Or using context manager:
with Oscilloscope('192.168.1.100') as scope: ... print(scope.identify())
Initialize oscilloscope connection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
IP address or hostname of the oscilloscope |
required |
port
|
int
|
TCP port for SCPI communication (default: 5024) |
5024
|
timeout
|
float
|
Command timeout in seconds (default: 5.0) |
5.0
|
connection
|
Optional[BaseConnection]
|
Optional custom connection object (uses SocketConnection if None) |
None
|
Note
Channels are created dynamically after connection based on model capabilities. Call connect() to establish connection and initialize channels.
Source code in scpi_control/oscilloscope.py
vector_display
property
¶
Access vector graphics display functionality.
Requires the 'fun' extras to be installed: pip install "Siglent-Oscilloscope[fun]"
Returns:
| Type | Description |
|---|---|
|
VectorDisplay instance for XY mode graphics |
Raises:
| Type | Description |
|---|---|
ImportError
|
If 'fun' extras are not installed |
Example
scope.vector_display.enable_xy_mode() circle = Shape.circle(radius=0.8) scope.vector_display.draw(circle)
is_connected
property
¶
Check if connected to oscilloscope.
Returns:
| Type | Description |
|---|---|
bool
|
True if connected, False otherwise |
device_info
property
¶
Get parsed device information.
Returns:
| Type | Description |
|---|---|
Optional[Dict[str, str]]
|
Dictionary with keys: manufacturer, model, serial, firmware |
Optional[Dict[str, str]]
|
None if not connected |
supported_channels
property
¶
Get list of supported channel numbers for this model.
Returns:
| Type | Description |
|---|---|
List[int]
|
List of channel numbers (e.g., [1, 2, 3, 4] for 4-channel model) |
List[int]
|
Empty list if not connected |
Example
scope.connect() print(scope.supported_channels) [1, 2, 3, 4]
connect
¶
Establish connection to the oscilloscope.
This method connects to the oscilloscope, detects the model, and initializes model-specific capabilities and channels.
Raises:
| Type | Description |
|---|---|
SiglentConnectionError
|
If connection fails |
SiglentTimeoutError
|
If connection times out |
Source code in scpi_control/oscilloscope.py
disconnect
¶
Close connection to the oscilloscope.
Source code in scpi_control/oscilloscope.py
write
¶
Send a SCPI command to the oscilloscope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
SCPI command string |
required |
Raises:
| Type | Description |
|---|---|
SiglentConnectionError
|
If not connected |
CommandError
|
If command contains invalid characters |
Source code in scpi_control/oscilloscope.py
query
¶
Send a SCPI query and get the response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
SCPI query command |
required |
Returns:
| Type | Description |
|---|---|
str
|
Response string from oscilloscope |
Raises:
| Type | Description |
|---|---|
SiglentConnectionError
|
If not connected |
SiglentTimeoutError
|
If query times out |
CommandError
|
If command contains invalid characters |
Source code in scpi_control/oscilloscope.py
read_raw
¶
Read raw binary data from oscilloscope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
Optional[int]
|
Number of bytes to read (None for all available) |
None
|
Returns:
| Type | Description |
|---|---|
bytes
|
Raw binary data |
Source code in scpi_control/oscilloscope.py
identify
¶
Get device identification string.
Returns:
| Type | Description |
|---|---|
str
|
Device identification string (manufacturer, model, serial, firmware) |
Example
'Siglent Technologies,SDS824X HD,SERIAL123,1.0.0.0'
Source code in scpi_control/oscilloscope.py
reset
¶
Reset oscilloscope to default settings.
Note: This may take several seconds to complete.
clear_status
¶
get_error
¶
Get the last error from the error queue.
Returns:
| Type | Description |
|---|---|
str
|
Error string (format: "code,description") |
wait_complete
¶
trigger_single
¶
trigger_force
¶
run
¶
stop
¶
set_timebase
¶
auto_setup
¶
get_waveform
¶
Acquire waveform data from a channel.
Convenience method that calls waveform.acquire().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
Channel number (1-4) |
required |
Returns:
| Type | Description |
|---|---|
WaveformData
|
WaveformData object with time and voltage arrays |
Source code in scpi_control/oscilloscope.py
get_channel
¶
Get channel object by number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_num
|
int
|
Channel number (1-based) |
required |
Returns:
| Type | Description |
|---|---|
Optional[Channel]
|
Channel object or None if channel doesn't exist |
Example
scope.connect() ch1 = scope.get_channel(1)
Source code in scpi_control/oscilloscope.py
See Also¶
- Channel - Channel configuration and control
- Trigger - Trigger configuration and modes
- Waveform - Waveform acquisition and data handling
- Measurement - Automated measurements (frequency, voltage, timing)
- Exceptions - Custom exception classes