from fractions import Fraction as F def run(load,check): reg=load('C286_DATA.json')['target_register'];old=load('PREVIOUS_DATA.json');rows=[] check('inherited five successful biographies',old['counts']['biographies']==5 and old['counts']['phase_biographies']==10) for x in old['rows']: j=x['j'];i=x['i'];g=x['gear'];rail=x['rail'];n,s,d=x['biography_BC'];nd=n-950 def hits(role,center=None,gear=g,whichrail=None): return [r for r in reg if r['tradition']=='SP' and r['Cainan']==0 and r['Terah60']==0 and r['full430']==1 and r['role']==role and (center is None or r['center']==center) and (gear is None or r['gear']==gear) and (whichrail is None or r.get('rail')==whichrail)] deaths=hits('Noah death',nd,whichrail=rail);check(f'j{j} admitted Noah death',len(deaths)==1) start=hits('Flood start')[0];close=hits('Flood close')[0];sel=start if rail=='primary' else close;f=sel['center'];r=-5290+i+8395 check(f'j{j} same biography sequence',[n-s,s-f,f-nd,nd-d]==[500,100,350,150]) check(f'j{j} 8395 residual',n-r==598 and r-f==2) aliases=hits(sel['role'],r,gear=None) check(f'j{j} no sameGear selectedFlood alias',all(z['gear']!=g for z in aliases)) comps=[] for oldc in x['components']: ep=F(oldc['Noah_ancestry_phase']);nc=F(n)+ep;sc=F(s)+ep;fc=F(f)+ep;rc=F(r)+ep;ndc=F(nd)+ep;dc=F(d)+ep check(f'j{j} {ep} all biography durations',[nc-sc,sc-fc,fc-ndc,ndc-dc]==[500,100,350,150]) check(f'j{j} {ep} fixed residual',rc-fc==2 and nc-rc==598) comps.append({'Noah_ancestry_phase':str(ep),'Noah':str(nc),'Shem':str(sc),'selected_Flood':str(fc),'Noah_death':str(ndc),'Shem_death':str(dc),'fixed8395':str(rc),'8395_residual':'2'}) # Even arbitrary retained quarter-phase exchange cannot eliminate2. possible=sorted({F(r)+a-(F(f)+b) for a in [F(-1,4),F(1,4)] for b in [F(-1,4),F(1,4)]}) check(f'j{j} no retainedphase repair',F(0) not in possible) rows.append({'j':j,'i':i,'gear':g,'rail':rail,'biography_BC':[n,s,f,nd,d],'selected_Flood_role':sel['role'],'Flood_start_BC':start['center'],'Flood_close_BC':close['center'],'Noah_to_start':n-start['center'],'Noah_to_close':n-close['center'],'fixed8395_candidate':r,'same_role_aliases':aliases,'source_Noah_death':deaths[0],'source_Flood':sel,'residual':2,'all_retained_phase_residuals':[str(z) for z in possible],'components':comps}) check('aliases occur only in lower two Gears',sum(bool(r['same_role_aliases']) for r in rows)==3) return {'step':'C315','rows':rows,'counts':{'full_source_biographies':5,'exact_phase_biographies':10,'fixed8395_samebiography_success':0,'wrongGear_aliases':3,'unadmitted_fixed_candidates':2},'ordered_spans':[500,100,350,150],'total_span':1100,'fixed_residual':2,'required_but_not_adopted_leg':8393,'Noah_death_qualification':'Retains File18 primary inclusive/harmonic station qualification; no new historical precision.'}