jt-wavesense 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ from .core import JTWaveSenseEngine, WaveSignature
2
+ __version__ = "0.1.0"
3
+ __author__ = "Shrishant Jha (Jha Technologies)"
jt_wavesense/core.py ADDED
@@ -0,0 +1,110 @@
1
+ import time
2
+ from dataclasses import dataclass, field
3
+ from typing import List, Dict, Any, Optional
4
+
5
+ @dataclass
6
+ class WaveSignature:
7
+ label: str
8
+ wave_pattern: List[float]
9
+ novelty_score: float
10
+ timestamp: float = field(default_factory=time.time)
11
+
12
+ class JTWaveSenseEngine:
13
+ """
14
+ Event-Driven Wave Perception & Out-of-Distribution (OOD) Novelty Engine
15
+ for Smart Cameras, Drones, and Edge Sensors.
16
+ """
17
+ def __init__(
18
+ self,
19
+ wake_threshold: float = 0.25,
20
+ novelty_threshold: float = 15.0,
21
+ max_known_signatures: int = 50
22
+ ):
23
+ self.wake_threshold = wake_threshold
24
+ self.novelty_threshold = novelty_threshold
25
+ self.max_known_signatures = max_known_signatures
26
+
27
+ self.short_term_buffer: List[WaveSignature] = []
28
+ self.long_term_signatures: List[WaveSignature] = []
29
+ self.total_steps = 0
30
+ self.active_wake_steps = 0
31
+ self.curiosity_score = 0.0
32
+
33
+ def process_frame_or_wave(
34
+ self,
35
+ observed_wave: List[float],
36
+ baseline_wave: List[float],
37
+ label: str = "unknown_entity"
38
+ ) -> Dict[str, Any]:
39
+ """
40
+ 1. Dormant Listening: Checks if hydrodynamic/visual/acoustic shift exceeds wake_threshold.
41
+ 2. Novelty Importance Gate: |Expected - Actual| * Novelty Intensity -> +Curiosity Reward.
42
+ """
43
+ self.total_steps += 1
44
+ if len(observed_wave) != len(baseline_wave):
45
+ raise ValueError("observed_wave and baseline_wave must have the same length.")
46
+
47
+ # Calculate shift magnitude from ambient background
48
+ shift = sum(abs(o - b) for o, b in zip(observed_wave, baseline_wave)) / len(observed_wave)
49
+
50
+ # Stay dormant at near-zero power if shift is mundane background noise
51
+ if shift < self.wake_threshold:
52
+ return {"status": "DORMANT", "shift": round(shift, 4), "power_mode": "ultra_low"}
53
+
54
+ # Event-driven wake triggered!
55
+ self.active_wake_steps += 1
56
+
57
+ # Compare against known long-term wave signatures
58
+ min_distance = float("inf")
59
+ for known in self.long_term_signatures:
60
+ dist = sum(abs(o - k) for o, k in zip(observed_wave, known.wave_pattern))
61
+ if dist < min_distance:
62
+ min_distance = dist
63
+
64
+ novelty_intensity = shift * 10.0 if not self.long_term_signatures else min_distance * 5.0
65
+ importance_score = round(shift * novelty_intensity, 4)
66
+
67
+ sig = WaveSignature(label=label, wave_pattern=observed_wave, novelty_score=importance_score)
68
+
69
+ if importance_score >= self.novelty_threshold:
70
+ self.curiosity_score += importance_score
71
+ self._consolidate(sig)
72
+ return {
73
+ "status": "NOVEL_DISCOVERY",
74
+ "label": label,
75
+ "importance_score": importance_score,
76
+ "curiosity_total": round(self.curiosity_score, 2)
77
+ }
78
+ else:
79
+ self.short_term_buffer.append(sig)
80
+ return {
81
+ "status": "ROUTINE_EVENT",
82
+ "shift": round(shift, 4),
83
+ "importance_score": importance_score
84
+ }
85
+
86
+ def _consolidate(self, sig: WaveSignature) -> None:
87
+ self.long_term_signatures.append(sig)
88
+ if len(self.long_term_signatures) > self.max_known_signatures:
89
+ self.long_term_signatures.sort(key=lambda x: x.novelty_score, reverse=True)
90
+ self.long_term_signatures.pop()
91
+
92
+ def sleep_and_prune(self) -> int:
93
+ purged = len(self.short_term_buffer)
94
+ self.short_term_buffer.clear()
95
+ return purged
96
+
97
+ def energy_savings_percent(self) -> float:
98
+ if self.total_steps == 0:
99
+ return 100.0
100
+ dormant_steps = self.total_steps - self.active_wake_steps
101
+ return round((dormant_steps / self.total_steps) * 100.0, 2)
102
+
103
+ def stats(self) -> Dict[str, Any]:
104
+ return {
105
+ "total_steps": self.total_steps,
106
+ "wake_events": self.active_wake_steps,
107
+ "energy_saved_pct": self.energy_savings_percent(),
108
+ "known_signatures": len(self.long_term_signatures),
109
+ "curiosity_score": round(self.curiosity_score, 2)
110
+ }
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: jt-wavesense
3
+ Version: 0.1.0
4
+ Summary: Event-driven wave perception and OOD novelty detection engine for cameras and edge sensors.
5
+ Author-email: Shrishant Jha <shrishant@example.com>
6
+ License: AGPL-3.0-or-later
7
+ Keywords: edge-ai,computer-vision,wave-sensing,neuromorphic,robotics
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
10
+
11
+ # jt-wavesense (by Jha Technologies)
12
+ Event-Driven Wave Perception & Out-of-Distribution Novelty Engine for Smart Cameras, Drones, and Edge Sensors.
@@ -0,0 +1,6 @@
1
+ jt_wavesense/__init__.py,sha256=wfg6uQN9GJcFJliKELo9AMiTWa15wYg4vmhsNbRrROI,121
2
+ jt_wavesense/core.py,sha256=HJpPAaOF7hl2CcI09NxlBQa-0CW7v0ZX1k6mU7w-Okg,4196
3
+ jt_wavesense-0.1.0.dist-info/METADATA,sha256=yB6LSlwCW2BBgpCYnLE9VXOEr0Tdp2wWz0YFs1EbGC0,517
4
+ jt_wavesense-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ jt_wavesense-0.1.0.dist-info/top_level.txt,sha256=dm_c6DKPWhR19IaZ1DgWqIWQt4eGliQ6lvik9sVZKZI,13
6
+ jt_wavesense-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ jt_wavesense