108 lines
3.2 KiB
Python
108 lines
3.2 KiB
Python
"""inject_v2_ramp.py — scale + rapid-fire test
|
|
|
|
v1 showed that pulses at |strength|=0.30 produce ~+0.10 asymmetry deltas
|
|
that Fractonaut can barely distinguish from baseline drift. v2 asks:
|
|
how hard / how fast do we have to hit it before the lattice actually
|
|
moves off baseline visibly?
|
|
|
|
Three phases, all at (512,512) sigma=32, fixed location so we're only
|
|
varying amplitude and rate:
|
|
|
|
Phase A - Ramp: strength 0.5, 0.8, 1.0 spaced 60s
|
|
Phase B - Rapid stack: 10 x strength 1.0 every 2s (=20s)
|
|
Phase C - Mega rapid: 30 x strength 1.0 every 0.4s (=12s)
|
|
|
|
Total wall time: 60+60+90+20+90+12+90 = ~7 minutes.
|
|
Buffers of 90s between phases so Fractonaut can auto-observe the response
|
|
and we can see whether each phase pushed the field off baseline before
|
|
the next phase begins.
|
|
|
|
Output: /mnt/d/Resonance_Engine/inject_v2_ramp_log.jsonl
|
|
"""
|
|
from __future__ import annotations
|
|
import json, time, sys
|
|
from pathlib import Path
|
|
|
|
ZMQ_ADDR = "tcp://127.0.0.1:5557"
|
|
LOG_PATH = Path("/mnt/d/Resonance_Engine/inject_v2_ramp_log.jsonl")
|
|
|
|
X = 512.0
|
|
Y = 512.0
|
|
SIGMA = 32.0
|
|
|
|
|
|
def send(sock, strength, phase, idx):
|
|
cmd = {"cmd": "inject_density", "x": X, "y": Y, "sigma": SIGMA, "strength": strength}
|
|
wall = time.time()
|
|
sock.send_string(json.dumps(cmd))
|
|
rec = {
|
|
"wall_ts": wall,
|
|
"wall_iso": time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(wall)),
|
|
"phase": phase,
|
|
"idx": idx,
|
|
"strength": strength,
|
|
"x": X, "y": Y, "sigma": SIGMA,
|
|
}
|
|
with LOG_PATH.open("a", encoding="utf-8") as fh:
|
|
fh.write(json.dumps(rec) + "\n")
|
|
return rec
|
|
|
|
|
|
def main():
|
|
import zmq
|
|
ctx = zmq.Context()
|
|
sock = ctx.socket(zmq.PUB)
|
|
sock.connect(ZMQ_ADDR)
|
|
time.sleep(0.6) # slow-joiner
|
|
|
|
LOG_PATH.parent.mkdir(parents=True, exist_ok=True)
|
|
t0 = time.time()
|
|
print(f"[v2] start {time.strftime('%H:%M:%S')}")
|
|
print()
|
|
|
|
# ---------- PHASE A: ramp ----------
|
|
print("[PHASE A] ramp 0.5 -> 0.8 -> 1.0, 60s spacing")
|
|
for i, s in enumerate([0.5, 0.8, 1.0]):
|
|
r = send(sock, s, "A_ramp", i)
|
|
print(f" A[{i+1}/3] {r['wall_iso']} strength={s:+.2f}")
|
|
if i < 2:
|
|
time.sleep(60)
|
|
|
|
print("[PHASE A] done, waiting 90s for Fractonaut to observe")
|
|
time.sleep(90)
|
|
|
|
# ---------- PHASE B: rapid stack ----------
|
|
print()
|
|
print("[PHASE B] 10 x strength=1.0 every 2s")
|
|
for i in range(10):
|
|
r = send(sock, 1.0, "B_rapid10", i)
|
|
print(f" B[{i+1}/10] {r['wall_iso']} strength=+1.00")
|
|
if i < 9:
|
|
time.sleep(2)
|
|
|
|
print("[PHASE B] done, waiting 90s for Fractonaut to observe")
|
|
time.sleep(90)
|
|
|
|
# ---------- PHASE C: mega rapid ----------
|
|
print()
|
|
print("[PHASE C] 30 x strength=1.0 every 0.4s")
|
|
for i in range(30):
|
|
r = send(sock, 1.0, "C_mega30", i)
|
|
if i % 5 == 0:
|
|
print(f" C[{i+1}/30] {r['wall_iso']} strength=+1.00")
|
|
if i < 29:
|
|
time.sleep(0.4)
|
|
|
|
print("[PHASE C] done, waiting 90s for Fractonaut to observe")
|
|
time.sleep(90)
|
|
|
|
sock.close()
|
|
ctx.term()
|
|
print()
|
|
print(f"[v2] all phases sent in {time.time()-t0:.1f}s")
|
|
print(f"[v2] log: {LOG_PATH}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|