Available on: Flexs Q5C

scope.getWaveform()

scope.getWaveform(options) → capture | false

Captures a waveform on a channel and optionally computes an FFT with band-pass filtering and envelope demodulation.

Performs a capture and prepares the spectrum that subsequent scope.getPeak() and scope.getAmplitudes() calls will read from. The single argument is an options object:

Option Type Meaning
ch number Input channel index (e.g. 0).
osr number Oversampling ratio — controls the effective sample rate / bandwidth (e.g. 64, 128, 4096). Higher OSR = lower bandwidth, finer low-frequency resolution.
size number Number of samples in the capture (e.g. 2048, 4096). More samples = finer frequency bins.
fft boolean Compute an FFT of the capture.
bandpass boolean Apply a band-pass filter between fMin and fMax before analysis.
fMin number (Hz) Lower frequency bound. Setting 3–4 kHz on an enveloped capture filters for just bearing faults.
fMax number (Hz) Upper frequency bound.
demod boolean Enable envelope demodulation (amplitude demodulation), the standard technique for exposing repetitive bearing-impact frequencies.
demodRatio number Demodulation ratio (e.g. 32, 64).

Capture recipes from the factory examples:

High-frequency capture for lubrication-film health (degraded lubrication causes metal-to-metal contact producing high-frequency vibration):

scope.getWaveform({ "ch":0, "osr":64, "size":4096, "fft":true,
                    "bandpass":false, "fMin":0, "fMax":12000,
                    "demod":false, "demodRatio":1 });

Enveloped capture for bearing fault diagnosis:

scope.getWaveform({ "ch":0, "osr":64, "size":2048, "fft":true,
                    "bandpass":true, "fMin":500, "fMax":32000,
                    "demod":true, "demodRatio":64 });

Narrow capture around line frequency for precise speed measurement:

scope.getWaveform({ "ch":0, "osr":4096, "size":4096, "fft":true,
                    "bandpass":false, "fMin":120, "fMax":190,
                    "demod":false, "demodRatio":8 });

The return value is truthy on a successful capture — check it before trusting the amplitudes extracted afterwards, and log the value on failure.

Arguments

NameTypeRequiredDefaultDescription
options object yes Capture configuration — see the option table in the description.

Returns

capture | false Truthy capture handle on success, false/error value on a failed capture.

Example

let cap = scope.getWaveform({ "ch": 0, "osr": 64, "size": 2048, "fft": true,
  "bandpass": true, "fMin": 500, "fMax": 32000, "demod": true, "demodRatio": 64 });

if(cap){
  // spectrum ready — use scope.getPeak / scope.getAmplitudes
} else {
  print("Failed capture:", cap);
}