dso_math module
Perform math operations on the DSO.
Basic signal processing functions, including dual-waveform math, FFT, and advanced math.
Typical usage example:
import dso2ke as gds
# Create a Dso instance, myDso, and get connected to it.
myDso = gds.Dso()
ret = myDso.connect(host='localhost', port=3000)
if ret != 0:
raise ValueError('Socket connection failed.')
myDso.math.set_math_on() # Trun on MATH
# Run dual-waveform math as CH1*CH1
myDso.math.run_dual_wfrm_math('CH1*CH1')
myDso.math.set_dual_wfrm_math_scale_and_pos(0.5, 1.0)
# Run FFT with default hann window and decibel output
myDso.math.run_fft('CH1')
# FFT using hamming window
myDso.math.run_fft('CH1', window = kHammingWin)
# Run advanced math
myDso.math.run_advanced_math('CH1+CH1')
myDso.math.set_math_off() # Trun off MATH
myDso.close() # Clean-up
- class dso_math.Math(parent=None)
Bases:
objectThis module controls the math function on the DSO.
- is_math_on() bool
Check status of MATH display
- Returns:
True if MATH display is ‘ON’, False otherwise.
- run_advanced_math(equation: str) None
Run advanced math
- Parameters:
equation (str) – equation for the advanced math.
- run_fft(source: str, window: int = kFFT_WINDOWS_DEF, unit: int = kFFT_UNITS_DEF)
Run FFT processing
- Parameters:
source (str) – analog or reference soruce. e.g. ‘CH1’ or ‘REF1’
window (int, optional) – window function used by FFT. kRectWin for Rectangular kHammingWin for Hamming kHanningWin for Hann(default) kBlackmanWin for Blackman
unit (int, optional) – unit of the FFT magnitude kUnit_db for dB(default) kUnit_Lin for Linear RMS
- set_advanced_math_scale_and_pos(scale: float, pos: float) None
Set advanced math scale and position ofsets
- set_dual_wfrm_math_scale_and_pos(scale: float, pos: float) None
Set dual waveform math scale and position ofsets
- dso_math.dual_wfrm_math_parser(equation: str)
Parsing an input equation for the dual waveform math
- Parameters:
equation (str) – such as ‘CH1+CH2’
- Returns:
see examples below.
- Return type:
match
Examples :
>>> match = dso_math.dual_wfrm_math_parser('CH1+CH2') >>> print([ match.group(i+1) for i in range(3) ]) ['CH1', '+', 'CH2']
- dso_math.is_fft_source_valid(source: str) bool
A valid source for FFT processing is CH<x> or REF<x>
- Parameters:
source (str) – input for FFT analysis
- Returns:
True if the input is supported by FFT. False otherwise.