mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-08-13 15:40:35 +00:00
Create 4-Infrastructure/lib/ with canonical implementations of:
- hashing.py: sha256_bytes, sha256_text, sha256_file
- q16.py: Q16_16 fixed-point constants and arithmetic
- jsonl.py: load_json, load_jsonl, write_jsonl, stable_json, canonical_json_bytes
- fraction_utils.py: Fraction serialization helpers for hardware probes
Refactor 66 files across 4-Infrastructure/{hardware,shim,infra} and
5-Applications/{scripts,tools-scripts,hutter_prize,text-to-cad} to import
from the shared library instead of maintaining local copies.
4-Infrastructure/auto/lib/q16.py now re-exports from lib.q16.
Net: -743 lines (490 added, 1233 removed)
Build: not applicable (Python-only change, py_compile verified on all 71 files)
Co-Authored-By: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
17 lines
622 B
Python
17 lines
622 B
Python
# PTOS: LAYER=INFRA / DOMAIN=AUTOMATION / CONDITION=ALPHA
|
|
"""
|
|
Q16_16 fixed-point arithmetic for deterministic compute across all substrates.
|
|
|
|
Re-exports from the canonical shared library at 4-Infrastructure/lib/q16.py.
|
|
All thresholds and metric values are stored as Q16_16 integers.
|
|
One = 0x00010000 = 65536. Float is forbidden in compute paths.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
|
from lib.q16 import Q16_HALF, Q16_ONE, from_q16, ratio_q16, to_q16
|
|
|
|
__all__ = ["Q16_ONE", "Q16_HALF", "to_q16", "from_q16", "ratio_q16"]
|