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 plotsave_to
(Path): Where to save the plot imagestart_time
(float, optional): Start time in seconds for the plot windowstop_time
(float, optional): Stop time in seconds for the plot windowtitle
(str, optional): Title for the plotmarkers
(list[PlotMarker], optional): List of markers to show on the plot