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/__init__.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura - Reverse engineer ANY system from captured waveforms (analog or digital).
|
|
2
2
|
|
|
3
3
|
The open-source toolkit for complete signal reverse engineering across analog and digital domains.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Oscura provides comprehensive tools for:
|
|
6
6
|
- Waveform analysis (rise/fall time, frequency, amplitude)
|
|
7
7
|
- Digital signal analysis (edge detection, clock recovery)
|
|
8
8
|
- Spectral analysis (FFT, PSD, THD, SNR, SINAD, ENOB)
|
|
@@ -23,24 +23,24 @@ TraceKit provides comprehensive tools for:
|
|
|
23
23
|
- One-call convenience functions
|
|
24
24
|
|
|
25
25
|
Example:
|
|
26
|
-
>>> import oscura as
|
|
27
|
-
>>> trace =
|
|
28
|
-
>>> print(f"Rise time: {
|
|
29
|
-
>>> freq, mag =
|
|
30
|
-
>>> print(f"THD: {
|
|
26
|
+
>>> import oscura as osc
|
|
27
|
+
>>> trace = osc.load("capture.wfm")
|
|
28
|
+
>>> print(f"Rise time: {osc.rise_time(trace):.2e} s")
|
|
29
|
+
>>> freq, mag = osc.fft(trace)
|
|
30
|
+
>>> print(f"THD: {osc.thd(trace):.1f} dB")
|
|
31
31
|
>>> # One-call spectral analysis
|
|
32
|
-
>>> metrics =
|
|
32
|
+
>>> metrics = osc.quick_spectral(trace, fundamental=1000)
|
|
33
33
|
>>> print(f"THD: {metrics.thd_db:.1f} dB, SNR: {metrics.snr_db:.1f} dB")
|
|
34
34
|
>>> # Auto-decode protocol
|
|
35
|
-
>>> result =
|
|
35
|
+
>>> result = osc.auto_decode(trace)
|
|
36
36
|
>>> print(f"Protocol: {result.protocol}, Frames: {len(result.frames)}")
|
|
37
37
|
>>> # Generate test signals
|
|
38
|
-
>>> signal = (
|
|
38
|
+
>>> signal = (osc.SignalBuilder(sample_rate=1e6, duration=0.01)
|
|
39
39
|
... .add_sine(frequency=1000)
|
|
40
40
|
... .add_noise(snr_db=40)
|
|
41
41
|
... .build())
|
|
42
42
|
>>> # Reverse engineer unknown signal
|
|
43
|
-
>>> result =
|
|
43
|
+
>>> result = osc.workflows.reverse_engineer_signal(trace)
|
|
44
44
|
>>> print(result.protocol_spec)
|
|
45
45
|
|
|
46
46
|
For more information, see https://github.com/lair-click-bats/oscura
|
|
@@ -254,8 +254,8 @@ from oscura.core.exceptions import (
|
|
|
254
254
|
FormatError,
|
|
255
255
|
InsufficientDataError,
|
|
256
256
|
LoaderError,
|
|
257
|
+
OscuraError,
|
|
257
258
|
SampleRateError,
|
|
258
|
-
TraceKitError,
|
|
259
259
|
UnsupportedFormatError,
|
|
260
260
|
ValidationError,
|
|
261
261
|
)
|
|
@@ -544,6 +544,8 @@ __all__ = [
|
|
|
544
544
|
"NoiseMarginResult",
|
|
545
545
|
"NumberFormatter",
|
|
546
546
|
"OperationHistory",
|
|
547
|
+
# Exceptions
|
|
548
|
+
"OscuraError",
|
|
547
549
|
# Signal quality (QUAL-007)
|
|
548
550
|
"PLLRecoveryResult",
|
|
549
551
|
# Expert API - Pipeline (API-001, API-002, API-004)
|
|
@@ -578,8 +580,6 @@ __all__ = [
|
|
|
578
580
|
"Trace",
|
|
579
581
|
# Discovery
|
|
580
582
|
"TraceDiff",
|
|
581
|
-
# Exceptions
|
|
582
|
-
"TraceKitError",
|
|
583
583
|
# Core types
|
|
584
584
|
"TraceMetadata",
|
|
585
585
|
"TraceTransformer",
|
oscura/__main__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura command-line interface.
|
|
2
2
|
|
|
3
|
-
This module provides the main entry point for
|
|
3
|
+
This module provides the main entry point for Oscura CLI operations,
|
|
4
4
|
including sample data download.
|
|
5
5
|
|
|
6
6
|
|
|
@@ -239,7 +239,7 @@ def download_samples(force: bool = False, generate: bool = True) -> int:
|
|
|
239
239
|
samples_dir = get_samples_dir()
|
|
240
240
|
sample_files = get_sample_files()
|
|
241
241
|
|
|
242
|
-
print("
|
|
242
|
+
print("Oscura Sample Data Download")
|
|
243
243
|
print("==============================")
|
|
244
244
|
print(f"Destination: {samples_dir}")
|
|
245
245
|
print()
|
|
@@ -290,8 +290,8 @@ def download_samples(force: bool = False, generate: bool = True) -> int:
|
|
|
290
290
|
print("Sample files downloaded successfully!")
|
|
291
291
|
print()
|
|
292
292
|
print("Example usage:")
|
|
293
|
-
print(" >>> import oscura as
|
|
294
|
-
print(f" >>> trace =
|
|
293
|
+
print(" >>> import oscura as osc")
|
|
294
|
+
print(f" >>> trace = osc.load('{samples_dir / 'sine_1khz.csv'}')")
|
|
295
295
|
print(" >>> trace.plot()")
|
|
296
296
|
|
|
297
297
|
return 0
|
|
@@ -320,14 +320,14 @@ def list_samples() -> int:
|
|
|
320
320
|
|
|
321
321
|
|
|
322
322
|
def main() -> int:
|
|
323
|
-
"""Main entry point for
|
|
323
|
+
"""Main entry point for Oscura CLI.
|
|
324
324
|
|
|
325
325
|
Returns:
|
|
326
326
|
Exit code.
|
|
327
327
|
"""
|
|
328
328
|
parser = argparse.ArgumentParser(
|
|
329
329
|
prog="oscura",
|
|
330
|
-
description="
|
|
330
|
+
description="Oscura signal analysis toolkit",
|
|
331
331
|
)
|
|
332
332
|
|
|
333
333
|
subparsers = parser.add_subparsers(dest="command", help="Available commands")
|
|
@@ -378,9 +378,9 @@ def main() -> int:
|
|
|
378
378
|
try:
|
|
379
379
|
from oscura import __version__
|
|
380
380
|
|
|
381
|
-
print(f"
|
|
381
|
+
print(f"Oscura version {__version__}")
|
|
382
382
|
except ImportError:
|
|
383
|
-
print("
|
|
383
|
+
print("Oscura version unknown")
|
|
384
384
|
return 0
|
|
385
385
|
|
|
386
386
|
else:
|
oscura/analyzers/__init__.py
CHANGED
oscura/analyzers/packet/daq.py
CHANGED
|
@@ -201,7 +201,7 @@ def detect_gaps(
|
|
|
201
201
|
DAQGapAnalysis with detected gaps
|
|
202
202
|
|
|
203
203
|
Example:
|
|
204
|
-
>>> trace =
|
|
204
|
+
>>> trace = osc.load('acquisition.wfm')
|
|
205
205
|
>>> result = detect_gaps(trace)
|
|
206
206
|
>>> for gap in result.gaps:
|
|
207
207
|
... print(f"Gap at {gap.start_time:.6f}s: {gap.missing_samples} samples")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Pattern Detection & Analysis module for
|
|
1
|
+
"""Pattern Detection & Analysis module for Oscura.
|
|
2
2
|
|
|
3
3
|
This module provides comprehensive pattern detection and analysis capabilities
|
|
4
4
|
for digital signals and binary data, including:
|
|
@@ -17,7 +17,7 @@ for digital signals and binary data, including:
|
|
|
17
17
|
- RE-PAT-003: Fuzzy Pattern Matching
|
|
18
18
|
- RE-PAT-004: Pattern Learning and Discovery
|
|
19
19
|
|
|
20
|
-
Author:
|
|
20
|
+
Author: Oscura Development Team
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
# Periodic pattern detection (PAT-001)
|
|
@@ -4,7 +4,7 @@ This module implements algorithms for automatically discovering candidate
|
|
|
4
4
|
signatures, headers, and delimiters in binary data through statistical analysis.
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
Author:
|
|
7
|
+
Author: Oscura Development Team
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
from __future__ import annotations
|
oscura/analyzers/power/basic.py
CHANGED
oscura/analyzers/power/ripple.py
CHANGED
oscura/analyzers/power/soa.py
CHANGED
oscura/api/__init__.py
CHANGED
oscura/automotive/__init__.py
CHANGED
|
@@ -13,7 +13,7 @@ Key features:
|
|
|
13
13
|
- UDS (ISO 14229) diagnostic services decoding
|
|
14
14
|
- DTC database (200+ codes for Powertrain, Chassis, Body, Network)
|
|
15
15
|
- Discovery documentation with evidence tracking (.tkcan format)
|
|
16
|
-
- Integration with
|
|
16
|
+
- Integration with Oscura's CRC reverse engineering and state machine learning
|
|
17
17
|
|
|
18
18
|
Example:
|
|
19
19
|
>>> from oscura.automotive.can import CANSession
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""CAN message checksum detection.
|
|
2
2
|
|
|
3
|
-
This module integrates with
|
|
3
|
+
This module integrates with Oscura's CRC reverse engineering capabilities
|
|
4
4
|
to detect and identify checksums in CAN messages.
|
|
5
5
|
"""
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ __all__ = ["ChecksumDetector"]
|
|
|
20
20
|
class ChecksumDetector:
|
|
21
21
|
"""Detect checksums and CRCs in CAN messages.
|
|
22
22
|
|
|
23
|
-
This class uses
|
|
23
|
+
This class uses Oscura's CRC reverse engineering to detect
|
|
24
24
|
checksums in CAN message data.
|
|
25
25
|
"""
|
|
26
26
|
|
oscura/automotive/can/session.py
CHANGED
|
@@ -416,7 +416,7 @@ class CANSession:
|
|
|
416
416
|
) -> FiniteAutomaton:
|
|
417
417
|
"""Learn state machine from message sequences.
|
|
418
418
|
|
|
419
|
-
This method integrates
|
|
419
|
+
This method integrates Oscura's state machine inference to learn
|
|
420
420
|
protocol state machines from CAN message sequences around trigger messages.
|
|
421
421
|
|
|
422
422
|
Args:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""State machine learning for CAN protocol reverse engineering.
|
|
2
2
|
|
|
3
|
-
This module integrates
|
|
3
|
+
This module integrates Oscura's state machine inference capabilities with
|
|
4
4
|
CAN bus analysis to learn protocol state machines from message sequences.
|
|
5
5
|
|
|
6
6
|
Key capabilities:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""DBC file generator from discovery documents.
|
|
2
2
|
|
|
3
|
-
This module generates standard DBC files from
|
|
3
|
+
This module generates standard DBC files from Oscura discovery documents,
|
|
4
4
|
enabling export of reverse-engineered protocols to industry-standard format.
|
|
5
5
|
"""
|
|
6
6
|
|
oscura/automotive/dbc/parser.py
CHANGED
|
@@ -29,7 +29,7 @@ def load_pcap(file_path: Path | str) -> CANMessageList:
|
|
|
29
29
|
"""Load CAN messages from a PCAP file.
|
|
30
30
|
|
|
31
31
|
This function reads PCAP files containing SocketCAN frames and converts
|
|
32
|
-
them to
|
|
32
|
+
them to Oscura's CANMessage format. It uses scapy to parse the PCAP
|
|
33
33
|
file and extract CAN frames.
|
|
34
34
|
|
|
35
35
|
Args:
|
oscura/batch/__init__.py
CHANGED
oscura/batch/aggregate.py
CHANGED
|
@@ -52,8 +52,8 @@ def aggregate_results(
|
|
|
52
52
|
ValueError: If no numeric metrics are found in results.
|
|
53
53
|
|
|
54
54
|
Examples:
|
|
55
|
-
>>> results =
|
|
56
|
-
>>> summary =
|
|
55
|
+
>>> results = osc.batch_analyze(files, osc.characterize_buffer)
|
|
56
|
+
>>> summary = osc.aggregate_results(
|
|
57
57
|
... results,
|
|
58
58
|
... metrics=['rise_time', 'fall_time'],
|
|
59
59
|
... outlier_threshold=2.5
|
oscura/batch/analyze.py
CHANGED
|
@@ -46,12 +46,12 @@ def batch_analyze(
|
|
|
46
46
|
Always includes a 'file' column with the input filename.
|
|
47
47
|
|
|
48
48
|
Examples:
|
|
49
|
-
>>> import oscura as
|
|
49
|
+
>>> import oscura as osc
|
|
50
50
|
>>> import glob
|
|
51
51
|
>>> files = glob.glob('captures/*.wfm')
|
|
52
|
-
>>> results =
|
|
52
|
+
>>> results = osc.batch_analyze(
|
|
53
53
|
... files,
|
|
54
|
-
... analysis_fn=
|
|
54
|
+
... analysis_fn=osc.characterize_buffer,
|
|
55
55
|
... parallel=True,
|
|
56
56
|
... workers=4
|
|
57
57
|
... )
|
oscura/builders/__init__.py
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"""Signal and protocol builders for
|
|
1
|
+
"""Signal and protocol builders for Oscura.
|
|
2
2
|
|
|
3
3
|
This module provides fluent builders for generating test signals, protocol
|
|
4
4
|
transactions, and test scenarios. These builders enable composable signal
|
|
5
5
|
generation without manual numpy operations.
|
|
6
6
|
|
|
7
7
|
Example:
|
|
8
|
-
>>> import oscura as
|
|
8
|
+
>>> import oscura as osc
|
|
9
9
|
>>> # Simple sine wave with noise
|
|
10
|
-
>>> signal = (
|
|
10
|
+
>>> signal = (osc.SignalBuilder(sample_rate=1e6, duration=0.01)
|
|
11
11
|
... .add_sine(frequency=1000, amplitude=1.0)
|
|
12
12
|
... .add_noise(snr_db=40)
|
|
13
13
|
... .build())
|
|
14
14
|
>>>
|
|
15
15
|
>>> # UART signal for protocol testing
|
|
16
|
-
>>> uart = (
|
|
17
|
-
... .add_uart(baud_rate=115200, data=b"Hello
|
|
16
|
+
>>> uart = (osc.SignalBuilder(sample_rate=10e6)
|
|
17
|
+
... .add_uart(baud_rate=115200, data=b"Hello Oscura!")
|
|
18
18
|
... .add_noise(snr_db=30)
|
|
19
19
|
... .build())
|
|
20
20
|
>>>
|
|
21
21
|
>>> # Multi-channel SPI transaction
|
|
22
|
-
>>> spi = (
|
|
22
|
+
>>> spi = (osc.SignalBuilder(sample_rate=10e6)
|
|
23
23
|
... .add_spi(clock_freq=1e6, data_mosi=b"\\x9F\\x00\\x00")
|
|
24
24
|
... .build())
|
|
25
25
|
|
|
26
26
|
References:
|
|
27
|
-
-
|
|
27
|
+
- Oscura Signal Generation Guide
|
|
28
28
|
- Protocol Test Signal Specifications
|
|
29
29
|
"""
|
|
30
30
|
|
|
@@ -101,7 +101,7 @@ class GeneratedSignal:
|
|
|
101
101
|
return self.data[name]
|
|
102
102
|
|
|
103
103
|
def to_trace(self, channel: str | None = None) -> WaveformTrace:
|
|
104
|
-
"""Convert to WaveformTrace for
|
|
104
|
+
"""Convert to WaveformTrace for Oscura analysis.
|
|
105
105
|
|
|
106
106
|
Args:
|
|
107
107
|
channel: Channel name to convert. If None, uses first channel.
|
|
@@ -210,7 +210,7 @@ class SignalBuilder:
|
|
|
210
210
|
>>> # UART signal with realistic characteristics
|
|
211
211
|
>>> uart_signal = (SignalBuilder()
|
|
212
212
|
... .sample_rate(10e6)
|
|
213
|
-
... .add_uart(baud_rate=115200, data=b"Hello
|
|
213
|
+
... .add_uart(baud_rate=115200, data=b"Hello Oscura!", config="8N1")
|
|
214
214
|
... .add_noise(snr_db=30)
|
|
215
215
|
... .build())
|
|
216
216
|
"""
|
|
@@ -1083,13 +1083,13 @@ class SignalBuilder:
|
|
|
1083
1083
|
return GeneratedSignal(data=self._channels.copy(), metadata=metadata)
|
|
1084
1084
|
|
|
1085
1085
|
def build_trace(self, channel: str | None = None) -> WaveformTrace:
|
|
1086
|
-
"""Build and return as WaveformTrace for direct use with
|
|
1086
|
+
"""Build and return as WaveformTrace for direct use with Oscura.
|
|
1087
1087
|
|
|
1088
1088
|
Args:
|
|
1089
1089
|
channel: Channel to return as trace. If None, uses first channel.
|
|
1090
1090
|
|
|
1091
1091
|
Returns:
|
|
1092
|
-
WaveformTrace ready for
|
|
1092
|
+
WaveformTrace ready for Oscura analysis.
|
|
1093
1093
|
"""
|
|
1094
1094
|
signal = self.build()
|
|
1095
1095
|
return signal.to_trace(channel)
|
oscura/cli/__init__.py
CHANGED
oscura/cli/batch.py
CHANGED
oscura/cli/characterize.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura Characterize Command implementing CLI-002.
|
|
2
2
|
|
|
3
3
|
Provides CLI for buffer/signal characterization with automatic logic family
|
|
4
4
|
detection and optional reference comparison.
|
|
@@ -168,7 +168,7 @@ def _perform_characterization(
|
|
|
168
168
|
) -> dict[str, Any]:
|
|
169
169
|
"""Perform characterization analysis.
|
|
170
170
|
|
|
171
|
-
Calls actual
|
|
171
|
+
Calls actual Oscura analysis functions based on the analysis type.
|
|
172
172
|
|
|
173
173
|
Args:
|
|
174
174
|
trace: Main trace to analyze.
|
oscura/cli/compare.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura Compare Command implementing CLI-005.
|
|
2
2
|
|
|
3
3
|
Provides CLI for comparing two signal captures with timing, noise, and
|
|
4
4
|
spectral difference analysis.
|
|
@@ -573,7 +573,7 @@ def _generate_html_report(
|
|
|
573
573
|
<head>
|
|
574
574
|
<meta charset="UTF-8">
|
|
575
575
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
576
|
-
<title>
|
|
576
|
+
<title>Oscura Signal Comparison Report</title>
|
|
577
577
|
<style>
|
|
578
578
|
body {{
|
|
579
579
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
@@ -634,7 +634,7 @@ def _generate_html_report(
|
|
|
634
634
|
</head>
|
|
635
635
|
<body>
|
|
636
636
|
<div class="header">
|
|
637
|
-
<h1>
|
|
637
|
+
<h1>Oscura Signal Comparison Report</h1>
|
|
638
638
|
<p>File 1: {Path(file1).name}</p>
|
|
639
639
|
<p>File 2: {Path(file2).name}</p>
|
|
640
640
|
</div>
|
|
@@ -767,7 +767,7 @@ def _generate_html_report(
|
|
|
767
767
|
</div>
|
|
768
768
|
|
|
769
769
|
<footer style="margin-top: 30px; text-align: center; color: #6c757d;">
|
|
770
|
-
<p>Generated by
|
|
770
|
+
<p>Generated by Oscura - Signal Analysis Toolkit</p>
|
|
771
771
|
</footer>
|
|
772
772
|
</div>
|
|
773
773
|
</body>
|
oscura/cli/decode.py
CHANGED
oscura/cli/main.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Oscura Core CLI Framework implementing CLI-001.
|
|
2
2
|
|
|
3
3
|
Provides the main entry point for the oscura command-line interface with
|
|
4
4
|
support for multiple output formats and verbose logging.
|
|
@@ -62,7 +62,7 @@ class OutputFormat:
|
|
|
62
62
|
"<html>",
|
|
63
63
|
"<head>",
|
|
64
64
|
"<meta charset='utf-8'>",
|
|
65
|
-
"<title>
|
|
65
|
+
"<title>Oscura Analysis Results</title>",
|
|
66
66
|
"<style>",
|
|
67
67
|
"body { font-family: Arial, sans-serif; margin: 20px; }",
|
|
68
68
|
"table { border-collapse: collapse; width: 100%; }",
|
|
@@ -72,7 +72,7 @@ class OutputFormat:
|
|
|
72
72
|
"</style>",
|
|
73
73
|
"</head>",
|
|
74
74
|
"<body>",
|
|
75
|
-
"<h1>
|
|
75
|
+
"<h1>Oscura Analysis Results</h1>",
|
|
76
76
|
"<table>",
|
|
77
77
|
"<tr><th>Parameter</th><th>Value</th></tr>",
|
|
78
78
|
]
|
|
@@ -138,7 +138,7 @@ def format_output(data: dict[str, Any], format_type: str) -> str:
|
|
|
138
138
|
@click.version_option(version="0.1.0", prog_name="oscura") # type: ignore[misc]
|
|
139
139
|
@click.pass_context # type: ignore[misc]
|
|
140
140
|
def cli(ctx: click.Context, verbose: int) -> None:
|
|
141
|
-
"""
|
|
141
|
+
"""Oscura - Signal Analysis Framework for Oscilloscope Data.
|
|
142
142
|
|
|
143
143
|
Command-line tools for characterizing buffers, decoding protocols,
|
|
144
144
|
analyzing spectra, and comparing signals.
|
|
@@ -172,14 +172,14 @@ def cli(ctx: click.Context, verbose: int) -> None:
|
|
|
172
172
|
|
|
173
173
|
@click.command() # type: ignore[misc]
|
|
174
174
|
def shell() -> None:
|
|
175
|
-
"""Start an interactive
|
|
175
|
+
"""Start an interactive Oscura shell.
|
|
176
176
|
|
|
177
|
-
Opens a Python REPL with
|
|
177
|
+
Opens a Python REPL with Oscura pre-imported and ready to use.
|
|
178
178
|
Features tab completion, persistent history, and helpful shortcuts.
|
|
179
179
|
|
|
180
180
|
Example:
|
|
181
181
|
$ oscura shell
|
|
182
|
-
|
|
182
|
+
Oscura Shell v0.1.0
|
|
183
183
|
>>> trace = load("signal.wfm")
|
|
184
184
|
>>> rise_time(trace)
|
|
185
185
|
"""
|
|
@@ -194,7 +194,7 @@ def shell() -> None:
|
|
|
194
194
|
def tutorial(tutorial_id: str | None, list_tutorials: bool) -> None:
|
|
195
195
|
"""Run an interactive tutorial.
|
|
196
196
|
|
|
197
|
-
Provides step-by-step guidance for learning
|
|
197
|
+
Provides step-by-step guidance for learning Oscura.
|
|
198
198
|
|
|
199
199
|
Args:
|
|
200
200
|
tutorial_id: ID of the tutorial to run (or None to list).
|