from collections import defaultdict from fractions import Fraction as Q def run(load,check): hits=load('C286_DATA.json')['all_K_hits'];by=defaultdict(list) for h in hits:by[h['Flood_index']].append(h) rows=[] for i,hs in sorted(by.items()): mt=[h for h in hs if h['target']['tradition']=='MT'];ns=[h for h in hs if h['target']['role']=='Noah birth'] check(f'one MT boundary i{i}',len(mt)==1) S=mt[0]['S'];F=mt[0]['F'];R=mt[0]['target']['center'] check(f'first three normal coefficients i{i}',[S,F,R]==[-12*529+i,-10*529+i,5*529+i]) for n in ns: N=n['target']['center'];check(f'Noah7K coefficient i{i} {n["target"]["tradition"]}',N==7*529+i) check(f'K rectangle i{i} {n["target"]["tradition"]}',[F-S,N-R,R-S,N-F,N-S,R-F]==[1058,1058,8993,8993,10051,7935]) for e in [Q(-1,4),Q(1,4)]:check(f'component rectangle i{i} {n["target"]["tradition"]} {e}',S+e+1058+7935+1058==N+e) rows.append({'i':i,'S':S,'F':F,'R':R,'Noah_records':[n['target'] for n in ns],'Noah_required':7*529+i,'complete':bool(ns)}) check('four numerical complete rows',[r['i'] for r in rows if r['complete']]==[2,3,4,5]) check('six labeled complete rows',sum(len(r['Noah_records']) for r in rows)==6) return {'rows':rows,'normal_form_coefficients':[-12,-10,5,7],'annual_offsets':list(range(6)),'width_matrix_K':[[17,19],[15,17]],'same_side_width_K':2,'diagonal_width_difference_K':4,'source_status':'four complete SP rows, two additional co-located LXX labels; first two Noah requirements absent'}