Convert, transform, analyze, and plot real oscilloscope captures.
Converts Rigol oscilloscope CSV and WFM exports to:
- PWL (piece-wise linear) files for LTspice, Cadence, ngspice, and other SPICE simulators.
- MATLAB vectors for numerical analysis and further processing.
- Mono WAV files in 32-bit floating-point or 16-bit PCM format.
- NumPy arrays and archives for Python-based processing.
Supports multi-channel captures, channel selection, and channel math.
For convenient waveform processing, it provides an ordered transformation pipeline, measurements, and FFT analysis, and optional SVG plots.
Written in Swift as a compiled native binary for high performance; runs on Windows, macOS, and Linux.
Input format is detected from the file contents, not its filename extension.
| Format | Oscilloscope families |
|---|---|
| Legacy Rigol CSV | Legacy Rigol oscilloscopes |
| Centaurus CSV | Newer Centaurus-platform oscilloscopes, including DHO800/DHO900 |
| Rigol WFM | DS1000B, DS1000C, DS1000D/E, DS1000Z, DS2000/MSO2000, DS4000/MSO4000 |
DHO .wfm, logic-only WFM payloads, and Rigol .trc files are not supported.
Download the latest release, then:
rigol2spice.exe input.csv output.txtThe output .txt file can be loaded directly as a PWL source in LTspice and other SPICE simulators.
WFM captures use the same command:
rigol2spice.exe capture.wfm output.txt| Format | Output | Requirements |
|---|---|---|
pwl (default) |
Tab-separated timestamp/value pairs for SPICE | None |
matlab |
MATLAB column vector points containing vertical values |
None |
wav32 |
Mono 32-bit IEEE floating-point WAV | Finite values in -1...1; at least two uniformly spaced samples at a whole-number sampling rate |
wav16 |
Mono signed 16-bit PCM WAV | Finite values in -1...1; at least two uniformly spaced samples at a whole-number sampling rate |
npy |
One-dimensional little-endian Float64 array of vertical values | None |
npz |
Uncompressed archive with little-endian Float64 arrays timestamps and values |
None |
SPICE:
* LtSpice
V1 n+ n- PWL file="output.txt"
* PSpice
V1 n+ n- PWL(FILE="output.txt")
* HSpice
V1 n+ n- PWL PWLFILE="output.txt"
* Ngspice
V1 n+ n- PWL file output.txt
* QUCS-S
V1 n+ n- PWL file=output.txt
MATLAB:
run("output.m");
plot(points);NumPy:
import numpy as np
values = np.load("output.npy")
capture = np.load("output.npz")
timestamps = capture["timestamps"]
values = capture["values"]List available channels in a capture with -l or --list-channels:
rigol2spice.exe -l input.csvSelect a specific channel (default is CH1) with -c or -channel:
rigol2spice.exe -c CH2 input.csv output.txtCombine channels with +, -, *, and / (standard precedence; parentheses allowed). Transformations then apply to the result:
rigol2spice.exe -c "CH1+CH2" input.csv output.txt
rigol2spice.exe -c "(CH1-CH2)/CH3" input.csv output.txt
rigol2spice.exe -c "CH1-CH2" -t "RemoveDC" input.csv output.txtDecode UART, I²C, and SPI signals directly from analogue capture channels. UART accepts an explicit baud rate or automatic detection:
rigol2spice.exe capture.wfm --decode "UART rx=CH2, baud=115200, threshold=1.65"Set baud=auto to estimate the baud rate from the captured signal:
rigol2spice.exe capture.wfm --decode "UART rx=CH2, baud=auto, threshold=1.65"An explicit baud rate is preferable when it is known. Automatic detection requires enough clean transitions in the capture to determine the bit period reliably. threshold is the analogue voltage used to distinguish low and high logic levels.
I²C requires SDA and SCL. It reports START/repeated-START transactions, 7-bit addresses, read/write direction, bytes, and ACK/NACK:
rigol2spice.exe capture.wfm --decode "I2C sda=CH1, scl=CH2, threshold=1.65" --decode-format csv --decode-output i2c.csvUse sda-threshold and scl-threshold instead of the shared threshold when the channels use different logic levels.
SPI supports modes 0–3, MSB/LSB-first words, optional chip select, and either or both data directions:
rigol2spice.exe capture.wfm --decode "SPI clk=CH1, mosi=CH2, miso=CH3, cs=CH4, mode=0, bits=8, threshold=1.65" --decode-format csv --decode-output spi.csvorder defaults to msb; cs-active defaults to low. Omit cs for captures that contain only the intended transfer. Every relevant protocol channel receives the same ordered transformations before decoding. The output-only --downsample step runs later and therefore cannot alter decoded frames.
When --decode and --plot are combined, the SVG includes a time-aligned protocol lane below the waveform. UART bytes and parity/framing errors, I²C addresses/data/ACK status, and SPI MOSI/MISO words are labelled over their decoded time intervals; each interval also includes an SVG tooltip. Decoded values below 0x80 also show their ASCII representation. Printable characters appear directly (0x48 · ASCII "H"); control characters use escapes such as \n, \r, \t, or \x1B.
Use --decode-format to select the decoder output and --decode-output to write it to a file:
rigol2spice.exe capture.wfm --decode "UART rx=CH2, baud=115200, threshold=1.65" --decode-format csv --decode-output uart.csv
rigol2spice.exe capture.wfm --decode "UART rx=CH2, baud=auto, threshold=1.65" --decode-format bin --decode-output uart.bin| Decode format | Output |
|---|---|
text (default) |
Human-readable decoded events, including timing and UART status information |
csv |
The same event information as text, represented as CSV with a header row |
bin |
Raw decoded octets, with no text, timestamps, headers, separators, or error metadata |
Text and CSV output include the same ASCII representation for decoded values below 0x80. I²C address bytes are not presented as ASCII because they encode the address and R/W bit rather than payload data.
For UART, bin contains valid frames only. For I²C it contains data bytes and omits address bytes. For SPI it contains MOSI words, or MISO when MOSI is absent. SPI words wider than eight bits cannot be represented by bin; use text or CSV instead. Use text or CSV when timing, addressing, acknowledgement, or error details need to be retained.
If --decode-output is omitted, text and csv are written to standard output. Binary output requires --decode-output, preventing raw bytes from being mixed with the normal console report.
Pass an ordered list of transformation commands with -t or --transformations. Separate commands with semicolons or line breaks (CR, LF, or CRLF); empty commands and blank lines are ignored. Enclose the complete string in double quotes for the Windows command line:
rigol2spice.exe input.csv output.txt -t "RemoveDC; ClampMax 0.7; Offset -1.2"Use -tf or --transformations-file to read the same command text from a UTF-8 file. If -t is also present, file commands run first and inline commands follow:
rigol2spice.exe input.csv output.txt -tf transforms.txt -t "Normalize"Commands use the syntax OPERATION argument. Operation names are case-insensitive. Scalars accept decimal (0.7), engineering (3n, 10u), and scientific (5e-3) notation. Use - for negative values. Transformations run strictly from left to right.
| Operation | Example | Effect |
|---|---|---|
RemoveDC |
RemoveDC · RemoveDC Avg · RemoveDC Median · RemoveDC Mid |
Estimate and subtract the DC component¹ |
Offset |
Offset -1.5 |
Add the scalar to every value |
Min0 |
Min0 |
Shift so the lowest sample is 0 (subtract min) |
AddNoise |
AddNoise 10m |
Add zero-mean Gaussian noise with standard deviation equal to the scalar |
TVDenoise |
TVDenoise 50m |
1D total variation denoising with weight λ (piecewise-constant bias; preserves edges)⁶ |
Multiply |
Multiply 10 |
Multiply every value by the scalar |
Invert |
Invert |
Multiply every value by −1 (alias of Multiply -1) |
PeakTo |
PeakTo 3.3 |
Scale so the peak absolute value equals the scalar |
PeakToPeak |
PeakToPeak 2 |
Scale so max − min equals the scalar |
Normalize |
Normalize |
Alias of PeakToPeak 1 |
ScaleRMS |
ScaleRMS 707m |
Scale so the sample RMS equals the scalar |
dB |
dB 6 |
Scale amplitude by the given voltage dB (×10^(dB/20)) |
dBmW |
dBmW 10 · dBmW 0, 75 |
× volts for that power into R Ω (e.g. 10 dBm @ 50 Ω ≈ 0.707 V)³ |
dBm |
dBm 10 |
Alias of dBmW |
dBW |
dBW 0 · dBW -30 |
Same as dBmW but relative to 1 W (0 dBW = 30 dBm ≈ 7.07 V @ 50 Ω)³ |
| Operation | Example | Effect |
|---|---|---|
ClampMin |
ClampMin 0 |
Clamp values below the scalar |
ClampMax |
ClampMax 3.3 |
Clamp values above the scalar |
Limit |
Limit -0.7, 0.7 |
Clamp values between low and high |
Gate |
Gate 0.6 |
Zero values below the threshold; keep the rest |
DeadZone |
DeadZone 0.1 |
Zero values inside ±threshold; keep the rest |
Digitize |
Digitize 1.5 · Digitize 1.5, 0, 3.3 · Digitize 1.2, 1.8, 0, 3.3 |
Map each sample to one of two levels (hard threshold or Schmitt)⁵ |
Threshold |
Threshold 1.5 |
Alias of Digitize |
SlewLimit |
SlewLimit 100M |
Limit |
SoftClip |
SoftClip -0.7, 0.7 |
Soft-clip into [low, high] via tanh |
Fade |
Fade 100n |
Linear fade-in and fade-out over the given duration |
FadeIn |
FadeIn 50n |
Linear fade-in only |
FadeOut |
FadeOut 50n |
Linear fade-out only |
Quantize |
Quantize 8, 3.3 · Quantize 8, -1, 1 |
Round to N-bit levels over [0, full-scale] or [low, high] |
Abs |
Abs |
Replace every value with its absolute value |
Rectify |
Rectify |
Half-wave rectify (keep values ≥ 0, zero the rest) |
| Operation | Example | Effect |
|---|---|---|
TimeShift |
TimeShift -5m |
Shift timestamps; negative values shift left |
TimeScale |
TimeScale 2 · TimeScale 0.5 |
Scale the time axis (preserve start time) |
Seamless |
Seamless · Seamless 100n |
Force last value = first (or append a ramp of the given duration) |
MatchEnds |
MatchEnds |
Alias of Seamless |
Pad |
Pad 5m · Pad 5m, 0 |
Extend by a duration, holding the last value (or a given level) |
HoldLast |
HoldLast 5m |
Alias of Pad |
PadPoints |
PadPoints 100 · PadPoints 100, 0 |
Append exactly N samples, holding the last value (or a given level) |
HoldLastPoints |
HoldLastPoints 100 |
Alias of PadPoints |
ExtendTo |
ExtendTo 10m · ExtendTo 10m, 0 |
Extend to an absolute end time, holding the last value (or a given level) |
ExtractPeriod |
ExtractPeriod · ExtractPeriod 0.5 |
Keep one cycle from the first rising crossing (auto or given threshold); shift to t=0 |
CutBefore |
CutBefore 5m |
Discard samples before the timestamp and shift the first retained sample to t=0 |
CutAfter |
CutAfter 10u |
Discard samples at or after the timestamp |
DropLast |
DropLast 10u |
Remove samples inside the final duration; retain a sample exactly on the start boundary |
DropLastPoints |
DropLastPoints 10 |
Remove exactly the final N sample points |
Trim |
Trim 1m, 10m |
Keep samples with start ≤ t < end and shift the first retained sample to t=0 |
Repeat |
Repeat 2.5 |
Append copies of the capture⁴ |
Oversample |
Oversample 5 |
Divide the capture into 5 equal segments and average their aligned samples |
Forecast |
Forecast 5m · Forecast 5m, 500 |
Automatically choose a forecast model and append a duration, optionally using an exact number of samples |
Oversample N performs coherent ensemble averaging for a repeating capture. The sample count
must be exactly divisible by N. It returns one segment starting at t=0, preserves the original
sample interval, and averages each output value from the N corresponding segment values. If the
division is not exact, the error reports how many samples—and how much capture time—to add or
remove. Segment alignment is essential: drift or a non-repeating signal will blur the result.
Forecast duration[, samples] is a self-contained forecast: it trains on the current waveform and appends
uniformly spaced future samples, so no model file or extra dependency is needed. It automatically
backtests causal temporal convolution, repeating-pattern, linear-trend, stable-mean, and hold-last
strategies on a known part of the capture. The best strategy is retrained on the complete capture;
the console reports its name and a 0–100% backtest confidence. Confidence below 20% also emits a
warning and uses a conservative competitive forecast. It works best when the capture contains
several examples of the pattern to predict. The input must contain at least 8 finite samples.
Forecast aligns data by sample position and uses the average interval between the first and last
timestamps for its output, so small or deliberate timestamp irregularities are accepted. Long,
chaotic, or changing signals remain inherently uncertain, so treat the result as an estimate.
| Field | Description |
|---|---|
| Syntax | ResampleF frequency[, interpolation] |
| Frequency | Target sampling frequency; accepts engineering notation |
| Result | Creates a uniform grid whose samples are exactly 1 / frequency seconds apart |
| Timestamps | Preserves the first timestamp and stops at the last complete interval inside the original capture |
| Interpolation | linear (default), pchip, sinc |
| Field | Description |
|---|---|
| Syntax | Downsample factor[, interpolation] |
| Factor | Must be greater than 1 and may be fractional |
| Result | Reduces the point count to original count / factor, rounded to the nearest sample |
| Timestamps | linear and sinc preserve both endpoints; fast retains original timestamps and only preserves the final timestamp when it belongs to the selection sequence |
| Interpolation | linear (default), sinc, fast |
| Field | Description |
|---|---|
| Syntax | Upsample factor[, interpolation] |
| Factor | Must be greater than 1 and may be fractional |
| Result | Increases the point count to original count × factor, rounded to the nearest sample |
| Timestamps | Preserves both endpoints and the capture duration |
| Interpolation | linear (default), pchip, sinc |
| Interpolation | Behavior |
|---|---|
linear (default) |
Interpolate linearly between adjacent samples; fastest and suitable for most PWL workflows |
pchip |
Monotonic piecewise-cubic interpolation; produces smoother curves without overshooting monotonic data |
sinc |
Finite windowed-sinc interpolation; best suited to sufficiently sampled, band-limited signals |
fast |
Select original samples at source positions 0, factor, 2 × factor, and so on; performs no interpolation |
Scalar arguments accept an optional physical-unit suffix after the engineering prefix. The unit is ignored, so Pad 5ms is equivalent to Pad 5m, and ResampleF 10MHz is equivalent to ResampleF 10M. Engineering prefixes remain case-sensitive (m is milli and M is mega).
ResampleF and the Downsample transformation do not apply an anti-alias low-pass filter automatically when reducing the sampling frequency. Add LowPass earlier in the transformation chain when anti-alias filtering is required. The post-processing option --downsample N is separate: it reduces only a converted signal output, after transformations, analyses, and protocol decoding have used the full processed waveform.
Trigger transformations find an event using interpolated crossings between samples and align the resulting waveform. Directions are rising, falling, or either where supported. An optional final after argument ignores events before that capture time.
| Operation | Example | Effect |
|---|---|---|
Trigger |
Trigger 0.5 · Trigger rising, auto · Trigger falling, 50%, 2m |
Shift the first level crossing to t=0 |
TriggerSchmitt |
TriggerSchmitt rising, 1.4, 1.8 · TriggerSchmitt falling, 1.4, 1.8, 2m |
Arm at the opposite hysteresis level, then trigger at the requested edge |
TriggerNth |
TriggerNth rising, 0.5, 3 · TriggerNth either, auto, 5, 2m |
Shift the Nth matching crossing to t=0 |
TriggerCapture |
TriggerCapture rising, 0.5, 100u, 500u |
Keep the requested pre/post window around a level crossing; optional fifth argument is search-after |
TriggerWindow |
TriggerWindow rising, 0.5, 100u, 500u |
Alias of TriggerCapture |
TriggerPulse |
TriggerPulse high, 0.5, 10u · TriggerPulse low, 0.5, 10u, 20u |
Trigger at the start of a complete high/low pulse meeting a minimum or inclusive min/max width |
TriggerBand |
TriggerBand enter, 1, 2 · TriggerBand exit, 1, 2, 5m |
Trigger on enter, exit, rising above, or falling below a band |
TriggerSlew |
TriggerSlew rising, 10, 90, 500k · TriggerSlew falling, 10, 90, 100k, 500k |
Trigger at the start of a percentage-level transition meeting a minimum or inclusive min/max slew rate |
TriggerDropout |
TriggerDropout rising, 0.5, 2m · TriggerDropout either, auto, 2m, 5m |
Trigger when no matching edge occurs for the duration after an initial edge |
TriggerRunt |
TriggerRunt rising, 1, 2, 20u |
Rising: cross low but return/fail to reach high; falling: cross high but return/fail to reach low |
Levels may be numeric, auto, or a percentage such as 50% for Trigger, TriggerNth, TriggerCapture, TriggerPulse, and TriggerDropout. auto is the midpoint of the oscilloscope-style Top and Base; P% is that percentage of the same span.
Most triggers discard samples before the aligned event. TriggerCapture deliberately preserves context before it:
rigol2spice.exe input.csv output.txt -t "TriggerCapture rising, auto, 100u, 500u"This keeps up to 100 µs before and 500 µs after the event. The output starts at t=0, so the trigger normally occurs at t=100 µs. The pre/post window is clipped to the samples available in the original capture.
| Operation | Example | Effect |
|---|---|---|
LowPass |
LowPass 1k |
Apply a low-pass filter² |
HighPass |
HighPass 100 |
Apply a high-pass filter² |
BandPass |
BandPass 900, 1.1k |
Apply a band-pass filter² |
BandStop |
BandStop 48, 52 |
Apply a band-stop filter² |
Notch |
Notch 50, 4 |
Reject a narrow band with a zero-phase IIR biquad² |
MovingAverage |
MovingAverage 5 |
Centered moving average over N samples |
Median |
Median 5 |
Centered median filter over N samples (spike-resistant) |
Detrend |
Detrend |
Remove the least-squares linear trend (slope and offset) |
Diff |
Diff |
Numerical derivative dv/dt |
Integrate |
Integrate |
Cumulative trapezoidal integral (starts at 0) |
For a capture with baseline drift and 50 Hz interference, both operations can be applied in one pass:
rigol2spice.exe input.csv output.txt -t "Detrend; Notch 50, 4"¹ RemoveDC subtracts a DC estimate. Optional method (same names as analysis measurements; case-insensitive):
| Method | Meaning |
|---|---|
DC (default; aliases Cluster, KMeans) |
1D k-means with k = 3 on finite sample values; several deterministic initializations; pick smallest squared error; DC = midpoint of lower and upper centroids |
Avg (aliases Average, Mean) |
Arithmetic mean of sample values |
Median |
Median of sample values |
Mid (alias Midpoint) |
Midpoint of min/max: (max + min) / 2 |
Bare RemoveDC is equivalent to RemoveDC DC.
² Filters are automatic zero-phase IIRs built from stable biquad sections and applied forwards and backwards. LowPass and HighPass use a 16th-order Butterworth response per pass (effective 32nd-order magnitude response); BandPass combines both in series, and BandStop sums independent high-order low-pass and high-pass paths outside the rejected band. Notch uses eight compensated sections with zeros exactly at its center frequency, which remains effective for extremely narrow low-frequency rejection at high sample rates. Their cost is O(N) and does not grow when the requested frequency is small relative to the sample rate. The supplied cutoff or band edges are approximately −3 dB after the two passes. Frequencies must be greater than 0 and below Nyquist (fs/2); band and notch edges must satisfy 0 < f1 < f2 < fs/2.
³ dBmW and dBW convert an absolute power level to a voltage scale factor: V = √(P · R), with P = 1 mW · 10^(dBmW/10) or P = 1 W · 10^(dBW/10). Optional second argument is load impedance in ohms (default 50). Unlike dB, these are not relative gains — they multiply the waveform by that absolute voltage (useful for unit-amplitude templates).
⁴ Repeat requires a value greater than zero and accepts fractional repetitions; its final point is interpolated when needed.
⁵ Digitize turns an analog capture into a two-level digital PWL. Argument forms:
| Form | Meaning |
|---|---|
Digitize T |
Hard threshold: output 1 when the sample is ≥ T, else 0 |
Digitize T, low, high |
Same compare, but output low / high instead of 0 / 1 |
Digitize fall, rise, low, high |
Schmitt trigger: go high when the sample is ≥ rise, go low when ≤ fall; stay put while between the two (hysteresis). fall and rise may be given in either order |
The first sample seeds the state (≥ rise → high, otherwise low). With a single threshold the compare is hard (no band between levels). Use hysteresis when the analog edge is noisy so the digital output does not chatter.
⁶ TVDenoise λ solves min_x ½‖x − y‖² + λ · TV(x) with TV(x) = Σ |xᵢ₊₁ − xᵢ| (Condat’s direct 1D algorithm). Larger λ flattens plateaus more aggressively while keeping large jumps; λ = 0 is a no-op. λ has the same units as the sample amplitude. Not an inverse of AddNoise.
The analog modulation transformations turn the current waveform into a carrier-modulated signal while preserving timestamps and sample count. AM automatically centers and peak-normalizes its message to −1…1 because its argument is a dimensionless modulation depth. FM and PM deliberately use the sample values unchanged, allowing earlier transformations such as RemoveDC, Offset, Multiply, or PeakTo to define the desired message scale.
| Operation | Example | Effect |
|---|---|---|
AM |
AM 100k, 0.8 · AM 100k, 0.8, 2 |
Amplitude modulation: carrier frequency, modulation depth, and optional carrier amplitude (default 1) |
FM |
FM 100k, 10k · FM 100k, 10k, 2 |
Frequency modulation: carrier frequency, sensitivity in Hz per input unit (normally Hz/V), and optional carrier amplitude (default 1) |
PM |
PM 100k, 1.2 · PM 100k, 1.2, 2 |
Phase modulation: carrier frequency, sensitivity in radians per input unit (normally rad/V), and optional carrier amplitude (default 1) |
DemodAM |
DemodAM 100k, 0.8, 20k |
Recover AM baseband: carrier frequency, modulation depth, and baseband low-pass cutoff |
DemodFM |
DemodFM 100k, 10k, 20k |
Recover FM input units: carrier frequency, sensitivity in Hz/unit, and quadrature low-pass cutoff |
DemodPM |
DemodPM 100k, 1.2, 20k |
Recover PM input units: carrier frequency, sensitivity in rad/unit, and quadrature low-pass cutoff |
For FM, the instantaneous frequency is carrier + sensitivity × value; a sensitivity of 10k applied to a ±2 V message therefore produces a ±20 kHz frequency deviation. For PM, the phase offset is sensitivity × value. The FM instantaneous frequency must remain above 0 and below Nyquist. PM changes can also alias if the signal produces phase changes that are too fast for the sample rate.
ModulateAM, ModulateFM, and ModulatePM are aliases of the short modulation names. AMDemod, FMDemod, and PMDemod are aliases of the corresponding demodulators. Demodulation uses coherent quadrature mixing followed by the automatic zero-phase low-pass filter, so its carrier and sensitivity parameters should match the modulator. Its cutoff must cover the occupied modulated baseband while remaining below both the carrier and its distance from Nyquist. A carrier-frequency error appears as a DC error in FM; an unknown carrier phase appears as a DC ambiguity in PM. For AM, depths up to 1 avoid overmodulation; values above 1 are accepted deliberately.
For example, modulate a captured message in FM and then recover its baseband:
rigol2spice.exe input.csv fm.txt -t "RemoveDC; PeakTo 1; FM 100k, 10k, 2"
rigol2spice.exe fm-capture.csv recovered.txt -t "DemodFM 100k, 10k, 20k"Pass measurement commands with -a or --analysis. Syntax matches -t (commands separated by semicolons or CR/LF/CRLF line breaks; empty commands and blank lines ignored; case-insensitive; engineering scalars). Results print to the console with one fractional digit and combine the engineering prefix with the physical unit, for example 2.4ms, 8.4mV, 1.2MV/s, or 2mW. Signal amplitudes are reported in volts; ratios such as duty cycle and THD are displayed as percentages, while crest factor uses ×. Analyses always run after transformations on the full processed waveform, before the output-only --downsample step. When -a is used, the PWL output file is optional (same as -l / -p).
Use -af or --analysis-file to read analysis from a UTF-8 file. When combined with -a, file analysis come first, so dependents such as an inline THD can reuse an FFT declared in the file.
rigol2spice.exe input.csv -a "Max; Min; RMS; PkPk; Frequency"
rigol2spice.exe input.csv output.txt -t "RemoveDC" -a "DC; Avg; FrequencyAtZero"
rigol2spice.exe input.csv -p -a "FFT 1024; Frequency"
rigol2spice.exe input.csv -a "Basic; Timing"Frequently used measurements are also available as presets. A preset expands to the listed analyses and can be mixed with individual operations or other presets:
| Preset | Expansion |
|---|---|
Basic |
All operations in Capture and Amplitude & level below (aliases omitted) |
Timing |
All operations in Timing below that accept no arguments (FrequencyAt omitted) |
Spectrum |
FFT; THD |
WaveType |
SineWaveType; SquareWaveType; SawtoothWaveType; TriangleWaveType (requires a preceding FFT) |
For example, -a "Basic; SlewRise" prints the basic summary followed by the rising-edge slew rate. Preset names, like all analysis operations, are case-insensitive.
| Operation | Example | Result |
|---|---|---|
Duration |
Duration |
Capture time span t_last − t_first |
Points |
Points |
Number of samples |
SampleRate |
SampleRate |
Estimated sample rate (N−1) / Duration |
Interval |
Interval |
Mean sample interval 1 / SampleRate |
Start |
Start |
First sample timestamp |
End |
End |
Last sample timestamp |
| Operation | Example | Result |
|---|---|---|
Max |
Max |
Maximum sample value |
Min |
Min |
Minimum sample value |
HiPeak |
HiPeak |
Alias of Max |
LowPeak |
LowPeak |
Alias of Min |
PkPk |
PkPk |
Peak-to-peak (max − min, same as PeakToPeak) |
Peak |
Peak |
Peak absolute value max|v| (same as PeakTo) |
Amplitude |
Amplitude |
Half of peak-to-peak (PkPk / 2) |
Mid |
Mid |
Midpoint of min/max: (max + min) / 2 |
Avg |
Avg |
Arithmetic mean of sample values |
DC |
DC |
DC estimate (same default k-means method as bare RemoveDC)¹ |
RMS |
RMS |
Sample RMS (same definition as ScaleRMS) |
ACRms |
ACRms |
AC RMS: √max(0, RMS² − Avg²) |
StdDev |
StdDev |
Population standard deviation (same value as ACRms) |
Stdev |
Stdev |
Alias of StdDev |
Crest |
Crest |
Crest factor: peak absolute / RMS |
Median |
Median |
Median sample value |
PeakTime |
PeakTime |
Timestamp of the first maximum sample |
MinTime |
MinTime |
Timestamp of the first minimum sample |
MeanAbs |
MeanAbs |
Arithmetic mean of the absolute sample values |
Top |
Top |
Upper histogram mode (scope-style high level) |
Base |
Base |
Lower histogram mode (scope-style low level) |
Overshoot |
Overshoot |
(max − Top) / (Top − Base) (fraction) |
Undershoot |
Undershoot |
(Base − min) / (Top − Base) (fraction) |
| Operation | Example | Result |
|---|---|---|
FrequencyAt |
FrequencyAt 0 · FrequencyAt 1.5 |
Average period/frequency of complete waves at that level (rise+fall crossings; first wave needs 3 crossings, each next wave +2, sharing the boundary; partial start/end ignored) |
FrequencyAtZero |
FrequencyAtZero |
Same as FrequencyAt 0 |
Frequency |
Frequency |
Same as FrequencyAt at the min/max midpoint (Mid) |
RiseTime |
RiseTime · RiseTime 20, 80 |
First rising edge time from low% to high% of min/max span (default 10 → 90) |
FallTime |
FallTime · FallTime 20, 80 |
First falling edge time from high% to low% of min/max span (default 90 → 10 via the same percent pair) |
SlewRise |
SlewRise · SlewRise 20, 80 |
First rising-edge slew rate Δv/Δt over the same percentage levels as RiseTime (default 10 → 90) |
SlewFall |
SlewFall · SlewFall 20, 80 |
First falling-edge slew rate Δv/Δt over the same percentage levels as FallTime (default 90 → 10; reported as a positive magnitude) |
PulseWidth |
PulseWidth · PulseWidth 0.5 |
Average high pulse width (rise→fall) at threshold (default Avg) |
LowPulseWidth |
LowPulseWidth · LowPulseWidth 0.5 |
Average low pulse width (fall→rise) at threshold (default Avg) |
Duty |
Duty · Duty 0.5 |
Average duty cycle as a fraction 0…1 (high time / period) at threshold (default Avg) |
EdgeCount |
EdgeCount · EdgeCount 0 |
Number of level crossings at threshold (default Avg) |
RiseCount |
RiseCount · RiseCount 0 |
Number of rising crossings at threshold (default Avg) |
FallCount |
FallCount · FallCount 0 |
Number of falling crossings at threshold (default Avg) |
Jitter |
Jitter · Jitter 0 |
Std. dev. of complete-wave periods at threshold (default Avg; needs ≥ 2 periods) |
PeriodStd |
PeriodStd |
Alias of Jitter |
PeriodMin |
PeriodMin · PeriodMin 0 |
Minimum complete-wave period at threshold (default Avg) |
PeriodMax |
PeriodMax · PeriodMax 0 |
Maximum complete-wave period at threshold (default Avg) |
PeriodPkPk |
PeriodPkPk · PeriodPkPk 0 |
Range of complete-wave periods (max − min) at threshold (default Avg) |
| Operation | Example | Result |
|---|---|---|
Integral |
Integral |
Trapezoidal ∫v dt over the capture |
Power |
Power · Power 75 |
Mean RMS power Vrms²/R in watts (default 50 Ω) |
Energy |
Energy · Energy 50 |
Trapezoidal ∫v²/R dt in joules (default 1 Ω, preserving the original bare Energy) |
dBm |
dBm · dBm 75 |
RMS power in dBm into R Ω (default 50): 10·log₁₀(Vrms²/R / 1mW) |
| Operation | Example | Result |
|---|---|---|
FFT |
FFT · FFT 1024 · FFT 1024, middle · FFT 1024, end |
Calculate and retain a real FFT for subsequent spectral analysis |
THD |
THD |
Total harmonic distortion from the retained FFT: √(Σ Aₕ²) / A₁ for harmonics 2…10; displayed as a percentage |
Fundamental |
Fundamental |
Frequency and Hann-corrected peak amplitude of the retained FFT's strongest AC component |
Harmonic |
Harmonic 3 |
Hann-corrected peak amplitude of harmonic N of the retained FFT fundamental |
SineWaveType |
SineWaveType |
Similarity to a sinusoid: fundamental with no ideal higher harmonics |
SquareWaveType |
SquareWaveType |
Similarity to a 50% square wave: odd harmonics proportional to 1/n |
SawtoothWaveType |
SawtoothWaveType |
Similarity to a sawtooth: every harmonic proportional to 1/n; SawWaveType is an alias |
TriangleWaveType |
TriangleWaveType |
Similarity to a triangle wave: odd harmonics proportional to 1/n² |
WaveType |
WaveType |
Preset that runs all four wave-type similarity analysis |
FFT-dependent analysis are sequential. THD, Fundamental, Harmonic, and all wave-type analysis must appear after an FFT in the same analysis list; otherwise parsing fails. They reuse that exact spectrum instead of calculating another FFT and therefore do not accept a point-count argument:
rigol2spice.exe input.csv -a "FFT 1024, middle; THD; Fundamental; Harmonic 3"
rigol2spice.exe input.csv -a "FFT 4096, start; WaveType"If another FFT appears later, subsequent dependent analysis use the new result. Other analysis between them do not discard the retained spectrum.
FFT syntax is FFT [points][, position]. The position may be start, middle, or end; start is the default. The position can also be supplied without a point count (FFT middle), although it only changes the selected samples when the requested window is shorter than the capture. If the capture has fewer than the requested number of points, all available samples are used.
Before the FFT, the selected values have their mean removed and receive a Hann window. They are then zero-padded to the next power of two. The reported peak is the strongest local AC maximum with sub-bin refinement. Console output includes the actual point count and window position; -p adds the retained magnitude spectrum in dB to the SVG plot. Its axes use rounded 1–2–5 frequency divisions, labeled dB grid lines, and a maximum 120 dB visual range; the title also shows the FFT bin resolution Δf.
Wave-type analysis compares measured harmonic-amplitude ratios, up to harmonic 10 or Nyquist, with the four ideal profiles above. SineWaveType is max(0, 100% − THD%) over those harmonics. Each other score is 100% minus the harmonic-profile vector error relative to the energy of its ideal higher harmonics, limited to 0–100%. The four scores are independent and are not normalized to sum to 100%. This allows an unknown waveform to score poorly in every analysis and an ambiguous waveform to match more than one profile. At least the third harmonic must fit below Nyquist. Noise, PWM duty cycles other than 50%, clipping, asymmetry, frequency drift, too few periods, analogue bandwidth, and spectral leakage can reduce the match. The classifier deliberately uses magnitudes rather than phase, making it insensitive to time reversal and waveform polarity.
| Option | Effect |
|---|---|
-d, --downsample N |
Reduce only the converted signal output by factor N, after transformations, analyses, and decoding |
-k, --keep-all |
Disable removal of redundant (collinear) points |
-p, --plot [file] |
Write an SVG plot of the processed signal (default: plot.svg) |
The plot uses 1 pixel per sample, auto-scaled Y (min / avg / max markers), and decade-spaced X time markers. When -a is combined with -p, analysis results are listed in a text block under the time plot (not drawn over the waveform). When --decode is combined with -p, a time-aligned decoded-protocol lane is added below the time plot. An FFT analysis also appends a spectrum panel (dB vs frequency, peak marker). A console warning is emitted above 10 000 points (use a Downsample transformation or a shorter time window when the plot itself should contain fewer samples).
USAGE: rigol2spice.exe [<options>] <input-file> [<output-file>]
OPTIONS:
-l, --list-channels List channels and exit
-c, --channel <channel> Channel or math expression (default: CH1)
-t, --transformations <value> Ordered transformations separated by semicolons or line breaks
-tf, --transformations-file <value>
Read transformations from a file before inline commands
-a, --analysis <value> Ordered analyses separated by semicolons or line breaks; FFT dependants follow FFT
-af, --analysis-file <value> Read analyses from a file before inline commands
--decode <value> Decode UART, I2C, or SPI signals
--decode-format <format> Decoder output: text, csv, or bin (default: text)
--decode-output <file> Write decoded output to a file
-d, --downsample <ratio> Downsample ratio for the converted signal output
-f, --format <format> Output format: pwl, matlab, wav32, wav16, npy, or npz (default: pwl)
-k, --keep-all Keep all sample points
-p, --plot [<file>] Write SVG plot (default: plot.svg)
-h, --help Show help
output-file is optional with -l, -p, -a, -af, or --decode.
Requires Swift 6.2+.
git submodule update --init --recursive
swift buildBuilds on macOS, Windows, and Linux.
Special thanks to Scott Prahl, author of RigolWFM, for publishing the reverse-engineering research and Kaitai Struct schema that made DS1000Z WFM support possible.
This is an independent project, not affiliated with Rigol Technologies, Inc.
