Coverage for src / tracekit / visualization / __init__.py: 100%
25 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-11 23:04 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-11 23:04 +0000
1"""Visualization module for TraceKit.
3Provides plotting functions for waveforms, spectra, and other signal data,
4plus optimization utilities, style presets, and intelligent rendering.
7Example:
8 >>> from tracekit.visualization import plot_waveform, plot_spectrum
9 >>> from tracekit.visualization import plot_timing, plot_eye
10 >>> from tracekit.visualization import plot_bode, plot_histogram
11 >>> from tracekit.visualization import apply_style_preset
12 >>> import matplotlib.pyplot as plt
13 >>> with apply_style_preset("publication"):
14 ... plot_waveform(trace, time_unit="us")
15 ... plt.savefig("figure.pdf")
16"""
18# Import plot module as namespace for DSL compatibility
19from tracekit.visualization import plot
20from tracekit.visualization.accessibility import (
21 FAIL_SYMBOL,
22 LINE_STYLES,
23 PASS_SYMBOL,
24 KeyboardHandler,
25 add_plot_aria_attributes,
26 format_pass_fail,
27 generate_alt_text,
28 get_colorblind_palette,
29 get_multi_line_styles,
30)
32# Phase 30 enhancements
33from tracekit.visualization.annotations import (
34 Annotation as EnhancedAnnotation,
35)
36from tracekit.visualization.annotations import (
37 PlacedAnnotation as EnhancedPlacedAnnotation,
38)
39from tracekit.visualization.annotations import (
40 create_priority_annotation,
41 filter_by_zoom_level,
42 place_annotations,
43)
44from tracekit.visualization.axis_scaling import (
45 calculate_axis_limits,
46 calculate_multi_channel_limits,
47 suggest_tick_spacing,
48)
49from tracekit.visualization.colors import (
50 COLORBLIND_SAFE_QUALITATIVE,
51 DIVERGING_COOLWARM,
52 SEQUENTIAL_VIRIDIS,
53 select_optimal_palette,
54)
55from tracekit.visualization.digital import (
56 plot_logic_analyzer,
57 plot_timing,
58)
59from tracekit.visualization.eye import (
60 plot_bathtub,
61 plot_eye,
62)
63from tracekit.visualization.histogram import (
64 calculate_bin_edges,
65 calculate_optimal_bins,
66)
67from tracekit.visualization.interactive import (
68 CursorMeasurement,
69 ZoomState,
70 add_measurement_cursors,
71 enable_zoom_pan,
72 plot_bode,
73 plot_histogram,
74 plot_phase,
75 plot_waterfall,
76 plot_with_cursors,
77)
78from tracekit.visualization.layout import (
79 Annotation,
80 ChannelLayout,
81 PlacedAnnotation,
82 layout_stacked_channels,
83 optimize_annotation_placement,
84)
85from tracekit.visualization.optimization import (
86 InterestingRegion,
87 calculate_grid_spacing,
88 calculate_optimal_x_window,
89 calculate_optimal_y_range,
90 decimate_for_display,
91 detect_interesting_regions,
92 optimize_db_range,
93)
94from tracekit.visualization.presets import (
95 DARK_THEME_PRESET,
96 IEEE_DOUBLE_COLUMN_PRESET,
97 IEEE_PUBLICATION_PRESET,
98 VisualizationPreset,
99 apply_preset,
100 get_preset_colors,
101)
102from tracekit.visualization.presets import (
103 create_custom_preset as create_custom_visualization_preset,
104)
105from tracekit.visualization.presets import (
106 list_presets as list_visualization_presets,
107)
108from tracekit.visualization.render import (
109 RenderPreset,
110 apply_rendering_config,
111 configure_dpi_rendering,
112)
113from tracekit.visualization.rendering import (
114 StreamingRenderer,
115 downsample_for_memory,
116 estimate_memory_usage,
117 progressive_render,
118 render_with_lod,
119)
120from tracekit.visualization.specialized import (
121 ProtocolSignal,
122 StateTransition,
123 plot_protocol_timing,
124 plot_state_machine,
125)
126from tracekit.visualization.spectral import (
127 plot_fft,
128 plot_psd,
129 plot_spectrogram,
130 plot_spectrum,
131)
132from tracekit.visualization.styles import (
133 PRESENTATION_PRESET,
134 PRINT_PRESET,
135 PUBLICATION_PRESET,
136 SCREEN_PRESET,
137 StylePreset,
138 apply_style_preset,
139 create_custom_preset,
140)
141from tracekit.visualization.thumbnails import (
142 render_thumbnail,
143 render_thumbnail_multichannel,
144)
145from tracekit.visualization.time_axis import (
146 TimeUnit,
147 calculate_major_ticks,
148 convert_time_values,
149 create_relative_time,
150 format_cursor_readout,
151 format_time_labels,
152 select_time_unit,
153)
154from tracekit.visualization.waveform import (
155 plot_multi_channel,
156 plot_waveform,
157 plot_xy,
158)
160__all__ = [
161 "COLORBLIND_SAFE_QUALITATIVE",
162 "DARK_THEME_PRESET",
163 "DIVERGING_COOLWARM",
164 "FAIL_SYMBOL",
165 "IEEE_DOUBLE_COLUMN_PRESET",
166 "IEEE_PUBLICATION_PRESET",
167 "LINE_STYLES",
168 "PASS_SYMBOL",
169 "PRESENTATION_PRESET",
170 "PRINT_PRESET",
171 "PUBLICATION_PRESET",
172 "SCREEN_PRESET",
173 "SEQUENTIAL_VIRIDIS",
174 "Annotation",
175 # Layout functions (VIS-015, VIS-016)
176 "ChannelLayout",
177 # Interactive (VIS-008)
178 "CursorMeasurement",
179 # Phase 30: Enhanced modules
180 "EnhancedAnnotation",
181 "EnhancedPlacedAnnotation",
182 "InterestingRegion",
183 "KeyboardHandler",
184 "PlacedAnnotation",
185 "ProtocolSignal",
186 "RenderPreset",
187 "StateTransition",
188 "StreamingRenderer",
189 "StylePreset",
190 "TimeUnit",
191 "VisualizationPreset",
192 # Interactive (VIS-007)
193 "ZoomState",
194 # Interactive (VIS-008)
195 "add_measurement_cursors",
196 "add_plot_aria_attributes",
197 "apply_preset",
198 "apply_rendering_config",
199 # Styles
200 "apply_style_preset",
201 "calculate_axis_limits",
202 "calculate_bin_edges",
203 "calculate_grid_spacing",
204 "calculate_major_ticks",
205 "calculate_multi_channel_limits",
206 # Histogram
207 "calculate_optimal_bins",
208 "calculate_optimal_x_window",
209 # Optimization functions (VIS-013, VIS-014, VIS-019, VIS-020, VIS-022)
210 "calculate_optimal_y_range",
211 # Rendering functions (VIS-017)
212 "configure_dpi_rendering",
213 "convert_time_values",
214 "create_custom_preset",
215 "create_custom_visualization_preset",
216 "create_priority_annotation",
217 "create_relative_time",
218 "decimate_for_display",
219 "detect_interesting_regions",
220 "downsample_for_memory",
221 # Interactive (VIS-007)
222 "enable_zoom_pan",
223 "estimate_memory_usage",
224 "filter_by_zoom_level",
225 "format_cursor_readout",
226 "format_pass_fail",
227 "format_time_labels",
228 "generate_alt_text",
229 # Accessibility (ACC-001, ACC-002, ACC-003)
230 "get_colorblind_palette",
231 "get_multi_line_styles",
232 "get_preset_colors",
233 "layout_stacked_channels",
234 "list_visualization_presets",
235 "optimize_annotation_placement",
236 "optimize_db_range",
237 "place_annotations",
238 "plot",
239 # Eye diagram (VIS-006)
240 "plot_bathtub",
241 # Interactive (VIS-010)
242 "plot_bode",
243 "plot_eye",
244 # Spectral plotting
245 "plot_fft",
246 # Interactive (VIS-012)
247 "plot_histogram",
248 # Digital visualization (VIS-005)
249 "plot_logic_analyzer",
250 "plot_multi_channel",
251 # Interactive (VIS-009)
252 "plot_phase",
253 "plot_protocol_timing",
254 "plot_psd",
255 "plot_spectrogram",
256 "plot_spectrum",
257 "plot_state_machine",
258 "plot_timing",
259 # Interactive (VIS-011)
260 "plot_waterfall",
261 # Waveform plotting
262 "plot_waveform",
263 # Interactive (VIS-008)
264 "plot_with_cursors",
265 "plot_xy",
266 "progressive_render",
267 # Thumbnails
268 "render_thumbnail",
269 "render_thumbnail_multichannel",
270 "render_with_lod",
271 # Colors
272 "select_optimal_palette",
273 "select_time_unit",
274 "suggest_tick_spacing",
275]