oscura 0.1.0__py3-none-any.whl → 0.1.1__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.
- oscura/__init__.py +14 -14
- oscura/__main__.py +9 -9
- oscura/analyzers/__init__.py +1 -1
- oscura/analyzers/packet/daq.py +1 -1
- oscura/analyzers/patterns/__init__.py +2 -2
- oscura/analyzers/patterns/clustering.py +1 -1
- oscura/analyzers/patterns/discovery.py +1 -1
- oscura/analyzers/patterns/periodic.py +1 -1
- oscura/analyzers/patterns/sequences.py +1 -1
- oscura/analyzers/power/__init__.py +1 -1
- oscura/analyzers/power/ac_power.py +1 -1
- oscura/analyzers/power/basic.py +1 -1
- oscura/analyzers/power/conduction.py +1 -1
- oscura/analyzers/power/efficiency.py +1 -1
- oscura/analyzers/power/ripple.py +1 -1
- oscura/analyzers/power/soa.py +1 -1
- oscura/analyzers/power/switching.py +1 -1
- oscura/api/__init__.py +1 -1
- oscura/automotive/__init__.py +1 -1
- oscura/automotive/can/checksum.py +2 -2
- oscura/automotive/can/session.py +1 -1
- oscura/automotive/can/state_machine.py +1 -1
- oscura/automotive/dbc/generator.py +1 -1
- oscura/automotive/dbc/parser.py +1 -1
- oscura/automotive/loaders/pcap.py +1 -1
- oscura/batch/__init__.py +1 -1
- oscura/batch/aggregate.py +2 -2
- oscura/batch/analyze.py +3 -3
- oscura/builders/__init__.py +7 -7
- oscura/builders/signal_builder.py +4 -4
- oscura/cli/__init__.py +1 -1
- oscura/cli/batch.py +1 -1
- oscura/cli/characterize.py +2 -2
- oscura/cli/compare.py +4 -4
- oscura/cli/decode.py +1 -1
- oscura/cli/main.py +8 -8
- oscura/cli/shell.py +19 -19
- oscura/comparison/__init__.py +1 -1
- oscura/comparison/compare.py +1 -1
- oscura/comparison/golden.py +1 -1
- oscura/comparison/limits.py +1 -1
- oscura/comparison/mask.py +1 -1
- oscura/comparison/trace_diff.py +1 -1
- oscura/compliance/__init__.py +2 -2
- oscura/compliance/reporting.py +2 -2
- oscura/component/__init__.py +1 -1
- oscura/component/impedance.py +1 -1
- oscura/component/reactive.py +1 -1
- oscura/component/transmission_line.py +1 -1
- oscura/config/__init__.py +1 -1
- oscura/config/loader.py +1 -1
- oscura/config/memory.py +3 -3
- oscura/config/migration.py +1 -1
- oscura/config/preferences.py +1 -1
- oscura/config/schema.py +3 -3
- oscura/config/settings.py +1 -1
- oscura/convenience.py +13 -13
- oscura/core/__init__.py +6 -6
- oscura/core/cache.py +10 -10
- oscura/core/cancellation.py +1 -1
- oscura/core/confidence.py +1 -1
- oscura/core/config.py +1 -1
- oscura/core/correlation.py +1 -1
- oscura/core/debug.py +4 -4
- oscura/core/edge_cases.py +1 -1
- oscura/core/exceptions.py +14 -14
- oscura/core/gpu_backend.py +5 -5
- oscura/core/lazy.py +3 -3
- oscura/core/logging.py +6 -6
- oscura/core/logging_advanced.py +1 -1
- oscura/core/memoize.py +3 -3
- oscura/core/memory_check.py +1 -1
- oscura/core/memory_guard.py +1 -1
- oscura/core/memory_limits.py +1 -1
- oscura/core/memory_monitor.py +1 -1
- oscura/core/memory_progress.py +1 -1
- oscura/core/memory_warnings.py +1 -1
- oscura/core/progress.py +1 -1
- oscura/core/provenance.py +5 -5
- oscura/core/results.py +3 -3
- oscura/core/types.py +1 -1
- oscura/core/uncertainty.py +1 -1
- oscura/discovery/__init__.py +4 -4
- oscura/discovery/comparison.py +1 -1
- oscura/dsl/__init__.py +1 -1
- oscura/dsl/commands.py +22 -22
- oscura/dsl/interpreter.py +4 -4
- oscura/dsl/parser.py +4 -4
- oscura/dsl/repl.py +4 -4
- oscura/exceptions.py +3 -3
- oscura/export/__init__.py +2 -2
- oscura/export/wireshark/__init__.py +1 -1
- oscura/export/wireshark/generator.py +2 -2
- oscura/export/wireshark/templates/dissector.lua.j2 +1 -1
- oscura/export/wireshark/type_mapping.py +8 -8
- oscura/exporters/__init__.py +3 -3
- oscura/exporters/csv.py +1 -1
- oscura/exporters/html_export.py +5 -5
- oscura/exporters/json_export.py +9 -9
- oscura/exporters/markdown_export.py +3 -3
- oscura/exporters/npz_export.py +1 -1
- oscura/exporters/spice_export.py +1 -1
- oscura/extensibility/__init__.py +1 -1
- oscura/extensibility/docs.py +1 -1
- oscura/extensibility/extensions.py +7 -7
- oscura/extensibility/measurements.py +12 -12
- oscura/extensibility/plugins.py +12 -12
- oscura/extensibility/registry.py +12 -12
- oscura/extensibility/templates.py +16 -16
- oscura/extensibility/validation.py +3 -3
- oscura/filtering/__init__.py +1 -1
- oscura/filtering/base.py +1 -1
- oscura/filtering/convenience.py +1 -1
- oscura/filtering/design.py +1 -1
- oscura/filtering/introspection.py +1 -1
- oscura/guidance/__init__.py +1 -1
- oscura/guidance/recommender.py +1 -1
- oscura/guidance/wizard.py +1 -1
- oscura/inference/__init__.py +1 -1
- oscura/inference/adaptive_tuning.py +3 -3
- oscura/inference/logic.py +5 -5
- oscura/inference/protocol.py +5 -5
- oscura/inference/signal_intelligence.py +19 -19
- oscura/inference/spectral.py +6 -6
- oscura/integrations/__init__.py +1 -1
- oscura/integrations/llm.py +6 -6
- oscura/jupyter/__init__.py +3 -3
- oscura/jupyter/display.py +1 -1
- oscura/jupyter/magic.py +31 -31
- oscura/loaders/__init__.py +10 -10
- oscura/loaders/mmap_loader.py +1 -1
- oscura/loaders/pcap.py +1 -1
- oscura/math/__init__.py +1 -1
- oscura/math/arithmetic.py +1 -1
- oscura/math/interpolation.py +1 -1
- oscura/onboarding/__init__.py +1 -1
- oscura/onboarding/help.py +18 -18
- oscura/onboarding/tutorials.py +29 -29
- oscura/onboarding/wizard.py +22 -22
- oscura/pipeline/composition.py +15 -15
- oscura/pipeline/pipeline.py +10 -10
- oscura/plugins/__init__.py +2 -2
- oscura/plugins/base.py +5 -5
- oscura/plugins/discovery.py +6 -6
- oscura/plugins/registry.py +6 -6
- oscura/plugins/versioning.py +2 -2
- oscura/quality/__init__.py +1 -1
- oscura/quality/scoring.py +1 -1
- oscura/quality/warnings.py +1 -1
- oscura/reporting/__init__.py +1 -1
- oscura/reporting/advanced.py +1 -1
- oscura/reporting/analyze.py +1 -1
- oscura/reporting/auto_report.py +2 -2
- oscura/reporting/batch.py +3 -3
- oscura/reporting/chart_selection.py +1 -1
- oscura/reporting/comparison.py +1 -1
- oscura/reporting/core.py +4 -4
- oscura/reporting/export.py +1 -1
- oscura/reporting/formatting.py +1 -1
- oscura/reporting/html.py +3 -3
- oscura/reporting/multichannel.py +1 -1
- oscura/reporting/output.py +1 -1
- oscura/reporting/pdf.py +2 -2
- oscura/reporting/pptx_export.py +1 -1
- oscura/reporting/sections.py +1 -1
- oscura/reporting/standards.py +2 -2
- oscura/reporting/summary_generator.py +1 -1
- oscura/reporting/tables.py +1 -1
- oscura/reporting/template_system.py +1 -1
- oscura/reporting/templates/index.html +2 -2
- oscura/schemas/__init__.py +2 -2
- oscura/schemas/bus_configuration.json +1 -1
- oscura/schemas/device_mapping.json +1 -1
- oscura/schemas/packet_format.json +1 -1
- oscura/schemas/protocol_definition.json +1 -1
- oscura/search/__init__.py +1 -1
- oscura/session/__init__.py +4 -4
- oscura/session/history.py +7 -7
- oscura/session/session.py +2 -2
- oscura/streaming/chunked.py +7 -7
- oscura/testing/__init__.py +1 -1
- oscura/triggering/__init__.py +1 -1
- oscura/triggering/base.py +1 -1
- oscura/triggering/edge.py +1 -1
- oscura/triggering/pattern.py +1 -1
- oscura/triggering/pulse.py +1 -1
- oscura/triggering/window.py +1 -1
- oscura/ui/__init__.py +1 -1
- oscura/ui/formatters.py +1 -1
- oscura/ui/progressive_display.py +1 -1
- oscura/utils/__init__.py +1 -1
- oscura/utils/memory.py +3 -3
- oscura/utils/memory_extensions.py +1 -1
- oscura/visualization/__init__.py +1 -1
- oscura/visualization/accessibility.py +1 -1
- oscura/visualization/keyboard.py +1 -1
- oscura/visualization/palettes.py +1 -1
- oscura/visualization/spectral.py +9 -9
- oscura/visualization/waveform.py +4 -4
- oscura/workflows/__init__.py +5 -5
- oscura/workflows/compliance.py +5 -5
- oscura/workflows/digital.py +5 -5
- oscura/workflows/multi_trace.py +25 -25
- oscura/workflows/power.py +7 -7
- oscura/workflows/protocol.py +5 -5
- oscura/workflows/reverse_engineering.py +5 -5
- oscura/workflows/signal_integrity.py +6 -6
- {oscura-0.1.0.dist-info → oscura-0.1.1.dist-info}/METADATA +11 -11
- {oscura-0.1.0.dist-info → oscura-0.1.1.dist-info}/RECORD +212 -212
- {oscura-0.1.0.dist-info → oscura-0.1.1.dist-info}/WHEEL +0 -0
- {oscura-0.1.0.dist-info → oscura-0.1.1.dist-info}/entry_points.txt +0 -0
- {oscura-0.1.0.dist-info → oscura-0.1.1.dist-info}/licenses/LICENSE +0 -0
oscura/export/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""Export module for
|
|
1
|
+
"""Export module for Oscura protocol definitions.
|
|
2
2
|
|
|
3
|
-
This module provides functionality to export
|
|
3
|
+
This module provides functionality to export Oscura protocol definitions
|
|
4
4
|
to various formats for integration with other tools and workflows.
|
|
5
5
|
|
|
6
6
|
Supported export formats:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Wireshark dissector export module.
|
|
2
2
|
|
|
3
|
-
This module provides functionality to export
|
|
3
|
+
This module provides functionality to export Oscura protocol definitions
|
|
4
4
|
as Wireshark Lua dissectors for integration with Wireshark's protocol
|
|
5
5
|
analysis tools.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Wireshark Lua dissector generator.
|
|
2
2
|
|
|
3
|
-
This module generates Wireshark Lua dissectors from
|
|
3
|
+
This module generates Wireshark Lua dissectors from Oscura protocol definitions.
|
|
4
4
|
The generated dissectors can be loaded into Wireshark for interactive protocol analysis.
|
|
5
5
|
|
|
6
6
|
Features:
|
|
@@ -29,7 +29,7 @@ from .validator import validate_lua_syntax
|
|
|
29
29
|
class WiresharkDissectorGenerator:
|
|
30
30
|
"""Generate Wireshark Lua dissectors from protocol definitions.
|
|
31
31
|
|
|
32
|
-
This class converts
|
|
32
|
+
This class converts Oscura protocol definitions into Wireshark Lua
|
|
33
33
|
dissectors that can be loaded into Wireshark for protocol analysis.
|
|
34
34
|
|
|
35
35
|
Features:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""Type mapping between
|
|
1
|
+
"""Type mapping between Oscura field types and Wireshark ProtoField types.
|
|
2
2
|
|
|
3
|
-
This module provides mappings from
|
|
3
|
+
This module provides mappings from Oscura protocol field types to their
|
|
4
4
|
corresponding Wireshark Lua ProtoField types and display bases.
|
|
5
5
|
|
|
6
6
|
References:
|
|
@@ -9,7 +9,7 @@ References:
|
|
|
9
9
|
|
|
10
10
|
from typing import Literal
|
|
11
11
|
|
|
12
|
-
# Map
|
|
12
|
+
# Map Oscura field types to Wireshark ProtoField types
|
|
13
13
|
FIELD_TYPE_MAPPING: dict[str, str] = {
|
|
14
14
|
"uint8": "ProtoField.uint8",
|
|
15
15
|
"uint16": "ProtoField.uint16",
|
|
@@ -54,10 +54,10 @@ DEFAULT_BASE: dict[str, str] = {
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def get_protofield_type(field_type: str, display_base: str | None = None) -> tuple[str, str]:
|
|
57
|
-
"""Map
|
|
57
|
+
"""Map Oscura field type to Wireshark ProtoField and display base.
|
|
58
58
|
|
|
59
59
|
Args:
|
|
60
|
-
field_type:
|
|
60
|
+
field_type: Oscura field type (uint8, uint16, string, etc.)
|
|
61
61
|
display_base: Optional display base (dec, hex, oct, bin, none)
|
|
62
62
|
|
|
63
63
|
Returns:
|
|
@@ -88,7 +88,7 @@ def get_field_size(field_type: str) -> int | None:
|
|
|
88
88
|
"""Get the fixed size in bytes for a field type.
|
|
89
89
|
|
|
90
90
|
Args:
|
|
91
|
-
field_type:
|
|
91
|
+
field_type: Oscura field type
|
|
92
92
|
|
|
93
93
|
Returns:
|
|
94
94
|
Field size in bytes, or None for variable-length types
|
|
@@ -115,7 +115,7 @@ def is_variable_length(field_type: str) -> bool:
|
|
|
115
115
|
"""Check if a field type is variable length.
|
|
116
116
|
|
|
117
117
|
Args:
|
|
118
|
-
field_type:
|
|
118
|
+
field_type: Oscura field type
|
|
119
119
|
|
|
120
120
|
Returns:
|
|
121
121
|
True if field is variable length
|
|
@@ -127,7 +127,7 @@ def get_lua_reader_function(field_type: str, endian: Literal["big", "little"] =
|
|
|
127
127
|
"""Get the Lua buffer reader function for a field type.
|
|
128
128
|
|
|
129
129
|
Args:
|
|
130
|
-
field_type:
|
|
130
|
+
field_type: Oscura field type
|
|
131
131
|
endian: Byte order (big or little endian)
|
|
132
132
|
|
|
133
133
|
Returns:
|
oscura/exporters/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Data export module for
|
|
1
|
+
"""Data export module for Oscura.
|
|
2
2
|
|
|
3
3
|
Provides export functionality to various file formats including CSV, HDF5,
|
|
4
4
|
JSON, MATLAB, Markdown, HTML, NumPy NPZ, and SPICE PWL.
|
|
@@ -32,7 +32,7 @@ from oscura.exporters.html_export import (
|
|
|
32
32
|
generate_html_report,
|
|
33
33
|
)
|
|
34
34
|
from oscura.exporters.json_export import (
|
|
35
|
-
|
|
35
|
+
OscuraJSONEncoder,
|
|
36
36
|
export_json,
|
|
37
37
|
export_measurements,
|
|
38
38
|
export_protocol_decode,
|
|
@@ -57,7 +57,7 @@ from oscura.exporters.spice_export import (
|
|
|
57
57
|
)
|
|
58
58
|
|
|
59
59
|
__all__ = [
|
|
60
|
-
"
|
|
60
|
+
"OscuraJSONEncoder",
|
|
61
61
|
"append_trace",
|
|
62
62
|
# CSV export (EXP-001)
|
|
63
63
|
"export_csv",
|
oscura/exporters/csv.py
CHANGED
|
@@ -107,7 +107,7 @@ def _export_trace(
|
|
|
107
107
|
if header:
|
|
108
108
|
# Metadata comments
|
|
109
109
|
meta = trace.metadata
|
|
110
|
-
f.write("#
|
|
110
|
+
f.write("# Oscura CSV Export\n")
|
|
111
111
|
f.write(f"# Sample Rate: {meta.sample_rate} Hz\n")
|
|
112
112
|
f.write(f"# Time Base: {meta.time_base} s\n")
|
|
113
113
|
f.write(f"# Samples: {len(trace.data)}\n")
|
oscura/exporters/html_export.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""HTML report export for
|
|
1
|
+
"""HTML report export for Oscura.
|
|
2
2
|
|
|
3
3
|
This module provides interactive HTML report generation with embedded Plotly charts,
|
|
4
4
|
measurement tables, and custom styling/theming.
|
|
@@ -23,7 +23,7 @@ HTML_TEMPLATE = """<!DOCTYPE html>
|
|
|
23
23
|
<head>
|
|
24
24
|
<meta charset="UTF-8">
|
|
25
25
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
26
|
-
<meta name="generator" content="
|
|
26
|
+
<meta name="generator" content="Oscura Export">
|
|
27
27
|
<title>{title}</title>
|
|
28
28
|
{plotly_script}
|
|
29
29
|
<style>
|
|
@@ -235,7 +235,7 @@ HTML_TEMPLATE = """<!DOCTYPE html>
|
|
|
235
235
|
{conclusions_html}
|
|
236
236
|
|
|
237
237
|
<footer>
|
|
238
|
-
Generated by
|
|
238
|
+
Generated by Oscura · {timestamp}
|
|
239
239
|
</footer>
|
|
240
240
|
</div>
|
|
241
241
|
</body>
|
|
@@ -266,7 +266,7 @@ def export_html(
|
|
|
266
266
|
data: dict[str, Any],
|
|
267
267
|
path: str | Path,
|
|
268
268
|
*,
|
|
269
|
-
title: str = "
|
|
269
|
+
title: str = "Oscura Analysis Report",
|
|
270
270
|
author: str | None = None,
|
|
271
271
|
include_plots: bool = True,
|
|
272
272
|
self_contained: bool = True,
|
|
@@ -313,7 +313,7 @@ def export_html(
|
|
|
313
313
|
def generate_html_report(
|
|
314
314
|
data: dict[str, Any],
|
|
315
315
|
*,
|
|
316
|
-
title: str = "
|
|
316
|
+
title: str = "Oscura Analysis Report",
|
|
317
317
|
author: str | None = None,
|
|
318
318
|
include_plots: bool = True,
|
|
319
319
|
self_contained: bool = True,
|
oscura/exporters/json_export.py
CHANGED
|
@@ -25,8 +25,8 @@ import numpy as np
|
|
|
25
25
|
from oscura.core.types import DigitalTrace, TraceMetadata, WaveformTrace
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
class
|
|
29
|
-
"""JSON encoder with numpy, datetime, and
|
|
28
|
+
class OscuraJSONEncoder(json.JSONEncoder):
|
|
29
|
+
"""JSON encoder with numpy, datetime, and Oscura object support."""
|
|
30
30
|
|
|
31
31
|
def default(self, obj: Any) -> Any:
|
|
32
32
|
if isinstance(obj, WaveformTrace):
|
|
@@ -141,9 +141,9 @@ def export_json(
|
|
|
141
141
|
|
|
142
142
|
# Serialize to JSON string
|
|
143
143
|
if pretty:
|
|
144
|
-
json_str = json.dumps(output, cls=
|
|
144
|
+
json_str = json.dumps(output, cls=OscuraJSONEncoder, indent=2)
|
|
145
145
|
else:
|
|
146
|
-
json_str = json.dumps(output, cls=
|
|
146
|
+
json_str = json.dumps(output, cls=OscuraJSONEncoder)
|
|
147
147
|
|
|
148
148
|
# Write to file (with optional compression)
|
|
149
149
|
if compress:
|
|
@@ -207,9 +207,9 @@ def export_measurements(
|
|
|
207
207
|
|
|
208
208
|
with open(path, "w") as f:
|
|
209
209
|
if pretty:
|
|
210
|
-
json.dump(output, f, cls=
|
|
210
|
+
json.dump(output, f, cls=OscuraJSONEncoder, indent=2)
|
|
211
211
|
else:
|
|
212
|
-
json.dump(output, f, cls=
|
|
212
|
+
json.dump(output, f, cls=OscuraJSONEncoder)
|
|
213
213
|
|
|
214
214
|
|
|
215
215
|
def export_protocol_decode(
|
|
@@ -258,9 +258,9 @@ def export_protocol_decode(
|
|
|
258
258
|
|
|
259
259
|
with open(path, "w") as f:
|
|
260
260
|
if pretty:
|
|
261
|
-
json.dump(output, f, cls=
|
|
261
|
+
json.dump(output, f, cls=OscuraJSONEncoder, indent=2)
|
|
262
262
|
else:
|
|
263
|
-
json.dump(output, f, cls=
|
|
263
|
+
json.dump(output, f, cls=OscuraJSONEncoder)
|
|
264
264
|
|
|
265
265
|
|
|
266
266
|
def load_json(path: str | Path) -> dict[str, Any]:
|
|
@@ -283,7 +283,7 @@ def load_json(path: str | Path) -> dict[str, Any]:
|
|
|
283
283
|
|
|
284
284
|
|
|
285
285
|
__all__ = [
|
|
286
|
-
"
|
|
286
|
+
"OscuraJSONEncoder",
|
|
287
287
|
"export_json",
|
|
288
288
|
"export_measurements",
|
|
289
289
|
"export_protocol_decode",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Markdown report export for
|
|
1
|
+
"""Markdown report export for Oscura.
|
|
2
2
|
|
|
3
3
|
This module provides Markdown report generation with measurement tables,
|
|
4
4
|
plot references, and configurable sections.
|
|
@@ -22,7 +22,7 @@ def export_markdown(
|
|
|
22
22
|
data: dict[str, Any],
|
|
23
23
|
path: str | Path,
|
|
24
24
|
*,
|
|
25
|
-
title: str = "
|
|
25
|
+
title: str = "Oscura Analysis Report",
|
|
26
26
|
author: str | None = None,
|
|
27
27
|
include_plots: bool = True,
|
|
28
28
|
embed_images: bool = True,
|
|
@@ -295,7 +295,7 @@ def _generate_plots_section(
|
|
|
295
295
|
def generate_markdown_report(
|
|
296
296
|
data: dict[str, Any],
|
|
297
297
|
*,
|
|
298
|
-
title: str = "
|
|
298
|
+
title: str = "Oscura Analysis Report",
|
|
299
299
|
author: str | None = None,
|
|
300
300
|
include_plots: bool = True,
|
|
301
301
|
embed_images: bool = True,
|
oscura/exporters/npz_export.py
CHANGED
oscura/exporters/spice_export.py
CHANGED
oscura/extensibility/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Extensibility framework for plugins and custom algorithms.
|
|
2
2
|
|
|
3
3
|
This package provides registries, plugin management, and custom measurement
|
|
4
|
-
frameworks for extending
|
|
4
|
+
frameworks for extending Oscura functionality.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from .docs import (
|
oscura/extensibility/docs.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Extension documentation auto-generation system.
|
|
2
2
|
|
|
3
|
-
This module provides automatic documentation generation for
|
|
3
|
+
This module provides automatic documentation generation for Oscura extensions
|
|
4
4
|
including API reference, usage examples, and metadata extraction from docstrings.
|
|
5
5
|
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Extension point registry and management system.
|
|
2
2
|
|
|
3
3
|
This module implements a central registry for extension points that allows
|
|
4
|
-
plugins and custom code to extend
|
|
4
|
+
plugins and custom code to extend Oscura functionality at well-defined
|
|
5
5
|
integration points.
|
|
6
6
|
"""
|
|
7
7
|
|
|
@@ -170,7 +170,7 @@ class HookContext:
|
|
|
170
170
|
abort_reason: Reason for abort
|
|
171
171
|
|
|
172
172
|
Example:
|
|
173
|
-
>>> @
|
|
173
|
+
>>> @osc.hooks.register("pre_decode")
|
|
174
174
|
>>> def validate_waveform(context):
|
|
175
175
|
... if context.data.sample_rate < 1000:
|
|
176
176
|
... context.abort = True
|
|
@@ -210,19 +210,19 @@ class RegisteredHook:
|
|
|
210
210
|
|
|
211
211
|
|
|
212
212
|
class ExtensionPointRegistry:
|
|
213
|
-
"""Central registry of all extension points in
|
|
213
|
+
"""Central registry of all extension points in Oscura.
|
|
214
214
|
|
|
215
215
|
Manages registration and lookup of extension points, algorithms,
|
|
216
216
|
and hooks throughout the system.
|
|
217
217
|
|
|
218
218
|
Example:
|
|
219
219
|
>>> # List all extension points
|
|
220
|
-
>>> extension_points =
|
|
220
|
+
>>> extension_points = osc.extensions.list()
|
|
221
221
|
>>> for ep in extension_points:
|
|
222
222
|
... print(f"{ep.name} v{ep.version}")
|
|
223
223
|
|
|
224
224
|
>>> # Get specific extension point
|
|
225
|
-
>>> decoder_ep =
|
|
225
|
+
>>> decoder_ep = osc.extensions.get("protocol_decoder")
|
|
226
226
|
>>> print(f"Required methods: {decoder_ep.required_methods}")
|
|
227
227
|
|
|
228
228
|
References:
|
|
@@ -256,7 +256,7 @@ class ExtensionPointRegistry:
|
|
|
256
256
|
def initialize(self) -> None:
|
|
257
257
|
"""Initialize built-in extension points.
|
|
258
258
|
|
|
259
|
-
Registers the standard extension points that come with
|
|
259
|
+
Registers the standard extension points that come with Oscura.
|
|
260
260
|
"""
|
|
261
261
|
if self._initialized: # type: ignore[has-type]
|
|
262
262
|
return
|
|
@@ -810,7 +810,7 @@ class ExtensionPointRegistry:
|
|
|
810
810
|
name: Optional hook name for identification
|
|
811
811
|
|
|
812
812
|
Example:
|
|
813
|
-
>>> @
|
|
813
|
+
>>> @osc.hooks.register("pre_decode")
|
|
814
814
|
>>> def validate_waveform(context):
|
|
815
815
|
... if context.data.sample_rate < 1000:
|
|
816
816
|
... raise ValueError("Sample rate too low")
|
|
@@ -35,22 +35,22 @@ class MeasurementDefinition:
|
|
|
35
35
|
tags: Optional tags for categorization and search.
|
|
36
36
|
|
|
37
37
|
Example:
|
|
38
|
-
>>> import oscura as
|
|
38
|
+
>>> import oscura as osc
|
|
39
39
|
>>> def calculate_crest_factor(trace, **kwargs):
|
|
40
40
|
... peak = abs(trace.data).max()
|
|
41
41
|
... rms = (trace.data ** 2).mean() ** 0.5
|
|
42
42
|
... return peak / rms
|
|
43
|
-
>>>
|
|
43
|
+
>>> osc.register_measurement(
|
|
44
44
|
... name='crest_factor',
|
|
45
45
|
... func=calculate_crest_factor,
|
|
46
46
|
... units='ratio',
|
|
47
47
|
... category='amplitude'
|
|
48
48
|
... )
|
|
49
|
-
>>> cf =
|
|
49
|
+
>>> cf = osc.measure(trace, 'crest_factor')
|
|
50
50
|
|
|
51
51
|
Advanced Example:
|
|
52
52
|
>>> # Define measurement with full metadata
|
|
53
|
-
>>> slew_rate_defn =
|
|
53
|
+
>>> slew_rate_defn = osc.MeasurementDefinition(
|
|
54
54
|
... name='max_slew_rate',
|
|
55
55
|
... func=lambda trace: abs(trace.derivative()).max(),
|
|
56
56
|
... units='V/s',
|
|
@@ -58,7 +58,7 @@ class MeasurementDefinition:
|
|
|
58
58
|
... description='Maximum slew rate in trace',
|
|
59
59
|
... tags=['edge', 'derivative', 'speed']
|
|
60
60
|
... )
|
|
61
|
-
>>>
|
|
61
|
+
>>> osc.register_measurement(slew_rate_defn)
|
|
62
62
|
|
|
63
63
|
References:
|
|
64
64
|
API-008: Custom Measurement Framework
|
|
@@ -389,12 +389,12 @@ def register_measurement(
|
|
|
389
389
|
definition: Pre-built MeasurementDefinition.
|
|
390
390
|
|
|
391
391
|
Example:
|
|
392
|
-
>>> import oscura as
|
|
392
|
+
>>> import oscura as osc
|
|
393
393
|
>>> def calculate_crest_factor(trace, **kwargs):
|
|
394
394
|
... peak = abs(trace.data).max()
|
|
395
395
|
... rms = (trace.data ** 2).mean() ** 0.5
|
|
396
396
|
... return peak / rms
|
|
397
|
-
>>>
|
|
397
|
+
>>> osc.register_measurement(
|
|
398
398
|
... name='crest_factor',
|
|
399
399
|
... func=calculate_crest_factor,
|
|
400
400
|
... units='ratio',
|
|
@@ -427,8 +427,8 @@ def measure(trace: WaveformTrace, name: str, **kwargs: Any) -> float:
|
|
|
427
427
|
Measured value.
|
|
428
428
|
|
|
429
429
|
Example:
|
|
430
|
-
>>> import oscura as
|
|
431
|
-
>>> cf =
|
|
430
|
+
>>> import oscura as osc
|
|
431
|
+
>>> cf = osc.measure(trace, 'crest_factor')
|
|
432
432
|
>>> print(f"Crest factor: {cf:.2f}")
|
|
433
433
|
|
|
434
434
|
References:
|
|
@@ -452,8 +452,8 @@ def list_measurements(
|
|
|
452
452
|
List of measurement names.
|
|
453
453
|
|
|
454
454
|
Example:
|
|
455
|
-
>>> import oscura as
|
|
456
|
-
>>> measurements =
|
|
455
|
+
>>> import oscura as osc
|
|
456
|
+
>>> measurements = osc.list_measurements(category='amplitude')
|
|
457
457
|
>>> print(f"Amplitude measurements: {measurements}")
|
|
458
458
|
|
|
459
459
|
References:
|
|
@@ -469,7 +469,7 @@ def get_measurement_registry() -> MeasurementRegistry:
|
|
|
469
469
|
Global MeasurementRegistry instance.
|
|
470
470
|
|
|
471
471
|
Example:
|
|
472
|
-
>>> registry =
|
|
472
|
+
>>> registry = osc.get_measurement_registry()
|
|
473
473
|
>>> metadata = registry.get_metadata('crest_factor')
|
|
474
474
|
"""
|
|
475
475
|
return _registry
|
oscura/extensibility/plugins.py
CHANGED
|
@@ -23,8 +23,8 @@ class PluginError(Exception):
|
|
|
23
23
|
|
|
24
24
|
Example:
|
|
25
25
|
>>> try:
|
|
26
|
-
... plugin =
|
|
27
|
-
... except
|
|
26
|
+
... plugin = osc.load_plugin('oscura.decoders', 'flexray')
|
|
27
|
+
... except osc.PluginError as e:
|
|
28
28
|
... print(f"Plugin failed: {e}")
|
|
29
29
|
|
|
30
30
|
References:
|
|
@@ -87,20 +87,20 @@ class PluginManager:
|
|
|
87
87
|
- oscura.exporters: Export format handlers
|
|
88
88
|
|
|
89
89
|
Example:
|
|
90
|
-
>>> import oscura as
|
|
90
|
+
>>> import oscura as osc
|
|
91
91
|
>>> # Plugins auto-discovered from installed packages
|
|
92
92
|
>>> # Use plugin decoder
|
|
93
|
-
>>> can_frames =
|
|
93
|
+
>>> can_frames = osc.decode(trace, protocol='can', baudrate=500000)
|
|
94
94
|
>>> # List available plugins
|
|
95
|
-
>>> plugins =
|
|
95
|
+
>>> plugins = osc.list_plugins()
|
|
96
96
|
>>> print(f"Installed plugins: {plugins}")
|
|
97
97
|
|
|
98
98
|
Advanced Example:
|
|
99
99
|
>>> # Manually load plugin with error handling
|
|
100
100
|
>>> try:
|
|
101
|
-
... plugin =
|
|
101
|
+
... plugin = osc.load_plugin('oscura.decoders', 'flexray')
|
|
102
102
|
... print(f"Plugin loaded: {plugin.name} v{plugin.version}")
|
|
103
|
-
... except
|
|
103
|
+
... except osc.PluginError as e:
|
|
104
104
|
... print(f"Plugin failed to load: {e}")
|
|
105
105
|
|
|
106
106
|
Plugin Package Example:
|
|
@@ -361,8 +361,8 @@ def load_plugin(group: str, name: str) -> PluginMetadata:
|
|
|
361
361
|
PluginMetadata with loaded plugin.
|
|
362
362
|
|
|
363
363
|
Example:
|
|
364
|
-
>>> import oscura as
|
|
365
|
-
>>> plugin =
|
|
364
|
+
>>> import oscura as osc
|
|
365
|
+
>>> plugin = osc.load_plugin('oscura.decoders', 'flexray')
|
|
366
366
|
>>> print(f"Loaded {plugin.name} v{plugin.version}")
|
|
367
367
|
|
|
368
368
|
References:
|
|
@@ -381,8 +381,8 @@ def list_plugins(group: str | None = None) -> dict[str, list[str]]:
|
|
|
381
381
|
Dictionary mapping group names to plugin names.
|
|
382
382
|
|
|
383
383
|
Example:
|
|
384
|
-
>>> import oscura as
|
|
385
|
-
>>> plugins =
|
|
384
|
+
>>> import oscura as osc
|
|
385
|
+
>>> plugins = osc.list_plugins()
|
|
386
386
|
>>> print(f"Available decoders: {plugins['oscura.decoders']}")
|
|
387
387
|
|
|
388
388
|
References:
|
|
@@ -398,7 +398,7 @@ def get_plugin_manager() -> PluginManager:
|
|
|
398
398
|
Global PluginManager instance.
|
|
399
399
|
|
|
400
400
|
Example:
|
|
401
|
-
>>> manager =
|
|
401
|
+
>>> manager = osc.get_plugin_manager()
|
|
402
402
|
>>> loaded = manager.list_loaded_plugins()
|
|
403
403
|
"""
|
|
404
404
|
return _manager
|
oscura/extensibility/registry.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Algorithm registry for custom algorithm injection.
|
|
2
2
|
|
|
3
3
|
This module implements a registry pattern that allows users to register
|
|
4
|
-
custom algorithms and implementations at extension points throughout
|
|
4
|
+
custom algorithms and implementations at extension points throughout Oscura.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -18,13 +18,13 @@ class AlgorithmRegistry:
|
|
|
18
18
|
|
|
19
19
|
Allows users to register custom algorithms for various categories
|
|
20
20
|
(edge detection, peak finding, window functions, etc.) that can be
|
|
21
|
-
used throughout
|
|
21
|
+
used throughout Oscura.
|
|
22
22
|
|
|
23
23
|
The registry validates algorithm signatures on registration and provides
|
|
24
24
|
lookup by category and name.
|
|
25
25
|
|
|
26
26
|
Example:
|
|
27
|
-
>>> import oscura as
|
|
27
|
+
>>> import oscura as osc
|
|
28
28
|
>>> def my_edge_detector(data, threshold=0.5):
|
|
29
29
|
... '''Custom Schmitt trigger edge detector'''
|
|
30
30
|
... edges = []
|
|
@@ -36,9 +36,9 @@ class AlgorithmRegistry:
|
|
|
36
36
|
... state = new_state
|
|
37
37
|
... return edges
|
|
38
38
|
>>> # Register in algorithm registry
|
|
39
|
-
>>>
|
|
39
|
+
>>> osc.register_algorithm('my_schmitt', my_edge_detector, category='edge_detector')
|
|
40
40
|
>>> # Use custom algorithm
|
|
41
|
-
>>> edges =
|
|
41
|
+
>>> edges = osc.find_edges(trace, method='my_schmitt', threshold=0.7)
|
|
42
42
|
|
|
43
43
|
Advanced Example:
|
|
44
44
|
>>> # Register custom window function
|
|
@@ -46,11 +46,11 @@ class AlgorithmRegistry:
|
|
|
46
46
|
>>> def custom_window(n, alpha=0.5):
|
|
47
47
|
... x = np.linspace(0, 1, n)
|
|
48
48
|
... return 0.5 * (1 + np.cos(2 * np.pi * alpha * (x - 0.5)))
|
|
49
|
-
>>>
|
|
49
|
+
>>> osc.register_algorithm('custom_tukey', custom_window, category='window_func')
|
|
50
50
|
>>> # Use in FFT
|
|
51
|
-
>>> result =
|
|
51
|
+
>>> result = osc.fft(trace, nfft=8192, window='custom_tukey', alpha=0.3)
|
|
52
52
|
>>> # List available algorithms
|
|
53
|
-
>>> available =
|
|
53
|
+
>>> available = osc.get_algorithms('window_func')
|
|
54
54
|
|
|
55
55
|
References:
|
|
56
56
|
API-006: Algorithm Override Hooks
|
|
@@ -288,10 +288,10 @@ def register_algorithm(
|
|
|
288
288
|
validate: Whether to validate signature. Default True.
|
|
289
289
|
|
|
290
290
|
Example:
|
|
291
|
-
>>> import oscura as
|
|
291
|
+
>>> import oscura as osc
|
|
292
292
|
>>> def my_edge_detector(data, threshold=0.5):
|
|
293
293
|
... return find_edges_custom(data, threshold)
|
|
294
|
-
>>>
|
|
294
|
+
>>> osc.register_algorithm('my_edges', my_edge_detector, 'edge_detector')
|
|
295
295
|
|
|
296
296
|
References:
|
|
297
297
|
API-006: Algorithm Override Hooks
|
|
@@ -310,7 +310,7 @@ def get_algorithm(category: str, name: str) -> Callable[..., Any]:
|
|
|
310
310
|
The registered algorithm function.
|
|
311
311
|
|
|
312
312
|
Example:
|
|
313
|
-
>>> edge_detector =
|
|
313
|
+
>>> edge_detector = osc.get_algorithm('edge_detector', 'my_edges')
|
|
314
314
|
>>> edges = edge_detector(data)
|
|
315
315
|
|
|
316
316
|
References:
|
|
@@ -329,7 +329,7 @@ def get_algorithms(category: str) -> list[str]:
|
|
|
329
329
|
List of algorithm names.
|
|
330
330
|
|
|
331
331
|
Example:
|
|
332
|
-
>>> available =
|
|
332
|
+
>>> available = osc.get_algorithms('window_func')
|
|
333
333
|
>>> print(f"Available windows: {available}")
|
|
334
334
|
|
|
335
335
|
References:
|