Plot Utility

Plot Utility#

The plot utility provides a simple way to visualize analog and digital signals from Logic MSO captures. This utility is primarily intended for debugging and quick visualization purposes - it is not meant to be a fully-featured plotting solution. For advanced plotting needs, consider using matplotlib directly or other specialized plotting libraries.

Features#

  • Plot analog signals with voltage levels and trigger thresholds

  • Plot digital signals below, one per plot

  • Slice the time window for the plot as desired

  • Add vertical lines to mark things in time

Usage#

from pathlib import Path
from saleae import mso_api
from saleae.mso_api.utils.plot import plot_capture, PlotMarker

# Load a capture
cap_dir = Path("path/to/capture")
capture = mso_api.Capture.from_dir(cap_dir)

# Optional: Create markers for important events
markers = [
    PlotMarker(time=0.001),
    PlotMarker(time=0.002)
]

# Plot the capture
plot_capture(
    capture=capture,
    save_to=Path("debug_plot.png"),
    start_time=0.000,  # Optional: Start time in seconds
    stop_time=0.005,   # Optional: Stop time in seconds
    title="My Capture", # Optional: Plot title
    markers=markers    # Optional: List of markers
)

Parameters#

  • capture (Capture): The capture object to plot

  • save_to (Path): Where to save the plot image

  • start_time (float, optional): Start time in seconds for the plot window

  • stop_time (float, optional): Stop time in seconds for the plot window

  • title (str, optional): Title for the plot

  • markers (list[PlotMarker], optional): List of markers to show on the plot