Voynich Master Archive - Volume 07 - Pages 6001-7000
Test CSV, JSON, and Markdown records. Sections carry a Source path and a SHA-256 line.
PDF page 734 of 1000. Catalog page range 6001-7000.
Extracted text
run_vertical_band_window_039.py
VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 1
run_vertical_band_window_039.py
Source: /Voynich/Voynich_PORTABLE_ANONYMOUS_ROLE_BREAKTHROUGH_037_042_reproducibility.zip!/run_vertical_
band_window_039.py
SHA-256: f9f88a34f80d069c5d9aebc6fa28b1950e9c40128a365c14023194da414f3f7b
!/usr/bin/env python3
"""VERTICAL-BAND-WINDOW-039: geometry retrieves a fixed three-line record band."""
from pathlib import Path
from scipy.special import comb
import hashlib,json
import numpy as np,pandas as pd
import run_geometric_expansion_link_030 as g30
import run_fifth_record_prospective_033 as p33
import run_anonymous_record_decompression_032 as d32
ROOT=Path(__file__).resolve().parent;OUT=ROOT/'vertical_band_window_039';OUT.mkdir(exist_ok=True);K=3;RE
PS=10000;SEED=20260830
def expected(n,p,k):return 1-comb(n-p,min(k,n),exact=False)/comb(n,min(k,n),exact=False) if
n-p>=min(k,n) else 1.0
def evalq(q):
dist=[]
for c in q['cand']:
_,y0,_,y1=c['box'];dist.append(abs((y0+y1)/2/837-q['qy']/837))
top=sorted(range(len(dist)),key=lambda i:dist[i])[:min(K,len(dist))];hits=[i for i in top if i in
q['pos']];chosen=min(hits,key=lambda i:dist[i]) if hits else None
return {'hit':bool(hits),'top':top,'chosen':chosen,'dist':dist,'expected':expected(len(dist),len(q['pos
']),K)}
def main():
lb=g30.aligned_label_boxes();base=g30.aligned_prose_lines();add,_=p33.recover_unrestricted(base);coords
={**base,**add};qs={}
for w in ('ZL','GC'):
qs[w]={(q['folio'],q['key']):q for q in g30.build(w,lb,coords)}
rows=[];paired=[];old=pd.read_csv(ROOT/'gc_segmentation_recovery_035/five_record_anonymous_ledger.csv')
;oldphys={(r.folio,int(r.zl_line),int(r.gc_line)) for r in old.itertuples()}
common=sorted(set(qs['ZL'])&set(qs['GC']))
for key in common:
rr={w:evalq(qs[w][key]) for w in ('ZL','GC')}
for w in ('ZL','GC'):rows.append({'witness':w,'folio':key[0],'key':key[1],'candidates':len(qs[w][key][
'cand']),'positives':len(qs[w][key]['pos']),'band_hit':int(rr[w]['hit']),'random_expected':rr[w]['expect
ed'],'selected_line':qs[w][key]['cand'][rr[w]['chosen']]['line'] if rr[w]['chosen'] is not None else
None})
if all(rr[w]['hit'] for w in rr):
zq,gq=qs['ZL'][key],qs['GC'][key];zi,gi=rr['ZL']['chosen'],rr['GC']['chosen'];zc,gc=zq['cand'][zi],gq
['cand'][gi];zr=[x for x in zc['payloads'] if x!=key[1]];gr=[x for x in gc['payloads'] if
x!=key[1]];jac=d32.multiset_jaccard(zr,gr);lcs=d32.lcs_ratio(zr,gr);new=(key[0],zc['line'],gc['line'])
not in oldphys
paired.append({'folio':key[0],'key':key[1],'zl_line':zc['line'],'gc_line':gc['line'],'new_physical_re
cord':int(new),'zl_residual':' | '.join(zr),'gc_residual':' | '.join(gr),'jaccard':jac,'lcs':lcs,'qualif
ies':int(new and jac>=.5 and lcs>=.75)})
d=pd.DataFrame(rows);p=pd.DataFrame(paired);nullrows=[];summ=[]
rng=np.random.default_rng(SEED)
for w in ('ZL','GC'):
z=d[d.witness==w];obs=float((z.band_hit-z.random_expected).mean());ql=[qs[w][k] for k in
common];null=[]
for _ in range(REPS):
gains=[]
for q in ql:
n=len(q['cand']);shift=int(rng.integers(n));pos={(i+shift)%n for i in
q['pos']};dist=evalq(q)['dist'];top=sorted(range(n),key=lambda i:dist[i])[:min(K,n)];gains.append(int(bo
ol(set(top)&pos))-expected(n,len(pos),K))
null.append(float(np.mean(gains)))
pv=(1+sum(x>=obs for x in null))/(REPS+1);summ.append({'witness':w,'queries':len(z),'recall_at_3':floa
t(z.band_hit.mean()),'random_expected':float(z.random_expected.mean()),'gain':obs,'circular_shift_p':pv}
);nullrows += [{'witness':w,'replicate':i,'gain':x} for i,x in enumerate(null)]