oscura 0.8.0__py3-none-any.whl → 0.11.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. oscura/__init__.py +19 -19
  2. oscura/__main__.py +4 -0
  3. oscura/analyzers/__init__.py +2 -0
  4. oscura/analyzers/digital/extraction.py +2 -3
  5. oscura/analyzers/digital/quality.py +1 -1
  6. oscura/analyzers/digital/timing.py +1 -1
  7. oscura/analyzers/ml/signal_classifier.py +6 -0
  8. oscura/analyzers/patterns/__init__.py +66 -0
  9. oscura/analyzers/power/basic.py +3 -3
  10. oscura/analyzers/power/soa.py +1 -1
  11. oscura/analyzers/power/switching.py +3 -3
  12. oscura/analyzers/signal_classification.py +529 -0
  13. oscura/analyzers/signal_integrity/sparams.py +3 -3
  14. oscura/analyzers/statistics/basic.py +10 -7
  15. oscura/analyzers/validation.py +1 -1
  16. oscura/analyzers/waveform/measurements.py +200 -156
  17. oscura/analyzers/waveform/measurements_with_uncertainty.py +91 -35
  18. oscura/analyzers/waveform/spectral.py +182 -84
  19. oscura/api/dsl/commands.py +15 -6
  20. oscura/api/server/templates/base.html +137 -146
  21. oscura/api/server/templates/export.html +84 -110
  22. oscura/api/server/templates/home.html +248 -267
  23. oscura/api/server/templates/protocols.html +44 -48
  24. oscura/api/server/templates/reports.html +27 -35
  25. oscura/api/server/templates/session_detail.html +68 -78
  26. oscura/api/server/templates/sessions.html +62 -72
  27. oscura/api/server/templates/waveforms.html +54 -64
  28. oscura/automotive/__init__.py +1 -1
  29. oscura/automotive/can/session.py +1 -1
  30. oscura/automotive/dbc/generator.py +638 -23
  31. oscura/automotive/dtc/data.json +17 -102
  32. oscura/automotive/flexray/fibex.py +9 -1
  33. oscura/automotive/uds/decoder.py +99 -6
  34. oscura/cli/analyze.py +8 -2
  35. oscura/cli/batch.py +36 -5
  36. oscura/cli/characterize.py +18 -4
  37. oscura/cli/export.py +47 -5
  38. oscura/cli/main.py +2 -0
  39. oscura/cli/onboarding/wizard.py +10 -6
  40. oscura/cli/pipeline.py +585 -0
  41. oscura/cli/visualize.py +6 -4
  42. oscura/convenience.py +400 -32
  43. oscura/core/measurement_result.py +286 -0
  44. oscura/core/progress.py +1 -1
  45. oscura/core/schemas/device_mapping.json +2 -8
  46. oscura/core/schemas/packet_format.json +4 -24
  47. oscura/core/schemas/protocol_definition.json +2 -12
  48. oscura/core/types.py +232 -239
  49. oscura/correlation/multi_protocol.py +1 -1
  50. oscura/export/legacy/__init__.py +11 -0
  51. oscura/export/legacy/wav.py +75 -0
  52. oscura/exporters/__init__.py +19 -0
  53. oscura/exporters/wireshark.py +809 -0
  54. oscura/hardware/acquisition/file.py +5 -19
  55. oscura/hardware/acquisition/saleae.py +10 -10
  56. oscura/hardware/acquisition/socketcan.py +4 -6
  57. oscura/hardware/acquisition/synthetic.py +1 -5
  58. oscura/hardware/acquisition/visa.py +6 -6
  59. oscura/hardware/security/side_channel_detector.py +5 -508
  60. oscura/inference/message_format.py +686 -1
  61. oscura/jupyter/display.py +2 -2
  62. oscura/jupyter/magic.py +3 -3
  63. oscura/loaders/__init__.py +17 -12
  64. oscura/loaders/binary.py +1 -1
  65. oscura/loaders/chipwhisperer.py +1 -2
  66. oscura/loaders/configurable.py +1 -1
  67. oscura/loaders/csv_loader.py +2 -2
  68. oscura/loaders/hdf5_loader.py +1 -1
  69. oscura/loaders/lazy.py +6 -1
  70. oscura/loaders/mmap_loader.py +0 -1
  71. oscura/loaders/numpy_loader.py +8 -7
  72. oscura/loaders/preprocessing.py +3 -5
  73. oscura/loaders/rigol.py +21 -7
  74. oscura/loaders/sigrok.py +2 -5
  75. oscura/loaders/tdms.py +3 -2
  76. oscura/loaders/tektronix.py +38 -32
  77. oscura/loaders/tss.py +20 -27
  78. oscura/loaders/validation.py +17 -10
  79. oscura/loaders/vcd.py +13 -8
  80. oscura/loaders/wav.py +1 -6
  81. oscura/pipeline/__init__.py +76 -0
  82. oscura/pipeline/handlers/__init__.py +165 -0
  83. oscura/pipeline/handlers/analyzers.py +1045 -0
  84. oscura/pipeline/handlers/decoders.py +899 -0
  85. oscura/pipeline/handlers/exporters.py +1103 -0
  86. oscura/pipeline/handlers/filters.py +891 -0
  87. oscura/pipeline/handlers/loaders.py +640 -0
  88. oscura/pipeline/handlers/transforms.py +768 -0
  89. oscura/reporting/formatting/measurements.py +55 -14
  90. oscura/reporting/templates/enhanced/protocol_re.html +504 -503
  91. oscura/sessions/legacy.py +49 -1
  92. oscura/side_channel/__init__.py +38 -57
  93. oscura/utils/builders/signal_builder.py +5 -5
  94. oscura/utils/comparison/compare.py +7 -9
  95. oscura/utils/comparison/golden.py +1 -1
  96. oscura/utils/filtering/convenience.py +2 -2
  97. oscura/utils/math/arithmetic.py +38 -62
  98. oscura/utils/math/interpolation.py +20 -20
  99. oscura/utils/pipeline/__init__.py +4 -17
  100. oscura/utils/progressive.py +1 -4
  101. oscura/utils/triggering/edge.py +1 -1
  102. oscura/utils/triggering/pattern.py +2 -2
  103. oscura/utils/triggering/pulse.py +2 -2
  104. oscura/utils/triggering/window.py +3 -3
  105. oscura/validation/hil_testing.py +11 -11
  106. oscura/visualization/__init__.py +46 -284
  107. oscura/visualization/batch.py +72 -433
  108. oscura/visualization/plot.py +542 -53
  109. oscura/visualization/styles.py +184 -318
  110. oscura/workflows/batch/advanced.py +1 -1
  111. oscura/workflows/batch/aggregate.py +12 -9
  112. oscura/workflows/complete_re.py +251 -23
  113. oscura/workflows/digital.py +27 -4
  114. oscura/workflows/multi_trace.py +136 -17
  115. oscura/workflows/waveform.py +11 -6
  116. oscura-0.11.0.dist-info/METADATA +460 -0
  117. {oscura-0.8.0.dist-info → oscura-0.11.0.dist-info}/RECORD +120 -145
  118. oscura/side_channel/dpa.py +0 -1025
  119. oscura/utils/optimization/__init__.py +0 -19
  120. oscura/utils/optimization/parallel.py +0 -443
  121. oscura/utils/optimization/search.py +0 -532
  122. oscura/utils/pipeline/base.py +0 -338
  123. oscura/utils/pipeline/composition.py +0 -248
  124. oscura/utils/pipeline/parallel.py +0 -449
  125. oscura/utils/pipeline/pipeline.py +0 -375
  126. oscura/utils/search/__init__.py +0 -16
  127. oscura/utils/search/anomaly.py +0 -424
  128. oscura/utils/search/context.py +0 -294
  129. oscura/utils/search/pattern.py +0 -288
  130. oscura/utils/storage/__init__.py +0 -61
  131. oscura/utils/storage/database.py +0 -1166
  132. oscura/visualization/accessibility.py +0 -526
  133. oscura/visualization/annotations.py +0 -371
  134. oscura/visualization/axis_scaling.py +0 -305
  135. oscura/visualization/colors.py +0 -451
  136. oscura/visualization/digital.py +0 -436
  137. oscura/visualization/eye.py +0 -571
  138. oscura/visualization/histogram.py +0 -281
  139. oscura/visualization/interactive.py +0 -1035
  140. oscura/visualization/jitter.py +0 -1042
  141. oscura/visualization/keyboard.py +0 -394
  142. oscura/visualization/layout.py +0 -400
  143. oscura/visualization/optimization.py +0 -1079
  144. oscura/visualization/palettes.py +0 -446
  145. oscura/visualization/power.py +0 -508
  146. oscura/visualization/power_extended.py +0 -955
  147. oscura/visualization/presets.py +0 -469
  148. oscura/visualization/protocols.py +0 -1246
  149. oscura/visualization/render.py +0 -223
  150. oscura/visualization/rendering.py +0 -444
  151. oscura/visualization/reverse_engineering.py +0 -838
  152. oscura/visualization/signal_integrity.py +0 -989
  153. oscura/visualization/specialized.py +0 -643
  154. oscura/visualization/spectral.py +0 -1226
  155. oscura/visualization/thumbnails.py +0 -340
  156. oscura/visualization/time_axis.py +0 -351
  157. oscura/visualization/waveform.py +0 -454
  158. oscura-0.8.0.dist-info/METADATA +0 -661
  159. {oscura-0.8.0.dist-info → oscura-0.11.0.dist-info}/WHEEL +0 -0
  160. {oscura-0.8.0.dist-info → oscura-0.11.0.dist-info}/entry_points.txt +0 -0
  161. {oscura-0.8.0.dist-info → oscura-0.11.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,331 +1,93 @@
1
1
  """Visualization module for Oscura.
2
2
 
3
- Provides plotting functions for waveforms, spectra, and other signal data,
4
- plus optimization utilities, style presets, and intelligent rendering.
3
+ Provides simple matplotlib-based plotting functions for waveforms, spectra,
4
+ and digital signals. All functions accept and return matplotlib axes for
5
+ composability.
5
6
 
6
7
  **Requires matplotlib:**
7
- This module requires matplotlib to be installed. Install with:
8
- pip install oscura[visualization] # Just visualization
9
- pip install oscura[standard] # Recommended
10
- pip install oscura[all] # Everything
8
+ Install with: pip install oscura[visualization]
11
9
 
12
10
  Example:
13
- >>> from oscura.visualization import plot_waveform, plot_spectrum
14
- >>> from oscura.visualization import plot_timing, plot_eye
15
- >>> from oscura.visualization import plot_bode, plot_histogram
16
- >>> from oscura.visualization import apply_style_preset
17
11
  >>> import matplotlib.pyplot as plt
18
- >>> with apply_style_preset("publication"):
19
- ... plot_waveform(trace, time_unit="us")
20
- ... plt.savefig("figure.pdf")
12
+ >>> import oscura as osc
13
+ >>> from oscura.visualization import plot_waveform, plot_fft
14
+ >>>
15
+ >>> trace = osc.load("signal.wfm")
16
+ >>> fig, (ax1, ax2) = plt.subplots(2, 1)
17
+ >>> plot_waveform(ax1, trace)
18
+ >>> plot_fft(ax2, trace)
19
+ >>> plt.savefig("analysis.png")
21
20
  """
22
21
 
23
- # NOTE: Matplotlib is optional - individual functions will check and raise
24
- # helpful errors if matplotlib is not installed when they're called.
25
- # The module itself can be imported without matplotlib.
26
-
27
- # Import plot module as namespace for DSL compatibility
28
- from oscura.visualization import batch, plot
29
- from oscura.visualization.accessibility import (
30
- FAIL_SYMBOL,
31
- LINE_STYLES,
32
- PASS_SYMBOL,
33
- KeyboardHandler,
34
- add_plot_aria_attributes,
35
- format_pass_fail,
36
- generate_alt_text,
37
- get_colorblind_palette,
38
- get_multi_line_styles,
39
- )
40
-
41
- # Phase 30 enhancements
42
- from oscura.visualization.annotations import (
43
- Annotation as EnhancedAnnotation,
44
- )
45
- from oscura.visualization.annotations import (
46
- PlacedAnnotation as EnhancedPlacedAnnotation,
47
- )
48
- from oscura.visualization.annotations import (
49
- create_priority_annotation,
50
- filter_by_zoom_level,
51
- place_annotations,
52
- )
53
- from oscura.visualization.axis_scaling import (
54
- calculate_axis_limits,
55
- calculate_multi_channel_limits,
56
- suggest_tick_spacing,
57
- )
58
- from oscura.visualization.colors import (
59
- COLORBLIND_SAFE_QUALITATIVE,
60
- DIVERGING_COOLWARM,
61
- SEQUENTIAL_VIRIDIS,
62
- select_optimal_palette,
63
- )
64
- from oscura.visualization.digital import (
65
- plot_logic_analyzer,
66
- plot_timing,
67
- )
68
- from oscura.visualization.eye import (
22
+ # Import core plotting functions
23
+ # Import batch utilities
24
+ from oscura.visualization import batch
25
+ from oscura.visualization.batch import fig_to_base64, generate_all_plots
26
+ from oscura.visualization.plot import (
69
27
  plot_bathtub,
70
28
  plot_eye,
71
- )
72
- from oscura.visualization.histogram import (
73
- calculate_bin_edges,
74
- calculate_optimal_bins,
75
- )
76
- from oscura.visualization.interactive import (
77
- CursorMeasurement,
78
- ZoomState,
79
- add_measurement_cursors,
80
- enable_zoom_pan,
81
- plot_bode,
29
+ plot_fft,
82
30
  plot_histogram,
83
- plot_phase,
84
- plot_waterfall,
85
- plot_with_cursors,
86
- )
87
- from oscura.visualization.layout import (
88
- Annotation,
89
- ChannelLayout,
90
- PlacedAnnotation,
91
- layout_stacked_channels,
92
- optimize_annotation_placement,
93
- )
94
- from oscura.visualization.optimization import (
95
- InterestingRegion,
96
- calculate_grid_spacing,
97
- calculate_optimal_x_window,
98
- calculate_optimal_y_range,
99
- decimate_for_display,
100
- detect_interesting_regions,
101
- optimize_db_range,
102
- )
103
- from oscura.visualization.presets import (
104
- DARK_THEME_PRESET,
105
- IEEE_DOUBLE_COLUMN_PRESET,
106
- IEEE_PUBLICATION_PRESET,
107
- VisualizationPreset,
108
- apply_preset,
109
- get_preset_colors,
110
- )
111
- from oscura.visualization.presets import (
112
- create_custom_preset as create_custom_visualization_preset,
113
- )
114
- from oscura.visualization.presets import (
115
- list_presets as list_visualization_presets,
116
- )
117
- from oscura.visualization.protocols import (
118
- plot_can_decode,
119
- plot_i2c_decode,
31
+ plot_logic_analyzer,
32
+ plot_multi_channel,
120
33
  plot_protocol_decode,
121
- plot_spi_decode,
122
- plot_uart_decode,
123
- )
124
- from oscura.visualization.render import (
125
- RenderPreset,
126
- apply_rendering_config,
127
- configure_dpi_rendering,
128
- )
129
- from oscura.visualization.rendering import (
130
- StreamingRenderer,
131
- downsample_for_memory,
132
- estimate_memory_usage,
133
- progressive_render,
134
- render_with_lod,
135
- )
136
-
137
- # Reverse Engineering Visualizations (HIGH-2)
138
- from oscura.visualization.reverse_engineering import (
139
- plot_crc_parameters,
140
- plot_field_confidence_heatmap,
141
- plot_message_field_layout,
142
- plot_message_type_distribution,
143
- plot_pipeline_timing,
144
- plot_protocol_candidates,
145
- plot_re_summary,
146
- )
147
- from oscura.visualization.specialized import (
148
- ProtocolSignal,
149
- StateTransition,
150
- plot_protocol_timing,
151
- plot_state_machine,
152
- )
153
- from oscura.visualization.spectral import (
154
- plot_fft,
155
34
  plot_psd,
156
35
  plot_quality_summary,
157
36
  plot_spectrogram,
158
37
  plot_spectrum,
38
+ plot_state_machine,
159
39
  plot_thd_bars,
160
- )
161
- from oscura.visualization.styles import (
162
- PRESENTATION_PRESET,
163
- PRINT_PRESET,
164
- PUBLICATION_PRESET,
165
- SCREEN_PRESET,
166
- StylePreset,
167
- apply_style_preset,
168
- create_custom_preset,
169
- )
170
- from oscura.visualization.thumbnails import (
171
- render_thumbnail,
172
- render_thumbnail_multichannel,
173
- )
174
- from oscura.visualization.time_axis import (
175
- TimeUnit,
176
- calculate_major_ticks,
177
- convert_time_values,
178
- create_relative_time,
179
- format_cursor_readout,
180
- format_time_labels,
181
- select_time_unit,
182
- )
183
- from oscura.visualization.waveform import (
184
- plot_multi_channel,
40
+ plot_timing,
185
41
  plot_waveform,
186
42
  plot_xy,
187
43
  )
188
44
 
45
+ # Import styling utilities
46
+ from oscura.visualization.styles import (
47
+ COLORBLIND_PALETTE,
48
+ FAIL_SYMBOL,
49
+ IEEE_STYLE,
50
+ LINE_STYLES,
51
+ PASS_SYMBOL,
52
+ apply_ieee_style,
53
+ apply_presentation_style,
54
+ format_pass_fail,
55
+ get_colorblind_cmap,
56
+ get_colorblind_palette,
57
+ get_line_styles,
58
+ get_multi_line_styles,
59
+ )
60
+
189
61
  __all__ = [
190
- "COLORBLIND_SAFE_QUALITATIVE",
191
- "DARK_THEME_PRESET",
192
- "DIVERGING_COOLWARM",
62
+ "COLORBLIND_PALETTE",
193
63
  "FAIL_SYMBOL",
194
- "IEEE_DOUBLE_COLUMN_PRESET",
195
- "IEEE_PUBLICATION_PRESET",
64
+ "IEEE_STYLE",
196
65
  "LINE_STYLES",
197
66
  "PASS_SYMBOL",
198
- "PRESENTATION_PRESET",
199
- "PRINT_PRESET",
200
- "PUBLICATION_PRESET",
201
- "SCREEN_PRESET",
202
- "SEQUENTIAL_VIRIDIS",
203
- "Annotation",
204
- # Layout functions (VIS-015, VIS-016)
205
- "ChannelLayout",
206
- # Interactive (VIS-008)
207
- "CursorMeasurement",
208
- # Phase 30: Enhanced modules
209
- "EnhancedAnnotation",
210
- "EnhancedPlacedAnnotation",
211
- "InterestingRegion",
212
- "KeyboardHandler",
213
- "PlacedAnnotation",
214
- "ProtocolSignal",
215
- "RenderPreset",
216
- "StateTransition",
217
- "StreamingRenderer",
218
- "StylePreset",
219
- "TimeUnit",
220
- "VisualizationPreset",
221
- # Interactive (VIS-007)
222
- "ZoomState",
223
- # Interactive (VIS-008)
224
- "add_measurement_cursors",
225
- "add_plot_aria_attributes",
226
- "apply_preset",
227
- "apply_rendering_config",
228
- # Styles
229
- "apply_style_preset",
67
+ "apply_ieee_style",
68
+ "apply_presentation_style",
230
69
  "batch",
231
- "calculate_axis_limits",
232
- "calculate_bin_edges",
233
- "calculate_grid_spacing",
234
- "calculate_major_ticks",
235
- "calculate_multi_channel_limits",
236
- # Histogram
237
- "calculate_optimal_bins",
238
- "calculate_optimal_x_window",
239
- # Optimization functions (VIS-013, VIS-014, VIS-019, VIS-020, VIS-022)
240
- "calculate_optimal_y_range",
241
- # Rendering functions (VIS-017)
242
- "configure_dpi_rendering",
243
- "convert_time_values",
244
- "create_custom_preset",
245
- "create_custom_visualization_preset",
246
- "create_priority_annotation",
247
- "create_relative_time",
248
- "decimate_for_display",
249
- "detect_interesting_regions",
250
- "downsample_for_memory",
251
- # Interactive (VIS-007)
252
- "enable_zoom_pan",
253
- "estimate_memory_usage",
254
- "filter_by_zoom_level",
255
- "format_cursor_readout",
70
+ "fig_to_base64",
256
71
  "format_pass_fail",
257
- "format_time_labels",
258
- "generate_alt_text",
259
- # Accessibility (ACC-001, ACC-002, ACC-003)
72
+ "generate_all_plots",
73
+ "get_colorblind_cmap",
260
74
  "get_colorblind_palette",
75
+ "get_line_styles",
261
76
  "get_multi_line_styles",
262
- "get_preset_colors",
263
- "layout_stacked_channels",
264
- "list_visualization_presets",
265
- "optimize_annotation_placement",
266
- "optimize_db_range",
267
- "place_annotations",
268
- "plot",
269
- # Eye diagram (VIS-006)
270
77
  "plot_bathtub",
271
- # Interactive (VIS-010)
272
- "plot_bode",
273
- # Protocol decode visualization (VIS-030)
274
- "plot_can_decode",
275
- # Reverse Engineering Visualization (HIGH-2)
276
- "plot_crc_parameters",
277
78
  "plot_eye",
278
- # Spectral plotting
279
79
  "plot_fft",
280
- # Reverse Engineering Visualization (HIGH-2)
281
- "plot_field_confidence_heatmap",
282
- # Interactive (VIS-012)
283
80
  "plot_histogram",
284
- # Protocol decode visualization (VIS-030)
285
- "plot_i2c_decode",
286
- # Digital visualization (VIS-005)
287
81
  "plot_logic_analyzer",
288
- # Reverse Engineering Visualization (HIGH-2)
289
- "plot_message_field_layout",
290
- "plot_message_type_distribution",
291
82
  "plot_multi_channel",
292
- # Interactive (VIS-009)
293
- "plot_phase",
294
- # Reverse Engineering Visualization (HIGH-2)
295
- "plot_pipeline_timing",
296
- # Protocol decode visualization (VIS-030)
297
- "plot_protocol_candidates",
298
83
  "plot_protocol_decode",
299
- "plot_protocol_timing",
300
84
  "plot_psd",
301
- # Signal quality summary (IEEE 1241-2010)
302
85
  "plot_quality_summary",
303
- # Reverse Engineering Visualization (HIGH-2)
304
- "plot_re_summary",
305
86
  "plot_spectrogram",
306
87
  "plot_spectrum",
307
- # Protocol decode visualization (VIS-030)
308
- "plot_spi_decode",
309
88
  "plot_state_machine",
310
- # THD harmonic bar chart
311
89
  "plot_thd_bars",
312
90
  "plot_timing",
313
- # Protocol decode visualization (VIS-030)
314
- "plot_uart_decode",
315
- # Interactive (VIS-011)
316
- "plot_waterfall",
317
- # Waveform plotting
318
91
  "plot_waveform",
319
- # Interactive (VIS-008)
320
- "plot_with_cursors",
321
92
  "plot_xy",
322
- "progressive_render",
323
- # Thumbnails
324
- "render_thumbnail",
325
- "render_thumbnail_multichannel",
326
- "render_with_lod",
327
- # Colors
328
- "select_optimal_palette",
329
- "select_time_unit",
330
- "suggest_tick_spacing",
331
93
  ]