Math Channel¶
Math channel operations and expressions
Math channel operations for waveform analysis.
MathOperations
¶
Static methods for mathematical operations on waveforms.
add
staticmethod
¶
Add two waveforms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform1
|
First waveform |
required | |
waveform2
|
Second waveform |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with voltage = v1 + v2 |
Source code in scpi_control/math_channel.py
subtract
staticmethod
¶
Subtract two waveforms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform1
|
First waveform |
required | |
waveform2
|
Second waveform |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with voltage = v1 - v2 |
Source code in scpi_control/math_channel.py
multiply
staticmethod
¶
Multiply two waveforms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform1
|
First waveform |
required | |
waveform2
|
Second waveform |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with voltage = v1 * v2 |
Source code in scpi_control/math_channel.py
divide
staticmethod
¶
Divide two waveforms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform1
|
First waveform (numerator) |
required | |
waveform2
|
Second waveform (denominator) |
required | |
epsilon
|
Small value to prevent division by zero |
1e-12
|
Returns:
| Type | Description |
|---|---|
|
Result waveform with voltage = v1 / v2 |
Source code in scpi_control/math_channel.py
integrate
staticmethod
¶
Integrate a waveform (cumulative sum).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform
|
Input waveform |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with integrated values |
Source code in scpi_control/math_channel.py
differentiate
staticmethod
¶
Differentiate a waveform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform
|
Input waveform |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with differentiated values |
Source code in scpi_control/math_channel.py
scale
staticmethod
¶
Scale a waveform by a constant factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform
|
Input waveform |
required | |
factor
|
Scaling factor |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with voltage = v * factor |
Source code in scpi_control/math_channel.py
offset
staticmethod
¶
Add a DC offset to a waveform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform
|
Input waveform |
required | |
offset_value
|
Offset to add |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with voltage = v + offset |
Source code in scpi_control/math_channel.py
abs_value
staticmethod
¶
Absolute value of a waveform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform
|
Input waveform |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with voltage = |v| |
Source code in scpi_control/math_channel.py
invert
staticmethod
¶
Invert a waveform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform
|
Input waveform |
required |
Returns:
| Type | Description |
|---|---|
|
Result waveform with voltage = -v |
Source code in scpi_control/math_channel.py
MathChannel
¶
Math channel for performing operations on oscilloscope waveforms.
Supports expressions like: - "C1 + C2" - "C1 - C2" - "C1 * C2" - "C1 / C2" - "INTG(C1)" - integrate - "DIFF(C1)" - differentiate - "ABS(C1)" - absolute value - "INV(C1)" - invert - "2 * C1 + 1" - scale and offset
Initialize math channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope
|
Parent oscilloscope instance |
required | |
name
|
str
|
Math channel name (e.g., "M1", "M2") |
required |
Source code in scpi_control/math_channel.py
set_expression
¶
Set the math expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expression
|
str
|
Math expression string |
required |
Source code in scpi_control/math_channel.py
enable
¶
disable
¶
compute
¶
Compute the math channel result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveforms
|
Dict[str, any]
|
Dictionary of channel_name -> waveform |
required |
Returns:
| Type | Description |
|---|---|
Optional[any]
|
Computed waveform or None if disabled/error |
Source code in scpi_control/math_channel.py
get_result
¶
See Also¶
- Oscilloscope - Main oscilloscope control class for SCPI communication
- Waveform - Waveform acquisition and data handling