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/core/exceptions.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura exception hierarchy with helpful error messages.
|
|
2
2
|
|
|
3
3
|
This module provides custom exception classes that follow a consistent
|
|
4
4
|
template for error messages: WHAT, WHY, HOW TO FIX, DOCUMENTATION LINK.
|
|
@@ -28,10 +28,10 @@ from typing import Any
|
|
|
28
28
|
DOCS_BASE_URL = "https://github.com/lair-click-bats/oscura/tree/main/docs"
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
class
|
|
32
|
-
"""Base exception for all
|
|
31
|
+
class OscuraError(Exception):
|
|
32
|
+
"""Base exception for all Oscura errors.
|
|
33
33
|
|
|
34
|
-
All
|
|
34
|
+
All Oscura exceptions inherit from this class, providing a
|
|
35
35
|
consistent interface for error handling.
|
|
36
36
|
|
|
37
37
|
Attributes:
|
|
@@ -41,8 +41,8 @@ class TraceKitError(Exception):
|
|
|
41
41
|
docs_path: Path to relevant documentation.
|
|
42
42
|
|
|
43
43
|
Example:
|
|
44
|
-
>>> raise
|
|
45
|
-
|
|
44
|
+
>>> raise OscuraError("Something went wrong")
|
|
45
|
+
OscuraError: Something went wrong
|
|
46
46
|
"""
|
|
47
47
|
|
|
48
48
|
docs_path: str = "errors"
|
|
@@ -55,7 +55,7 @@ class TraceKitError(Exception):
|
|
|
55
55
|
fix_hint: str | None = None,
|
|
56
56
|
docs_path: str | None = None,
|
|
57
57
|
) -> None:
|
|
58
|
-
"""Initialize
|
|
58
|
+
"""Initialize OscuraError.
|
|
59
59
|
|
|
60
60
|
Args:
|
|
61
61
|
message: Brief description of the error.
|
|
@@ -89,11 +89,11 @@ class TraceKitError(Exception):
|
|
|
89
89
|
return "\n".join(parts)
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
class LoaderError(
|
|
92
|
+
class LoaderError(OscuraError):
|
|
93
93
|
"""Error loading trace data from file.
|
|
94
94
|
|
|
95
95
|
Raised when a file cannot be read, parsed, or converted to
|
|
96
|
-
a
|
|
96
|
+
a Oscura data structure.
|
|
97
97
|
|
|
98
98
|
Attributes:
|
|
99
99
|
file_path: Path to the file that failed to load.
|
|
@@ -227,7 +227,7 @@ class FormatError(LoaderError):
|
|
|
227
227
|
)
|
|
228
228
|
|
|
229
229
|
|
|
230
|
-
class AnalysisError(
|
|
230
|
+
class AnalysisError(OscuraError):
|
|
231
231
|
"""Error during signal analysis.
|
|
232
232
|
|
|
233
233
|
Raised when an analysis function encounters invalid data
|
|
@@ -358,7 +358,7 @@ class SampleRateError(AnalysisError):
|
|
|
358
358
|
)
|
|
359
359
|
|
|
360
360
|
|
|
361
|
-
class ConfigurationError(
|
|
361
|
+
class ConfigurationError(OscuraError):
|
|
362
362
|
"""Invalid configuration parameters.
|
|
363
363
|
|
|
364
364
|
Raised when configuration is invalid, missing required fields,
|
|
@@ -418,7 +418,7 @@ class ConfigurationError(TraceKitError):
|
|
|
418
418
|
)
|
|
419
419
|
|
|
420
420
|
|
|
421
|
-
class ValidationError(
|
|
421
|
+
class ValidationError(OscuraError):
|
|
422
422
|
"""Data validation failed.
|
|
423
423
|
|
|
424
424
|
Raised when input data does not meet validation requirements.
|
|
@@ -470,7 +470,7 @@ class ValidationError(TraceKitError):
|
|
|
470
470
|
)
|
|
471
471
|
|
|
472
472
|
|
|
473
|
-
class ExportError(
|
|
473
|
+
class ExportError(OscuraError):
|
|
474
474
|
"""Error exporting data.
|
|
475
475
|
|
|
476
476
|
Raised when data cannot be exported to the requested format.
|
|
@@ -528,8 +528,8 @@ __all__ = [
|
|
|
528
528
|
"FormatError",
|
|
529
529
|
"InsufficientDataError",
|
|
530
530
|
"LoaderError",
|
|
531
|
+
"OscuraError",
|
|
531
532
|
"SampleRateError",
|
|
532
|
-
"TraceKitError",
|
|
533
533
|
"UnsupportedFormatError",
|
|
534
534
|
"ValidationError",
|
|
535
535
|
]
|
oscura/core/gpu_backend.py
CHANGED
|
@@ -5,7 +5,7 @@ fallback to NumPy when CuPy is unavailable or GPU processing is disabled.
|
|
|
5
5
|
|
|
6
6
|
The GPU backend is lazy-initialized and memory-safe, automatically transferring
|
|
7
7
|
data to/from GPU as needed. GPU usage can be controlled via the environment
|
|
8
|
-
variable
|
|
8
|
+
variable OSCURA_USE_GPU (0 to disable, 1 to enable).
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
Example:
|
|
@@ -19,9 +19,9 @@ Example:
|
|
|
19
19
|
>>> freqs = cpu_only.fft(signal_data)
|
|
20
20
|
|
|
21
21
|
Configuration:
|
|
22
|
-
Set
|
|
23
|
-
-
|
|
24
|
-
-
|
|
22
|
+
Set OSCURA_USE_GPU environment variable to control GPU usage:
|
|
23
|
+
- OSCURA_USE_GPU=0: Force CPU-only operation
|
|
24
|
+
- OSCURA_USE_GPU=1: Enable GPU if available (default)
|
|
25
25
|
|
|
26
26
|
References:
|
|
27
27
|
- CuPy documentation: https://docs.cupy.dev/
|
|
@@ -98,7 +98,7 @@ class GPUBackend:
|
|
|
98
98
|
self._initialized = True
|
|
99
99
|
|
|
100
100
|
# Check environment variable override
|
|
101
|
-
use_gpu_env = os.environ.get("
|
|
101
|
+
use_gpu_env = os.environ.get("OSCURA_USE_GPU", "1")
|
|
102
102
|
if use_gpu_env == "0" or self._force_cpu:
|
|
103
103
|
self._gpu_available = False
|
|
104
104
|
return False
|
oscura/core/lazy.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Lazy evaluation module for deferred computation in
|
|
1
|
+
"""Lazy evaluation module for deferred computation in Oscura workflows.
|
|
2
2
|
|
|
3
3
|
This module provides lazy evaluation primitives that defer computation until
|
|
4
4
|
results are actually accessed. Designed for analysis workflows where not all
|
|
@@ -9,7 +9,7 @@ Key features:
|
|
|
9
9
|
- Chained operations without eager evaluation
|
|
10
10
|
- Partial evaluation (compute subset of results)
|
|
11
11
|
- Memory-efficient release of source data after computation
|
|
12
|
-
- Integration with
|
|
12
|
+
- Integration with Oscura's memory monitoring and progress tracking
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
Example:
|
|
@@ -41,7 +41,7 @@ Example:
|
|
|
41
41
|
References:
|
|
42
42
|
Python lazy evaluation patterns
|
|
43
43
|
Threading locks for thread-safe computation
|
|
44
|
-
|
|
44
|
+
Oscura memory monitoring (core.memory_monitor)
|
|
45
45
|
"""
|
|
46
46
|
|
|
47
47
|
from __future__ import annotations
|
oscura/core/logging.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Structured logging infrastructure for
|
|
1
|
+
"""Structured logging infrastructure for Oscura.
|
|
2
2
|
|
|
3
3
|
This module provides structured logging with JSON/logfmt support,
|
|
4
4
|
hierarchical loggers, log rotation, and error context capture.
|
|
@@ -468,7 +468,7 @@ def configure_logging(
|
|
|
468
468
|
timestamp_format: Literal["iso8601", "iso8601_local", "unix"] = "iso8601",
|
|
469
469
|
handlers: dict[str, dict[str, Any]] | None = None,
|
|
470
470
|
) -> None:
|
|
471
|
-
"""Configure
|
|
471
|
+
"""Configure Oscura logging.
|
|
472
472
|
|
|
473
473
|
Sets up structured logging with the specified format and handlers.
|
|
474
474
|
Supports both size-based and time-based log rotation with optional
|
|
@@ -864,15 +864,15 @@ def _init_logging() -> None:
|
|
|
864
864
|
"""Initialize logging with environment variable configuration.
|
|
865
865
|
|
|
866
866
|
Reads:
|
|
867
|
-
|
|
868
|
-
|
|
867
|
+
OSCURA_LOG_LEVEL: Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
|
|
868
|
+
OSCURA_LOG_FORMAT: Log format (json, logfmt, text)
|
|
869
869
|
|
|
870
870
|
References:
|
|
871
871
|
LOG-001: Structured Logging Framework
|
|
872
872
|
LOG-002: Hierarchical Log Levels
|
|
873
873
|
"""
|
|
874
|
-
level = os.environ.get("
|
|
875
|
-
log_format = os.environ.get("
|
|
874
|
+
level = os.environ.get("OSCURA_LOG_LEVEL", "WARNING")
|
|
875
|
+
log_format = os.environ.get("OSCURA_LOG_FORMAT", "text")
|
|
876
876
|
|
|
877
877
|
if log_format in ("json", "logfmt", "text"):
|
|
878
878
|
configure_logging(level=level, format=log_format) # type: ignore[arg-type]
|
oscura/core/logging_advanced.py
CHANGED
oscura/core/memoize.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"""Memory-safe memoization decorators for
|
|
1
|
+
"""Memory-safe memoization decorators for Oscura analyzer functions.
|
|
2
2
|
|
|
3
3
|
This module provides lightweight memoization decorators optimized for analyzer
|
|
4
|
-
functions that process numpy arrays. Unlike the full
|
|
4
|
+
functions that process numpy arrays. Unlike the full OscuraCache, these
|
|
5
5
|
decorators provide simple in-memory caching with bounded size.
|
|
6
6
|
|
|
7
7
|
|
|
@@ -92,7 +92,7 @@ def memoize_analysis(maxsize: int = 32) -> Callable[[Callable[..., T]], Callable
|
|
|
92
92
|
>>> assert edges1 is edges2
|
|
93
93
|
|
|
94
94
|
Note:
|
|
95
|
-
Cache is stored per-function. Use
|
|
95
|
+
Cache is stored per-function. Use OscuraCache from core.cache
|
|
96
96
|
for persistent cross-function caching.
|
|
97
97
|
|
|
98
98
|
References:
|
oscura/core/memory_check.py
CHANGED
oscura/core/memory_guard.py
CHANGED
oscura/core/memory_limits.py
CHANGED
oscura/core/memory_monitor.py
CHANGED
oscura/core/memory_progress.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Memory usage logging and progress tracking for
|
|
1
|
+
"""Memory usage logging and progress tracking for Oscura operations.
|
|
2
2
|
|
|
3
3
|
This module provides detailed memory profiling logs for debugging and monitoring
|
|
4
4
|
memory usage during long-running operations.
|
oscura/core/memory_warnings.py
CHANGED
oscura/core/progress.py
CHANGED
oscura/core/provenance.py
CHANGED
|
@@ -17,8 +17,8 @@ import numpy as np
|
|
|
17
17
|
if TYPE_CHECKING:
|
|
18
18
|
from numpy.typing import NDArray
|
|
19
19
|
|
|
20
|
-
#
|
|
21
|
-
|
|
20
|
+
# Oscura version (in production would import from __version__)
|
|
21
|
+
OSCURA_VERSION = "0.1.0"
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@dataclass
|
|
@@ -32,7 +32,7 @@ class Provenance:
|
|
|
32
32
|
algorithm: Name of algorithm or method used.
|
|
33
33
|
parameters: Dictionary of parameters passed to the algorithm.
|
|
34
34
|
timestamp: ISO 8601 timestamp of computation.
|
|
35
|
-
library_version: Version of
|
|
35
|
+
library_version: Version of Oscura used.
|
|
36
36
|
input_hash: Optional hash of input data for change detection.
|
|
37
37
|
metadata: Additional context information.
|
|
38
38
|
|
|
@@ -51,7 +51,7 @@ class Provenance:
|
|
|
51
51
|
algorithm: str
|
|
52
52
|
parameters: dict[str, Any] = field(default_factory=dict)
|
|
53
53
|
timestamp: str = field(default_factory=lambda: datetime.now(UTC).isoformat())
|
|
54
|
-
library_version: str =
|
|
54
|
+
library_version: str = OSCURA_VERSION
|
|
55
55
|
input_hash: str | None = None
|
|
56
56
|
metadata: dict[str, Any] = field(default_factory=dict)
|
|
57
57
|
|
|
@@ -92,7 +92,7 @@ class Provenance:
|
|
|
92
92
|
algorithm=data["algorithm"],
|
|
93
93
|
parameters=data.get("parameters", {}),
|
|
94
94
|
timestamp=data.get("timestamp", ""),
|
|
95
|
-
library_version=data.get("library_version",
|
|
95
|
+
library_version=data.get("library_version", OSCURA_VERSION),
|
|
96
96
|
input_hash=data.get("input_hash"),
|
|
97
97
|
metadata=data.get("metadata", {}),
|
|
98
98
|
)
|
oscura/core/results.py
CHANGED
|
@@ -109,7 +109,7 @@ class FFTResult(AnalysisResult):
|
|
|
109
109
|
trace: Original or transformed trace (optional).
|
|
110
110
|
|
|
111
111
|
Example:
|
|
112
|
-
>>> fft_result =
|
|
112
|
+
>>> fft_result = osc.fft(trace, nfft=8192)
|
|
113
113
|
>>> spectrum = fft_result.spectrum
|
|
114
114
|
>>> frequencies = fft_result.frequencies
|
|
115
115
|
>>> power = fft_result.power
|
|
@@ -186,7 +186,7 @@ class FilterResult(AnalysisResult):
|
|
|
186
186
|
filter_coefficients: Filter coefficients (sos or ba format) (optional).
|
|
187
187
|
|
|
188
188
|
Example:
|
|
189
|
-
>>> filter_result =
|
|
189
|
+
>>> filter_result = osc.low_pass(trace, cutoff=1e6, return_details=True)
|
|
190
190
|
>>> filtered_trace = filter_result.trace
|
|
191
191
|
>>> transfer_func = filter_result.transfer_function
|
|
192
192
|
>>> impulse_resp = filter_result.impulse_response
|
|
@@ -233,7 +233,7 @@ class WaveletResult(AnalysisResult):
|
|
|
233
233
|
trace: Original trace (optional).
|
|
234
234
|
|
|
235
235
|
Example:
|
|
236
|
-
>>> wavelet_result =
|
|
236
|
+
>>> wavelet_result = osc.wavelet_transform(trace)
|
|
237
237
|
>>> coeffs = wavelet_result.coeffs
|
|
238
238
|
>>> scales = wavelet_result.scales
|
|
239
239
|
>>> frequencies = wavelet_result.frequencies
|
oscura/core/types.py
CHANGED
oscura/core/uncertainty.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Measurement uncertainty propagation and estimation.
|
|
2
2
|
|
|
3
3
|
This module provides data structures and utilities for tracking measurement
|
|
4
|
-
uncertainty through
|
|
4
|
+
uncertainty through Oscura analysis operations, following GUM (Guide to the
|
|
5
5
|
Expression of Uncertainty in Measurement) principles.
|
|
6
6
|
|
|
7
7
|
References:
|
oscura/discovery/__init__.py
CHANGED
|
@@ -6,13 +6,13 @@ assessment, and automatic protocol decoding.
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Example:
|
|
9
|
-
>>> import oscura as
|
|
10
|
-
>>> trace =
|
|
11
|
-
>>> result =
|
|
9
|
+
>>> import oscura as osc
|
|
10
|
+
>>> trace = osc.load("capture.wfm")
|
|
11
|
+
>>> result = osc.discovery.characterize_signal(trace)
|
|
12
12
|
>>> print(f"Signal type: {result.signal_type} (confidence: {result.confidence:.2f})")
|
|
13
13
|
|
|
14
14
|
References:
|
|
15
|
-
|
|
15
|
+
Oscura Auto-Discovery Requirements
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
from oscura.discovery.anomaly_detector import (
|
oscura/discovery/comparison.py
CHANGED
oscura/dsl/__init__.py
CHANGED
oscura/dsl/commands.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura DSL Commands.
|
|
2
2
|
|
|
3
3
|
Built-in command implementations for DSL.
|
|
4
4
|
"""
|
|
@@ -7,7 +7,7 @@ import sys
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
|
-
from oscura.core.exceptions import
|
|
10
|
+
from oscura.core.exceptions import OscuraError
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def cmd_load(filename: str) -> Any:
|
|
@@ -20,12 +20,12 @@ def cmd_load(filename: str) -> Any:
|
|
|
20
20
|
Loaded trace object
|
|
21
21
|
|
|
22
22
|
Raises:
|
|
23
|
-
|
|
23
|
+
OscuraError: If file cannot be loaded
|
|
24
24
|
"""
|
|
25
25
|
path = Path(filename)
|
|
26
26
|
|
|
27
27
|
if not path.exists():
|
|
28
|
-
raise
|
|
28
|
+
raise OscuraError(f"File not found: {filename}")
|
|
29
29
|
|
|
30
30
|
# Determine loader based on extension
|
|
31
31
|
ext = path.suffix.lower()
|
|
@@ -50,10 +50,10 @@ def cmd_load(filename: str) -> Any:
|
|
|
50
50
|
|
|
51
51
|
return load_hdf5(str(path))
|
|
52
52
|
else:
|
|
53
|
-
raise
|
|
53
|
+
raise OscuraError(f"Unsupported file format: {ext}")
|
|
54
54
|
|
|
55
55
|
except ImportError as e:
|
|
56
|
-
raise
|
|
56
|
+
raise OscuraError(f"Loader not available for {ext}: {e}") # noqa: B904
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
def cmd_filter(trace: Any, filter_type: str, *args: Any, **kwargs: Any) -> Any:
|
|
@@ -69,36 +69,36 @@ def cmd_filter(trace: Any, filter_type: str, *args: Any, **kwargs: Any) -> Any:
|
|
|
69
69
|
Filtered trace
|
|
70
70
|
|
|
71
71
|
Raises:
|
|
72
|
-
|
|
72
|
+
OscuraError: If filter cannot be applied
|
|
73
73
|
"""
|
|
74
74
|
try:
|
|
75
75
|
from oscura.filtering import filters # type: ignore[attr-defined]
|
|
76
76
|
|
|
77
77
|
if filter_type.lower() == "lowpass":
|
|
78
78
|
if len(args) < 1:
|
|
79
|
-
raise
|
|
79
|
+
raise OscuraError("lowpass filter requires cutoff frequency")
|
|
80
80
|
return filters.low_pass(trace, cutoff=args[0], **kwargs)
|
|
81
81
|
|
|
82
82
|
elif filter_type.lower() == "highpass":
|
|
83
83
|
if len(args) < 1:
|
|
84
|
-
raise
|
|
84
|
+
raise OscuraError("highpass filter requires cutoff frequency")
|
|
85
85
|
return filters.high_pass(trace, cutoff=args[0], **kwargs)
|
|
86
86
|
|
|
87
87
|
elif filter_type.lower() == "bandpass":
|
|
88
88
|
if len(args) < 2:
|
|
89
|
-
raise
|
|
89
|
+
raise OscuraError("bandpass filter requires low and high cutoff frequencies")
|
|
90
90
|
return filters.band_pass(trace, low=args[0], high=args[1], **kwargs)
|
|
91
91
|
|
|
92
92
|
elif filter_type.lower() == "bandstop":
|
|
93
93
|
if len(args) < 2:
|
|
94
|
-
raise
|
|
94
|
+
raise OscuraError("bandstop filter requires low and high cutoff frequencies")
|
|
95
95
|
return filters.band_stop(trace, low=args[0], high=args[1], **kwargs)
|
|
96
96
|
|
|
97
97
|
else:
|
|
98
|
-
raise
|
|
98
|
+
raise OscuraError(f"Unknown filter type: {filter_type}")
|
|
99
99
|
|
|
100
100
|
except ImportError:
|
|
101
|
-
raise
|
|
101
|
+
raise OscuraError("Filtering module not available") # noqa: B904
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
def cmd_measure(trace: Any, *measurements: str) -> Any:
|
|
@@ -112,7 +112,7 @@ def cmd_measure(trace: Any, *measurements: str) -> Any:
|
|
|
112
112
|
Measurement results (single value or dict)
|
|
113
113
|
|
|
114
114
|
Raises:
|
|
115
|
-
|
|
115
|
+
OscuraError: If measurement cannot be performed
|
|
116
116
|
"""
|
|
117
117
|
try:
|
|
118
118
|
from oscura.analyzers import ( # type: ignore[attr-defined]
|
|
@@ -120,7 +120,7 @@ def cmd_measure(trace: Any, *measurements: str) -> Any:
|
|
|
120
120
|
)
|
|
121
121
|
|
|
122
122
|
if len(measurements) == 0:
|
|
123
|
-
raise
|
|
123
|
+
raise OscuraError("measure command requires at least one measurement name")
|
|
124
124
|
|
|
125
125
|
results = {}
|
|
126
126
|
|
|
@@ -146,7 +146,7 @@ def cmd_measure(trace: Any, *measurements: str) -> Any:
|
|
|
146
146
|
results = meas.measure_all(trace)
|
|
147
147
|
break
|
|
148
148
|
else:
|
|
149
|
-
raise
|
|
149
|
+
raise OscuraError(f"Unknown measurement: {measurement}")
|
|
150
150
|
|
|
151
151
|
# Return single value if only one measurement
|
|
152
152
|
if len(results) == 1:
|
|
@@ -155,7 +155,7 @@ def cmd_measure(trace: Any, *measurements: str) -> Any:
|
|
|
155
155
|
return results
|
|
156
156
|
|
|
157
157
|
except ImportError:
|
|
158
|
-
raise
|
|
158
|
+
raise OscuraError("Measurements module not available") # noqa: B904
|
|
159
159
|
|
|
160
160
|
|
|
161
161
|
def cmd_plot(trace: Any, **options: Any) -> None:
|
|
@@ -166,7 +166,7 @@ def cmd_plot(trace: Any, **options: Any) -> None:
|
|
|
166
166
|
**options: Plot options (title, annotate, etc.)
|
|
167
167
|
|
|
168
168
|
Raises:
|
|
169
|
-
|
|
169
|
+
OscuraError: If plotting fails
|
|
170
170
|
"""
|
|
171
171
|
try:
|
|
172
172
|
from oscura.visualization import ( # type: ignore[attr-defined]
|
|
@@ -184,7 +184,7 @@ def cmd_plot(trace: Any, **options: Any) -> None:
|
|
|
184
184
|
plot_module.show()
|
|
185
185
|
|
|
186
186
|
except ImportError:
|
|
187
|
-
raise
|
|
187
|
+
raise OscuraError("Visualization module not available") # noqa: B904
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
def cmd_export(data: Any, format_type: str, filename: str | None = None) -> None:
|
|
@@ -196,7 +196,7 @@ def cmd_export(data: Any, format_type: str, filename: str | None = None) -> None
|
|
|
196
196
|
filename: Output filename (optional, auto-generated if None)
|
|
197
197
|
|
|
198
198
|
Raises:
|
|
199
|
-
|
|
199
|
+
OscuraError: If export fails
|
|
200
200
|
"""
|
|
201
201
|
try:
|
|
202
202
|
from oscura.exporters import exporters # type: ignore[attr-defined]
|
|
@@ -213,12 +213,12 @@ def cmd_export(data: Any, format_type: str, filename: str | None = None) -> None
|
|
|
213
213
|
elif fmt in ("h5", "hdf5"):
|
|
214
214
|
exporters.hdf5(data, filename)
|
|
215
215
|
else:
|
|
216
|
-
raise
|
|
216
|
+
raise OscuraError(f"Unknown export format: {format_type}")
|
|
217
217
|
|
|
218
218
|
print(f"Exported to {filename}", file=sys.stderr)
|
|
219
219
|
|
|
220
220
|
except ImportError:
|
|
221
|
-
raise
|
|
221
|
+
raise OscuraError("Export module not available") # noqa: B904
|
|
222
222
|
|
|
223
223
|
|
|
224
224
|
def cmd_glob(pattern: str) -> list[str]:
|
oscura/dsl/interpreter.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura DSL Interpreter.
|
|
2
2
|
|
|
3
3
|
Executes parsed DSL programs.
|
|
4
4
|
"""
|
|
@@ -30,7 +30,7 @@ class InterpreterError(Exception):
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class Interpreter:
|
|
33
|
-
"""DSL interpreter for
|
|
33
|
+
"""DSL interpreter for Oscura commands.
|
|
34
34
|
|
|
35
35
|
Executes parsed AST with Python implementations of DSL commands.
|
|
36
36
|
"""
|
|
@@ -69,7 +69,7 @@ class Interpreter:
|
|
|
69
69
|
if not path.exists():
|
|
70
70
|
raise InterpreterError(f"File not found: {filename}")
|
|
71
71
|
|
|
72
|
-
# Load the file using
|
|
72
|
+
# Load the file using Oscura's loader
|
|
73
73
|
return load(str(path))
|
|
74
74
|
|
|
75
75
|
except ImportError as e:
|
|
@@ -434,7 +434,7 @@ class Interpreter:
|
|
|
434
434
|
|
|
435
435
|
|
|
436
436
|
def execute_dsl(source: str, variables: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
437
|
-
"""Execute
|
|
437
|
+
"""Execute Oscura DSL source code.
|
|
438
438
|
|
|
439
439
|
Args:
|
|
440
440
|
source: DSL source code
|
oscura/dsl/parser.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura DSL Parser.
|
|
2
2
|
|
|
3
3
|
Implements simple domain-specific language for trace analysis workflows.
|
|
4
4
|
"""
|
|
@@ -53,7 +53,7 @@ class Token:
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
class Lexer:
|
|
56
|
-
"""Tokenizer for
|
|
56
|
+
"""Tokenizer for Oscura DSL.
|
|
57
57
|
|
|
58
58
|
Breaks input text into tokens for parsing.
|
|
59
59
|
Supports indentation-based block structure (Python-style).
|
|
@@ -407,7 +407,7 @@ Statement = Union[Assignment, Pipeline, ForLoop, FunctionCall]
|
|
|
407
407
|
|
|
408
408
|
|
|
409
409
|
class Parser:
|
|
410
|
-
"""Recursive descent parser for
|
|
410
|
+
"""Recursive descent parser for Oscura DSL.
|
|
411
411
|
|
|
412
412
|
Parses token stream into abstract syntax tree.
|
|
413
413
|
Supports indentation-based block structure.
|
|
@@ -661,7 +661,7 @@ class Parser:
|
|
|
661
661
|
|
|
662
662
|
|
|
663
663
|
def parse_dsl(source: str) -> list[Statement]:
|
|
664
|
-
"""Parse
|
|
664
|
+
"""Parse Oscura DSL source code.
|
|
665
665
|
|
|
666
666
|
Args:
|
|
667
667
|
source: DSL source code
|
oscura/dsl/repl.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura DSL REPL (Read-Eval-Print Loop).
|
|
2
2
|
|
|
3
|
-
Interactive shell for
|
|
3
|
+
Interactive shell for Oscura DSL.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import sys
|
|
@@ -19,13 +19,13 @@ class REPL:
|
|
|
19
19
|
|
|
20
20
|
def print_banner(self) -> None:
|
|
21
21
|
"""Print welcome banner."""
|
|
22
|
-
print("
|
|
22
|
+
print("Oscura DSL REPL v0.1.0")
|
|
23
23
|
print("Type 'exit' or 'quit' to exit, 'help' for help")
|
|
24
24
|
print()
|
|
25
25
|
|
|
26
26
|
def print_help(self) -> None:
|
|
27
27
|
"""Print help message."""
|
|
28
|
-
print("
|
|
28
|
+
print("Oscura DSL Commands:")
|
|
29
29
|
print(" load <filename> - Load a trace file")
|
|
30
30
|
print(" filter <type> <params> - Apply filter (lowpass, highpass, etc.)")
|
|
31
31
|
print(" measure <name> - Measure property (rise_time, etc.)")
|
oscura/exceptions.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura exception hierarchy - DEPRECATED compatibility module.
|
|
2
2
|
|
|
3
3
|
.. deprecated:: 1.0.0
|
|
4
4
|
This module is deprecated for backward compatibility only.
|
|
@@ -39,8 +39,8 @@ from oscura.core.exceptions import ( # noqa: E402
|
|
|
39
39
|
FormatError,
|
|
40
40
|
InsufficientDataError,
|
|
41
41
|
LoaderError,
|
|
42
|
+
OscuraError,
|
|
42
43
|
SampleRateError,
|
|
43
|
-
TraceKitError,
|
|
44
44
|
UnsupportedFormatError,
|
|
45
45
|
ValidationError,
|
|
46
46
|
)
|
|
@@ -52,8 +52,8 @@ __all__ = [
|
|
|
52
52
|
"FormatError",
|
|
53
53
|
"InsufficientDataError",
|
|
54
54
|
"LoaderError",
|
|
55
|
+
"OscuraError",
|
|
55
56
|
"SampleRateError",
|
|
56
|
-
"TraceKitError",
|
|
57
57
|
"UnsupportedFormatError",
|
|
58
58
|
"ValidationError",
|
|
59
59
|
]
|