With an unchanged square-wave source and termination, the oscilloscope’s bandwidth setting can change the way it records the same transition. The measured edge may grow longer because the instrument attenuates more of the high-frequency content that forms the edge. The low and high plateaus can stay at nearly the same voltage. This experiment holds the source, cable and termination fixed and measures the change using raw samples from one channel.
Compare three acquisitions at full bandwidth, three at 20 MHz, then three at full bandwidth again. Measure every rising edge between 10% and 90% of its own voltage swing. The included traces are calculated or synthetic.
Before connecting any input or output cables, connect the RIGOL DHO804's rear Ground Terminal to earth ground using the supplied ground cable, as required by the DHO800 User Guide. Its Type-C power input does not ground the instrument through the power cord. Use the supplied power adapter. Keep the AFG1022's protective earth connected. The coax cable shields provide the signal references described below; they do not replace this required chassis earth lead.
2249-C-24, a 24 inch RG58C/U coaxial cable with BNC male connections at both ends. BNC stands for Bayonet Neill–Concelman, the bayonet-style coaxial connector. Plug its first end into the generator's female output.011-0049-02 50 Ω feed-through terminator, then plug the male end directly into the RIGOL DHO804 channel 1 input. The terminator includes a 50 Ω path from center to shell. The center conductor also goes through to the scope. This part is rated 50 Ω ±1 Ω, direct current to 1 GHz, 2 W average under its stated conditions. A centered 1.00 V peak-to-peak ideal square sits at about ±0.50 V, so the nominal resistor dissipation is 0.50² ÷ 50 = 5 mW.
Bandwidth describes how much of the faster signal content the scope passes. The manufacturer's data sheet specifies 70 MHz analog bandwidth for the DHO804 and a typical 10–90% rise time of 5 ns or less under its conditions. The 20 MHz menu setting deliberately attenuates more of the fast components. Tektronix's AFG1022 performance manual gives a typical square-wave rise and fall time below 12 ns at 1 V peak-to-peak. The edge you capture includes both the source transition and the scope response.
Call the median low plateau L and the median high plateau H. The two voltage thresholds are V10 = L + 0.10(H − L) and V90 = L + 0.90(H − L). Subtract the two crossing times, tr = t90 − t10. With L = −0.50 V and H = +0.50 V, the thresholds are −0.40 and +0.40 V. A change in trigger position shifts both times together and can leave their difference unchanged.
A familiar estimate is tr ≈ 0.35 ÷ BW for a smooth response of the type underlying that approximation. At 20 MHz it gives about 17.5 ns as a scale. The factor depends on the shape of the response, and the input signal has finite rise time. Even a theoretical convolution needs an assumed response. For example, two Gaussian-shaped responses with 8 ns and 17.5 ns rise times would give about 19.2 ns in combination. The example illustrates a possible size of effect. The comparison evaluates the observed timing directly.
| Setting | Median | Swing |
|---|---|---|
| FULL | 9.484 ns | 1.00 V |
| 20 MHz | 19.267 ns | 1.00 V |
| Restored | 9.535 ns | 1.00 V |
full-1.csv through full-3.csv. Use the same scales, trigger and cable path throughout. Verify a new acquisition each time.limited-1.csv through limited-3.csv. Set FULL again and take three fresh acquisitions as restore-1.csv through restore-3.csv. This return to the starting setting checks for a shift from the generator or connection. Do not adjust the source to make the edges agree.time_s,voltage_v with values in seconds and volts. Preserve the time order and original sample spacing. Use the same cropping rule for all nine captures.Download the column template, complete analyzer or archive of synthetic samples and tests. The command takes nine distinct paths in order of capture, with three paths for each setting. Use Python 3.8 or later and the standard library.
python3 scope_edge.py full-1.csv full-2.csv full-3.csv limited-1.csv limited-2.csv limited-3.csv restore-1.csv restore-2.csv restore-3.csv
python3 scope_edge.py synthetic/full-1.csv synthetic/full-2.csv synthetic/full-3.csv synthetic/limited-1.csv synthetic/limited-2.csv synthetic/limited-3.csv synthetic/restore-1.csv synthetic/restore-2.csv synthetic/restore-3.csv
The analyzer takes the first and last 20% of each record as plateau references. It requires one upward crossing each at 10%, 50% and 90%, with the whole rise well inside the record. It estimates the time between adjacent samples by linear interpolation. If ringing or noise causes ambiguous threshold recrossings, repeat with the original condition after checking the measurement path. The code also checks range, raw spacing, plateau stability and a minimum number of samples in the measured transition.
The experiment requires each setting's rise times to be repeatable, the high and low plateau references to stay within 0.05 V across all files, and the restored median to be within the greater of 1.6 ns or 20% of the original median. The 20 MHz median must exceed both full medians by at least 3 ns and at least 25%. Those are the limits for this comparison. A successful result shows the effect of this setting on the recorded edge. Inferring the exact source edge, instrument calibration or filter response needs a different measurement.
Exit 0 qualifies the comparison. Exit 1 means the input files or paths are invalid. Exit 2 indicates an unresolved control or a missing command-line argument. If the sample gap is too large, check actual sample rate and disable the other channels. If the restoration fails, inspect the generator, terminations and acquisition settings first.
#!/usr/bin/env python3
"""Compare 10–90% rise times in nine raw scope traces of one unchanged source."""
import argparse
import csv
import io
import math
import os
import statistics
from pathlib import Path
MODES = ("full", "limited", "restore")
HEADER = ["time_s", "voltage_v"]
BYTES_MAX = 1048576
ROUNDING = 1e-9
TIMING_ROUNDING_NS = 1e-6
class Unresolved(ValueError):
"""A readable trace failed a comparison or measurement gate."""
def within(value, low, high, margin=ROUNDING):
return low - margin <= value <= high + margin
def load_trace(path):
with path.open("rb") as stream:
data = stream.read(BYTES_MAX + 1)
if len(data) > BYTES_MAX:
raise ValueError(f"{path}: CSV exceeds one MiB")
reader = csv.reader(io.StringIO(data.decode("utf-8-sig"), newline=""), strict=True)
if next(reader, None) != HEADER:
raise ValueError(f"{path}: expected time_s,voltage_v")
result = []
for count, row in enumerate(reader, 1):
if count > 20000 or len(row) != 2:
raise ValueError(f"{path}: row count or number of fields exceeded")
time, voltage = map(float, row)
if not all(map(math.isfinite, (time, voltage))):
raise ValueError(f"{path}: nonfinite field")
if abs(time) > 1 or abs(voltage) > .85 + ROUNDING:
raise Unresolved("times exceed ±1 s or raw voltage exceeds ±0.85 V")
result.append((time, voltage))
if len(result) < 120:
raise Unresolved("a capture requires at least 120 raw samples")
origin = result[0][0]
return [(1e9 * (time - origin), voltage) for time, voltage in result]
def crossing(rows, level):
times = [
a + (b - a) * (level - low) / (high - low)
for (a, low), (b, high) in zip(rows, rows[1:])
if low < level <= high
]
if len(times) != 1:
raise Unresolved("a threshold has no single upward crossing")
return times[0]
def measure(rows):
gaps = [b[0] - a[0] for a, b in zip(rows, rows[1:])]
if any(not 0 < value <= 1.25 + TIMING_ROUNDING_NS for value in gaps):
raise Unresolved("timestamps must increase with gaps no greater than 1.25 ns")
span = rows[-1][0]
if not within(span, 145, 420, TIMING_ROUNDING_NS):
raise Unresolved("keep a 145–420 ns raw window containing one rising edge")
before = [voltage for time, voltage in rows if time <= .20 * span]
after = [voltage for time, voltage in rows if time >= .80 * span]
low, high = statistics.median(before), statistics.median(after)
swing = high - low
if not within(swing, .80, 1.20):
raise Unresolved("rising voltage swing lies outside 0.80–1.20 V")
if max(max(levels) - min(levels) for levels in (before, after)) > .04 * swing + ROUNDING:
raise Unresolved("a low/high reference plateau is unstable")
t10, t50, t90 = [crossing(rows, low + fraction * swing) for fraction in (.10, .50, .90)]
if not .22 * span < t10 < t50 < t90 < .78 * span:
raise Unresolved("the complete rising edge must be in the middle of the record")
rise = t90 - t10
supports = sum(t10 <= time <= t90 for time, _ in rows)
if supports < 4 or not within(rise, 4, 45, TIMING_ROUNDING_NS):
raise Unresolved("edge is out of the 4–45 ns range or has fewer than four in-edge samples")
return rise, low, high
def comparison(paths):
saved = {}
print("setting median_ns min_ns max_ns low_V high_V")
for index, label in enumerate(MODES):
found = []
for path in paths[index * 3:index * 3 + 3]:
try:
found.append(measure(load_trace(path)))
except Unresolved as error:
raise Unresolved(f"{label} ({path}): {error}") from error
rises, lows, highs = zip(*found)
median = statistics.median(rises)
if max(rises) - min(rises) > max(1.6, .15 * median) + TIMING_ROUNDING_NS:
raise Unresolved(f"{label}: the three rise times are not repeatable")
saved[label] = (median, lows, highs)
print(f"{label:<9} {median:10.3f} {min(rises):9.3f} {max(rises):9.3f}"
f" {statistics.median(lows):8.4f} {statistics.median(highs):8.4f}")
lows = [low for _, levels, _ in saved.values() for low in levels]
highs = [high for _, _, levels in saved.values() for high in levels]
if any(max(levels) - min(levels) > .05 + ROUNDING for levels in (lows, highs)):
raise Unresolved("the captured low or high plateau shifted by more than 0.05 V")
full, limited, restore = (saved[label][0] for label in MODES)
if not all(within(value, 4, 18, TIMING_ROUNDING_NS) for value in (full, restore)):
raise Unresolved("full-bandwidth reference medians must lie within 4–18 ns")
if abs(restore - full) > max(1.6, .20 * full) + TIMING_ROUNDING_NS:
raise Unresolved("the full-bandwidth timing did not return")
baseline = max(full, restore)
if limited < max(baseline + 3, baseline * 1.25) - TIMING_ROUNDING_NS:
raise Unresolved("20 MHz capture did not meet the required increase in rise time")
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("file", type=Path, nargs=9,
help="three FULL, then three 20 MHz, then three restored FULL CSV files")
args = parser.parse_args()
try:
if len({os.path.realpath(path) for path in args.file}) != 9:
raise ValueError("pass nine distinct capture paths")
comparison(args.file)
except Unresolved as error:
print(f"UNRESOLVED: {error}")
return 2
except (ValueError, OSError, csv.Error) as error:
print(f"INPUT ERROR: {error}")
return 1
print("QUALIFIED: the 20 MHz setting lengthened the measured transition and FULL restored it.")
return 0
if __name__ == "__main__":
raise SystemExit(main())
The plateaus change slowly compared with the edge. Limiting high-frequency content spreads the transition in time, while steady low and high voltages can still settle to nearly the same values in this DC-coupled setup. This is why the procedure measures both plateau voltage and timing.