from fractions import Fraction as F def run(load,check): rows=load('C319_DATA.json')['rows'];by={(x['i'],x['a'],x['b']):x for x in rows};edges=[] for axis in ['a','b']: for i in range(3,8): for other in [0,2]: start=(i,0,other) if axis=='a' else (i,other,0);end=(i,2,other) if axis=='a' else (i,other,2) u,v=by[start],by[end] if not(u['joint_admitted'] and v['joint_admitted']):continue delta=[v[k]-u[k] for k in ['S','q','R','n']];expect=[2,0,0,0] if axis=='a' else [0,0,2,0] check(str(start)+axis+' footprint',delta==expect) source_delta=[-delta[0],-delta[1],delta[2],delta[3]] check(str(start)+axis+' BC magnitudes',source_delta==([-2,0,0,0] if axis=='a' else [0,0,2,0])) phases=[] for uc,vc in zip(u['components'],v['components']): got=[F(y)-F(x) for x,y in zip(uc,vc)];check(str(start)+axis+uc[0]+' exact phases',got==expect);phases.append([str(x) for x in got]) edges.append({'choice':axis,'i':i,'other_choice':other,'from':[u['a'],u['b']],'to':[v['a'],v['b']],'comparison_coordinate_delta':delta,'source_BC_magnitude_delta':source_delta,'left_short_span_delta':v['sides'][0]-u['sides'][0],'right_short_span_delta':v['sides'][1]-u['sides'][1],'SR_width_delta':v['crosswidths'][0][0]-u['crosswidths'][0][0],'phase_deltas':phases}) paired=[] for i in range(3,8): u,v=by[i,0,0],by[i,2,2] if not v['joint_admitted']:continue check(f'i{i} paired direction',[v[k]-u[k] for k in ['S','q','R','n']]==[2,0,2,0]) check(f'i{i} fixed long edges',u['crosswidths'][0][0]==v['crosswidths'][0][0]==u['crosswidths'][1][1]==v['crosswidths'][1][1]==8993) check(f'i{i} reduced sides',u['sides']==[1060,1060] and v['sides']==[1058,1058]) paired.append({'i':i,'comparison_delta':[2,0,2,0],'BC_magnitude_delta':[-2,0,2,0],'short_spans_before':u['sides'],'short_spans_after':v['sides']}) check('twelve admitted single-choice edges',len(edges)==12 and sum(e['choice']=='a' for e in edges)==6) check('three admitted pair transitions',[x['i'] for x in paired]==[3,4,5]) return {'step':'C335','coordinate_order':['S cumulative ON Shem','q cumulative OFF Flood','R reflected restored MT Flood','n reflected SP Noah'],'single_choice_edges':edges,'paired_transitions':paired,'comparison_to_BC_magnitude_signs':[-1,-1,1,1],'source_semantics':'The two +2 display changes move their underlying BC bases in opposite directions. This is not a civil elapsed-year conversion.','operation_footprints':{'A':[2,0,0,0],'B':[0,0,2,0],'paired':[2,0,2,0]},'whole_operation_identity_established':False,'new_endpoints_adopted':False}