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/cli/shell.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"""Interactive REPL shell for
|
|
1
|
+
"""Interactive REPL shell for Oscura exploration.
|
|
2
2
|
|
|
3
|
-
This module provides an interactive Python shell with
|
|
3
|
+
This module provides an interactive Python shell with Oscura auto-imports,
|
|
4
4
|
tab completion, and persistent history for exploratory data analysis.
|
|
5
5
|
|
|
6
|
-
- Auto-imports
|
|
6
|
+
- Auto-imports Oscura modules
|
|
7
7
|
- Tab completion for methods and attributes
|
|
8
8
|
- Persistent command history
|
|
9
9
|
- Customized prompt with context info
|
|
10
10
|
|
|
11
11
|
Example:
|
|
12
12
|
$ oscura shell
|
|
13
|
-
|
|
14
|
-
Type 'help()' for
|
|
13
|
+
Oscura Shell v0.1.0
|
|
14
|
+
Type 'help()' for Oscura help, 'exit()' to quit.
|
|
15
15
|
|
|
16
16
|
In [1]: trace = load("capture.wfm")
|
|
17
17
|
In [2]: rise_time(trace)
|
|
@@ -40,18 +40,18 @@ HISTORY_LENGTH = 1000
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def get_oscura_namespace() -> dict[str, Any]:
|
|
43
|
-
"""Build namespace with
|
|
43
|
+
"""Build namespace with Oscura auto-imports.
|
|
44
44
|
|
|
45
45
|
Returns:
|
|
46
|
-
Dictionary with all commonly-used
|
|
46
|
+
Dictionary with all commonly-used Oscura functions and classes.
|
|
47
47
|
"""
|
|
48
48
|
namespace: dict[str, Any] = {}
|
|
49
49
|
|
|
50
50
|
# Core imports
|
|
51
51
|
try:
|
|
52
|
-
import oscura as
|
|
52
|
+
import oscura as osc
|
|
53
53
|
|
|
54
|
-
namespace["
|
|
54
|
+
namespace["osc"] = osc
|
|
55
55
|
|
|
56
56
|
# Auto-import commonly used functions at top level
|
|
57
57
|
from oscura import (
|
|
@@ -191,7 +191,7 @@ def get_oscura_namespace() -> dict[str, Any]:
|
|
|
191
191
|
pass
|
|
192
192
|
|
|
193
193
|
except ImportError as e:
|
|
194
|
-
print(f"Warning: Could not import
|
|
194
|
+
print(f"Warning: Could not import Oscura: {e}")
|
|
195
195
|
|
|
196
196
|
# Common utilities
|
|
197
197
|
try:
|
|
@@ -229,9 +229,9 @@ def setup_history() -> None:
|
|
|
229
229
|
|
|
230
230
|
|
|
231
231
|
def oscura_help() -> None:
|
|
232
|
-
"""Display
|
|
232
|
+
"""Display Oscura help in the REPL."""
|
|
233
233
|
help_text = """
|
|
234
|
-
|
|
234
|
+
Oscura Interactive Shell - Quick Reference
|
|
235
235
|
=============================================
|
|
236
236
|
|
|
237
237
|
Loading Data:
|
|
@@ -277,14 +277,14 @@ Full documentation: https://github.com/lair-click-bats/oscura
|
|
|
277
277
|
print(help_text)
|
|
278
278
|
|
|
279
279
|
|
|
280
|
-
class
|
|
281
|
-
"""Custom interactive console for
|
|
280
|
+
class OscuraConsole(code.InteractiveConsole):
|
|
281
|
+
"""Custom interactive console for Oscura.
|
|
282
282
|
|
|
283
283
|
Provides IPython-style prompts and enhanced error handling.
|
|
284
284
|
"""
|
|
285
285
|
|
|
286
286
|
def __init__(self, locals: dict[str, Any] | None = None) -> None:
|
|
287
|
-
"""Initialize the console with
|
|
287
|
+
"""Initialize the console with Oscura namespace."""
|
|
288
288
|
super().__init__(locals=locals, filename="<oscura>")
|
|
289
289
|
self.prompt_counter = 1
|
|
290
290
|
|
|
@@ -294,7 +294,7 @@ class TraceKitConsole(code.InteractiveConsole):
|
|
|
294
294
|
import oscura
|
|
295
295
|
|
|
296
296
|
banner = f"""
|
|
297
|
-
|
|
297
|
+
Oscura Shell v{oscura.__version__}
|
|
298
298
|
Python {sys.version.split()[0]} on {sys.platform}
|
|
299
299
|
Type 'oscura_help()' for quick reference, 'exit()' to quit.
|
|
300
300
|
|
|
@@ -320,10 +320,10 @@ Common functions: load, measure, fft, psd, thd, low_pass, high_pass
|
|
|
320
320
|
|
|
321
321
|
|
|
322
322
|
def start_shell() -> None:
|
|
323
|
-
"""Start the
|
|
323
|
+
"""Start the Oscura interactive shell.
|
|
324
324
|
|
|
325
325
|
This is the main entry point for the REPL, providing:
|
|
326
|
-
- Auto-imported
|
|
326
|
+
- Auto-imported Oscura functions and modules
|
|
327
327
|
- Tab completion
|
|
328
328
|
- Persistent command history
|
|
329
329
|
- Customized prompts
|
|
@@ -342,7 +342,7 @@ def start_shell() -> None:
|
|
|
342
342
|
readline.set_completer(completer.complete)
|
|
343
343
|
|
|
344
344
|
# Start console
|
|
345
|
-
console =
|
|
345
|
+
console = OscuraConsole(locals=namespace)
|
|
346
346
|
console.interact()
|
|
347
347
|
|
|
348
348
|
|
oscura/comparison/__init__.py
CHANGED
oscura/comparison/compare.py
CHANGED
oscura/comparison/golden.py
CHANGED
oscura/comparison/limits.py
CHANGED
oscura/comparison/mask.py
CHANGED
oscura/comparison/trace_diff.py
CHANGED
oscura/compliance/__init__.py
CHANGED
|
@@ -6,10 +6,10 @@ and MIL-STD standards.
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Example:
|
|
9
|
-
>>> import oscura as
|
|
9
|
+
>>> import oscura as osc
|
|
10
10
|
>>> from oscura.compliance import load_limit_mask, check_compliance, generate_compliance_report
|
|
11
11
|
>>>
|
|
12
|
-
>>> trace =
|
|
12
|
+
>>> trace = osc.load('emissions.wfm')
|
|
13
13
|
>>> mask = load_limit_mask('FCC_Part15_ClassB')
|
|
14
14
|
>>> result = check_compliance(trace, mask)
|
|
15
15
|
>>> generate_compliance_report(result, 'compliance_report.html')
|
oscura/compliance/reporting.py
CHANGED
|
@@ -295,7 +295,7 @@ def _generate_html_report(
|
|
|
295
295
|
<div class="footer">
|
|
296
296
|
<p>Report generated: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}</p>
|
|
297
297
|
<p>Detector: {result.detector} | Distance: {result.metadata.get("distance", "N/A")}m</p>
|
|
298
|
-
<p>Generated by
|
|
298
|
+
<p>Generated by Oscura EMC Compliance Module</p>
|
|
299
299
|
</div>
|
|
300
300
|
</body>
|
|
301
301
|
</html>
|
|
@@ -426,7 +426,7 @@ def _generate_markdown_report(
|
|
|
426
426
|
md += f"""
|
|
427
427
|
---
|
|
428
428
|
*Report generated: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}*
|
|
429
|
-
*Generated by
|
|
429
|
+
*Generated by Oscura EMC Compliance Module*
|
|
430
430
|
"""
|
|
431
431
|
with open(output_path, "w") as f:
|
|
432
432
|
f.write(md)
|
oscura/component/__init__.py
CHANGED
oscura/component/impedance.py
CHANGED
oscura/component/reactive.py
CHANGED
oscura/config/__init__.py
CHANGED
oscura/config/loader.py
CHANGED
oscura/config/memory.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Memory configuration module for
|
|
1
|
+
"""Memory configuration module for Oscura.
|
|
2
2
|
|
|
3
3
|
This module provides global memory limit configuration and settings.
|
|
4
4
|
|
|
@@ -22,7 +22,7 @@ from dataclasses import dataclass
|
|
|
22
22
|
|
|
23
23
|
@dataclass
|
|
24
24
|
class MemoryConfiguration:
|
|
25
|
-
"""Global memory configuration for
|
|
25
|
+
"""Global memory configuration for Oscura operations.
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
Attributes:
|
|
@@ -76,7 +76,7 @@ def get_memory_config() -> MemoryConfiguration:
|
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
def set_memory_limit(limit: int | str | None) -> None:
|
|
79
|
-
"""Set global memory limit for all
|
|
79
|
+
"""Set global memory limit for all Oscura operations.
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
Args:
|
oscura/config/migration.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Schema migration system for
|
|
1
|
+
"""Schema migration system for Oscura configuration files.
|
|
2
2
|
|
|
3
3
|
This module provides schema migration functionality to automatically upgrade
|
|
4
4
|
configuration files between schema versions while preserving user data.
|
oscura/config/preferences.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""User preferences management system.
|
|
2
2
|
|
|
3
|
-
This module provides persistent user preferences for
|
|
3
|
+
This module provides persistent user preferences for Oscura including
|
|
4
4
|
visualization settings, default parameters, export options, and UI
|
|
5
5
|
preferences.
|
|
6
6
|
"""
|
oscura/config/schema.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""JSON Schema validation system for
|
|
1
|
+
"""JSON Schema validation system for Oscura configuration.
|
|
2
2
|
|
|
3
3
|
This module provides a flexible schema validation system using JSON Schema
|
|
4
4
|
for validating configuration files including protocols, pipelines, and
|
|
@@ -29,10 +29,10 @@ except ImportError:
|
|
|
29
29
|
JsonSchemaError = Exception # type: ignore[ignore-without-code]
|
|
30
30
|
|
|
31
31
|
from oscura.core.exceptions import ConfigurationError
|
|
32
|
-
from oscura.core.exceptions import ValidationError as
|
|
32
|
+
from oscura.core.exceptions import ValidationError as OscuraValidationError
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
class ValidationError(
|
|
35
|
+
class ValidationError(OscuraValidationError):
|
|
36
36
|
"""Schema validation error with detailed location information.
|
|
37
37
|
|
|
38
38
|
Attributes:
|
oscura/config/settings.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Application settings management system.
|
|
2
2
|
|
|
3
|
-
This module provides application-wide settings management for
|
|
3
|
+
This module provides application-wide settings management for Oscura,
|
|
4
4
|
including feature flags, CLI defaults, output formats, and runtime
|
|
5
5
|
configuration options.
|
|
6
6
|
|
oscura/convenience.py
CHANGED
|
@@ -4,22 +4,22 @@ This module provides one-call solutions for common signal analysis tasks,
|
|
|
4
4
|
wrapping multiple lower-level functions into easy-to-use high-level APIs.
|
|
5
5
|
|
|
6
6
|
Example:
|
|
7
|
-
>>> import oscura as
|
|
8
|
-
>>> trace =
|
|
7
|
+
>>> import oscura as osc
|
|
8
|
+
>>> trace = osc.load("audio_capture.wfm")
|
|
9
9
|
>>>
|
|
10
10
|
>>> # One-call spectral analysis
|
|
11
|
-
>>> metrics =
|
|
11
|
+
>>> metrics = osc.quick_spectral(trace, fundamental=1000)
|
|
12
12
|
>>> print(f"THD: {metrics.thd_db:.1f} dB, SNR: {metrics.snr_db:.1f} dB")
|
|
13
13
|
>>>
|
|
14
14
|
>>> # Auto-detect and decode protocol
|
|
15
|
-
>>> result =
|
|
15
|
+
>>> result = osc.auto_decode(trace)
|
|
16
16
|
>>> print(f"Protocol: {result.protocol}, Frames: {len(result.frames)}")
|
|
17
17
|
>>>
|
|
18
18
|
>>> # Smart filtering
|
|
19
|
-
>>> clean =
|
|
19
|
+
>>> clean = osc.smart_filter(trace, target="noise")
|
|
20
20
|
|
|
21
21
|
References:
|
|
22
|
-
-
|
|
22
|
+
- Oscura API Design Guidelines
|
|
23
23
|
- IEEE 1241-2010 (ADC Characterization)
|
|
24
24
|
"""
|
|
25
25
|
|
|
@@ -106,8 +106,8 @@ def quick_spectral(
|
|
|
106
106
|
SpectralMetrics with all computed values.
|
|
107
107
|
|
|
108
108
|
Example:
|
|
109
|
-
>>> trace =
|
|
110
|
-
>>> metrics =
|
|
109
|
+
>>> trace = osc.load("audio_1khz.wfm")
|
|
110
|
+
>>> metrics = osc.quick_spectral(trace, fundamental=1000)
|
|
111
111
|
>>> print(f"THD: {metrics.thd_db:.1f} dB")
|
|
112
112
|
>>> print(f"SNR: {metrics.snr_db:.1f} dB")
|
|
113
113
|
>>> print(f"ENOB: {metrics.enob:.1f} bits")
|
|
@@ -185,8 +185,8 @@ def auto_decode(
|
|
|
185
185
|
DecodeResult with protocol name, decoded frames, and statistics.
|
|
186
186
|
|
|
187
187
|
Example:
|
|
188
|
-
>>> trace =
|
|
189
|
-
>>> result =
|
|
188
|
+
>>> trace = osc.load("serial_capture.wfm")
|
|
189
|
+
>>> result = osc.auto_decode(trace)
|
|
190
190
|
>>> print(f"Protocol: {result.protocol}")
|
|
191
191
|
>>> print(f"Frames decoded: {len(result.frames)}")
|
|
192
192
|
>>> for frame in result.frames[:5]:
|
|
@@ -325,10 +325,10 @@ def smart_filter(
|
|
|
325
325
|
Filtered WaveformTrace.
|
|
326
326
|
|
|
327
327
|
Example:
|
|
328
|
-
>>> noisy =
|
|
329
|
-
>>> clean =
|
|
328
|
+
>>> noisy = osc.load("noisy_capture.wfm")
|
|
329
|
+
>>> clean = osc.smart_filter(noisy, target="noise")
|
|
330
330
|
>>> # Or auto-detect
|
|
331
|
-
>>> clean =
|
|
331
|
+
>>> clean = osc.smart_filter(noisy, target="auto")
|
|
332
332
|
"""
|
|
333
333
|
from oscura.filtering.convenience import (
|
|
334
334
|
high_pass,
|
oscura/core/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura core module.
|
|
2
2
|
|
|
3
3
|
Provides core data types, configuration, exception handling, and logging infrastructure.
|
|
4
4
|
"""
|
|
@@ -12,7 +12,7 @@ from oscura.core.audit import (
|
|
|
12
12
|
from oscura.core.cache import (
|
|
13
13
|
CacheEntry,
|
|
14
14
|
CacheStats,
|
|
15
|
-
|
|
15
|
+
OscuraCache,
|
|
16
16
|
clear_cache,
|
|
17
17
|
get_cache,
|
|
18
18
|
show_cache_stats,
|
|
@@ -63,8 +63,8 @@ from oscura.core.exceptions import (
|
|
|
63
63
|
FormatError,
|
|
64
64
|
InsufficientDataError,
|
|
65
65
|
LoaderError,
|
|
66
|
+
OscuraError,
|
|
66
67
|
SampleRateError,
|
|
67
|
-
TraceKitError,
|
|
68
68
|
UnsupportedFormatError,
|
|
69
69
|
ValidationError,
|
|
70
70
|
)
|
|
@@ -213,6 +213,9 @@ __all__ = [
|
|
|
213
213
|
# Memory monitoring
|
|
214
214
|
"MemoryMonitor",
|
|
215
215
|
"MemorySnapshot",
|
|
216
|
+
"OscuraCache",
|
|
217
|
+
# Exceptions
|
|
218
|
+
"OscuraError",
|
|
216
219
|
"PerformanceCollector",
|
|
217
220
|
"PerformanceContext",
|
|
218
221
|
"PerformanceRecord",
|
|
@@ -226,9 +229,6 @@ __all__ = [
|
|
|
226
229
|
"SampleRateError",
|
|
227
230
|
"SignalQualityReport",
|
|
228
231
|
"Trace",
|
|
229
|
-
"TraceKitCache",
|
|
230
|
-
# Exceptions
|
|
231
|
-
"TraceKitError",
|
|
232
232
|
# Types
|
|
233
233
|
"TraceMetadata",
|
|
234
234
|
"UnsupportedFormatError",
|
oscura/core/cache.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Persistent LRU cache with disk spillover for
|
|
1
|
+
"""Persistent LRU cache with disk spillover for Oscura intermediate results.
|
|
2
2
|
|
|
3
3
|
This module provides memory-bounded caching for expensive operations like FFT,
|
|
4
4
|
spectrograms, and filtered traces with automatic disk spillover when memory
|
|
@@ -6,7 +6,7 @@ limits are exceeded.
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Example:
|
|
9
|
-
>>> from oscura.core.cache import
|
|
9
|
+
>>> from oscura.core.cache import OscuraCache, get_cache
|
|
10
10
|
>>> cache = get_cache(max_memory="2GB")
|
|
11
11
|
>>> result = cache.get_or_compute("fft_key", compute_fft, signal, 1024)
|
|
12
12
|
>>> cache.show_stats()
|
|
@@ -108,7 +108,7 @@ class CacheStats:
|
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
class
|
|
111
|
+
class OscuraCache:
|
|
112
112
|
"""LRU cache with disk spillover for intermediate results.
|
|
113
113
|
|
|
114
114
|
|
|
@@ -122,7 +122,7 @@ class TraceKitCache:
|
|
|
122
122
|
auto_cleanup: Clean up disk cache on exit (default: True).
|
|
123
123
|
|
|
124
124
|
Example:
|
|
125
|
-
>>> cache =
|
|
125
|
+
>>> cache = OscuraCache(max_memory="1GB")
|
|
126
126
|
>>> result = cache.get_or_compute("key", expensive_func, arg1, arg2)
|
|
127
127
|
>>> stats = cache.get_stats()
|
|
128
128
|
>>> cache.clear()
|
|
@@ -180,7 +180,7 @@ class TraceKitCache:
|
|
|
180
180
|
self._disk_spills = 0
|
|
181
181
|
self._current_memory = 0
|
|
182
182
|
|
|
183
|
-
def __enter__(self) ->
|
|
183
|
+
def __enter__(self) -> OscuraCache:
|
|
184
184
|
"""Enter context."""
|
|
185
185
|
return self
|
|
186
186
|
|
|
@@ -514,14 +514,14 @@ class TraceKitCache:
|
|
|
514
514
|
|
|
515
515
|
|
|
516
516
|
# Global cache instance
|
|
517
|
-
_global_cache:
|
|
517
|
+
_global_cache: OscuraCache | None = None
|
|
518
518
|
|
|
519
519
|
|
|
520
520
|
def get_cache(
|
|
521
521
|
max_memory: int | str = "2GB",
|
|
522
522
|
*,
|
|
523
523
|
cache_dir: str | Path | None = None,
|
|
524
|
-
) ->
|
|
524
|
+
) -> OscuraCache:
|
|
525
525
|
"""Get or create global cache instance.
|
|
526
526
|
|
|
527
527
|
|
|
@@ -530,7 +530,7 @@ def get_cache(
|
|
|
530
530
|
cache_dir: Cache directory.
|
|
531
531
|
|
|
532
532
|
Returns:
|
|
533
|
-
Global
|
|
533
|
+
Global OscuraCache instance.
|
|
534
534
|
|
|
535
535
|
Example:
|
|
536
536
|
>>> cache = get_cache(max_memory="1GB")
|
|
@@ -542,7 +542,7 @@ def get_cache(
|
|
|
542
542
|
global _global_cache
|
|
543
543
|
|
|
544
544
|
if _global_cache is None:
|
|
545
|
-
_global_cache =
|
|
545
|
+
_global_cache = OscuraCache(max_memory, cache_dir=cache_dir)
|
|
546
546
|
|
|
547
547
|
return _global_cache
|
|
548
548
|
|
|
@@ -583,7 +583,7 @@ def show_cache_stats() -> None:
|
|
|
583
583
|
__all__ = [
|
|
584
584
|
"CacheEntry",
|
|
585
585
|
"CacheStats",
|
|
586
|
-
"
|
|
586
|
+
"OscuraCache",
|
|
587
587
|
"clear_cache",
|
|
588
588
|
"get_cache",
|
|
589
589
|
"show_cache_stats",
|
oscura/core/cancellation.py
CHANGED
oscura/core/confidence.py
CHANGED
oscura/core/config.py
CHANGED
oscura/core/correlation.py
CHANGED
oscura/core/debug.py
CHANGED
|
@@ -250,21 +250,21 @@ def should_log_debug(min_level: DebugLevel = DebugLevel.NORMAL) -> bool:
|
|
|
250
250
|
def configure_debug_from_env() -> None:
|
|
251
251
|
"""Configure debug mode from environment variables.
|
|
252
252
|
|
|
253
|
-
Reads
|
|
253
|
+
Reads OSCURA_DEBUG environment variable and sets debug level
|
|
254
254
|
accordingly.
|
|
255
255
|
|
|
256
256
|
Environment Variables:
|
|
257
|
-
|
|
257
|
+
OSCURA_DEBUG: Debug level (minimal, normal, verbose, trace)
|
|
258
258
|
|
|
259
259
|
Example:
|
|
260
260
|
>>> import os
|
|
261
|
-
>>> os.environ['
|
|
261
|
+
>>> os.environ['OSCURA_DEBUG'] = 'verbose'
|
|
262
262
|
>>> configure_debug_from_env()
|
|
263
263
|
|
|
264
264
|
References:
|
|
265
265
|
LOG-007: Programmatic Debug Mode
|
|
266
266
|
"""
|
|
267
|
-
debug_env = os.environ.get("
|
|
267
|
+
debug_env = os.environ.get("OSCURA_DEBUG", "").lower()
|
|
268
268
|
if debug_env in _LEVEL_MAP:
|
|
269
269
|
enable_debug(level=debug_env) # type: ignore[arg-type]
|
|
270
270
|
|
oscura/core/edge_cases.py
CHANGED