data = open(r"C:/Users/vikto/Documents/Claude/rt-4d/radio-spi-dump.bin","rb").read()

# --- BLOB2 stride analysis ---
# Find start of each 0x80-run to measure period
starts=[]
i=0x352000; end=0x3d5000
prev=None
inrun=False
# a "record boundary" — let's autocorrelate instead on a window
seg=data[0x353000:0x3a3000]
N=len(seg)
import statistics
best=[]
for stride in range(8, 4096):
    # sample-based autocorr: count byte equality at offset stride
    eq=0; tot=0
    step=1
    for k in range(0, N-stride, 7):
        if seg[k]==seg[k+stride]:
            eq+=1
        tot+=1
    best.append((eq/tot, stride))
best.sort(reverse=True)
print("BLOB2 top strides (score,stride):")
for s,st in best[:15]:
    print(f"   stride={st} ({st:#x}) score={s:.3f}")
