configure_math
Configure a math waveform trace on an oscilloscope by setting operator, sources, scaling, FFT, or filter parameters. Omitted items stay unchanged, enabling partial updates to compute a new trace from acquired channels.
Instructions
Configure a math (waveform arithmetic) trace. Omitted items are left unchanged.
This computes a new trace inside the instrument from channels already being acquired; it changes nothing about the acquisition itself and drives no output. channel is the math trace 1-4 (see get_capabilities math_channels). Specify at least one item to change. Read the result back with get_math_state, and fetch the trace with capture_waveform(channel="MATH1").
operator is add / subtract / multiply / divide / and / or / xor / not / fft / integrate / differentiate / sqrt / log10 / ln / exp / abs / lowpass / highpass / bandpass / bandstop / axb.
source1 and source2 are the operands of the arithmetic operators: "CH1"-"CH4", "REF1"-"REF10", or another math trace "MATH1"-"MATH4". A math trace may only use a LOWER-numbered one (MATH2 can read MATH1, never MATH2 or MATH3), so cascade upwards. lsource1 and lsource2 are the operands of the logic operators (and / or / xor / not) and take "D0"-"D15" or "CH1"-"CH4" instead. scale is the vertical scale per division and offset_v the vertical offset in volts of the resulting trace; invert flips it vertically.
fft is a dict for the fft operator, with any of: source (the input channel of the FFT - this is what selects it, not source1), window (rectangle / blackman / hanning / hamming / flattop / triangle), unit (vrms / db), mode (normal / average / maxhold), average_count (2-1000), scale and offset (vertical, in the unit above), freq_start_hz and freq_end_hz (the displayed span in hertz), search_enabled (bool, turns the instrument's peak table on), search_num (how many peaks), search_threshold and search_excursion (in the vertical unit), and search_order (amplitude / frequency). Read the peaks themselves back with get_math_state.
filter is a dict for the lowpass / highpass / bandpass / bandstop operators, with any of: type (lowpass / highpass / bandpass / bandstop), w1_hz and w2_hz (the cut-off frequencies in hertz; w1 must be below w2 for bandpass and bandstop).
Which parameters are valid depends on the operator, and the instrument enforces that: scale and offset_v do not exist for the logic operators or for fft (fft has its own scale and offset inside the fft dict), and a rejected write is reported as an error. Set the operator in the same call as its parameters. The device may snap values, so trust applied (the read-back value), not requested.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fft | No | ||
| scale | No | ||
| filter | No | ||
| invert | No | ||
| channel | No | ||
| display | No | ||
| source1 | No | ||
| source2 | No | ||
| lsource1 | No | ||
| lsource2 | No | ||
| offset_v | No | ||
| operator | No |