GitHub Copilot commited on
Commit
56e5f1a
·
1 Parent(s): 0b3187d

Feature: Use PrimeNetwork validation in DSP encoding

Browse files
Files changed (1) hide show
  1. logos/dsp_bridge.py +15 -2
logos/dsp_bridge.py CHANGED
@@ -32,6 +32,7 @@ from .logos_core import (
32
  ATOM_SIZE,
33
  META_SIZE,
34
  )
 
35
 
36
 
37
  # ============================================================
@@ -137,6 +138,9 @@ class DSPBridge:
137
  self.viewport_size = viewport_size
138
  self.grid_size = 8 # Will be recalculated per image
139
 
 
 
 
140
  # Wave buffers: wave_id -> list of atoms
141
  self.wave_buffers: Dict[int, List[bytes]] = {}
142
 
@@ -202,6 +206,15 @@ class DSPBridge:
202
  path = self._tile_to_quadtree_path(tile_row, tile_col)
203
  heat_code = calculate_heat_code(path)
204
 
 
 
 
 
 
 
 
 
 
205
  # Build metadata
206
  meta = encode_tile_metadata(
207
  self.canvas_width, self.canvas_height,
@@ -226,8 +239,8 @@ class DSPBridge:
226
  # Build payload: metadata + pixel data
227
  payload = meta + chunk.tobytes()
228
 
229
- # Pack atom with designated endpoint
230
- atom = pack_atom(heat_code, payload, domain_key="medium", gap_id=chunk_idx)
231
  atoms.append(atom)
232
  chunk_idx += 1
233
 
 
32
  ATOM_SIZE,
33
  META_SIZE,
34
  )
35
+ from .network import PrimeNetwork
36
 
37
 
38
  # ============================================================
 
138
  self.viewport_size = viewport_size
139
  self.grid_size = 8 # Will be recalculated per image
140
 
141
+ # Instantiate the Prime Network for routing logic
142
+ self.network = PrimeNetwork()
143
+
144
  # Wave buffers: wave_id -> list of atoms
145
  self.wave_buffers: Dict[int, List[bytes]] = {}
146
 
 
206
  path = self._tile_to_quadtree_path(tile_row, tile_col)
207
  heat_code = calculate_heat_code(path)
208
 
209
+ # Validate against instantiated Prime Network
210
+ # "Discrete wave transmission" aligned with topology
211
+ is_manifold_aligned = self.network.validate_wave(heat_code)
212
+
213
+ # Select domain based on topological alignment
214
+ # Manifold aligned -> medium (standard)
215
+ # Off-manifold -> small (constrained/filtered)
216
+ domain_key = "medium" if is_manifold_aligned else "small"
217
+
218
  # Build metadata
219
  meta = encode_tile_metadata(
220
  self.canvas_width, self.canvas_height,
 
239
  # Build payload: metadata + pixel data
240
  payload = meta + chunk.tobytes()
241
 
242
+ # Pack atom with designated endpoint and domain
243
+ atom = pack_atom(heat_code, payload, domain_key=domain_key, gap_id=chunk_idx)
244
  atoms.append(atom)
245
  chunk_idx += 1
246