from pathlib import Path
from fractions import Fraction
import hashlib,json,re
ROOT=Path('/workspace/scratch/1b40da62dcbd')
OUT=ROOT/'c832_c931/prep'
SOURCES={
'File43':ROOT/'project_sources/06-File_43.Genealogical_Bridge-2-.md',
'File54':ROOT/'project_sources/07-File_54.Luke_70_Year_Genealogical_Lattice-5-.md',
'File15':ROOT/'project_sources/04-File_15.Generational_Axiom-3-.md',
'File51a':ROOT/'project_sources/39-File_51a.Rounded_Scaffold_Mod5_Architecture.md',
}
lines={k:p.read_text().splitlines() for k,p in SOURCES.items()}
def excerpt(key,start,end):
return {'source_key':key,'line_start':start,'line_end':end,'raw':'\n'.join(lines[key][start-1:end])}
def tables(key,allowed):
result=[]; a=lines[key]; i=0; heading=''
while i<len(a):
if a[i].startswith('#'):heading=a[i].strip()
if not a[i].startswith('|'):i+=1;continue
start=i
while i<len(a) and a[i].startswith('|'):i+=1
if not any(lo<=start+1<=hi for lo,hi in allowed):continue
raw=a[start:i]
result.append({'id':key+'_L'+str(start+1),'source_key':key,'section':heading,'line_start':start+1,'line_end':i,'raw':'\n'.join(raw),'cells':[[x.strip() for x in s.strip().strip('|').split('|')] for s in raw]})
return result
T=tables('File43',[(550,838)])+tables('File54',[(147,389),(424,582),(621,796),(818,846),(969,1000)])+tables('File15',[(379,414),(643,670)])+tables('File51a',[(392,416)])
ledger=next(x for x in T if x['cells'][0][0]=='Primary 70-year generation')
def civil_range(s):
if s.endswith(' BC') and 'AD' not in s:
b1,b2=map(int,s[:-3].split('–')); return 1-b1,1-b2
if s.startswith('AD ') and 'BC' not in s:
d1,d2=map(int,s.replace('AD ','').split('–'));return d1,d2
m=re.fullmatch(r'(\d+) BC–AD (\d+)',s)
assert m,s
return 1-int(m[1]),int(m[2])
rows=[]
for k,c in enumerate(ledger['cells'][2:]):
x,y=civil_range(c[0]); no=ledger['line_start']+2+k
rows.append({'index_from_outer_head':k,'index_to_6BC_hinge':76-k,'label':c[0],'civil_open':x,'civil_close':y,'Matthew_display':c[1],'Luke_display':c[2],'source':excerpt('File43',no,no)})
assert len(rows)==78
assert all(r['civil_open']==-5325+70*r['index_from_outer_head'] and r['civil_close']-r['civil_open']==70 for r in rows)
def fmt(x):return str(1-x)+' BC' if x<=0 else 'AD '+str(x)
positive={r['index_to_6BC_hinge']:r for r in rows if r['index_to_6BC_hinge']>=0}
returns={}
for tag,ratio in [('E',Fraction(25,23)),('P',Fraction(70,69))]:
ret=[]
for r in range(77):
v=r*ratio
if v.denominator==1 and int(v) in positive:
ret.append({'source_index_r':r,'source_name':positive[r]['Luke_display'],'source_boundary':fmt(positive[r]['civil_open']),'image_index_r':int(v),'image_name':positive[int(v)]['Luke_display'],'image_boundary':fmt(positive[int(v)]['civil_open'])})
returns[tag]=ret
common=[]
for m in range(12):
k=7*m;x=-5325+490*m
common.append({'coarse_index':m,'Luke_intervals_from_head':k,'jubilee_intervals_from_head':10*m,'civil_coordinate':x,'boundary':fmt(x),'Luke_display_boundary_label':rows[k]['Luke_display'],'Matthew_display_boundary_label':rows[k]['Matthew_display']})
mt_table=next(x for x in T if x['id']=='File51a_L392')
alias={'Adam':'Creation of Adam','Arphaxad':'FLOOD & Arphaxad'}
nt_by_name={x['Luke_display']:x for x in rows[:24]}
round_bridge=[]
for k,c in enumerate(mt_table['cells'][2:24]):
name=c[0];nt=nt_by_name[alias.get(name,name)]
round_bridge.append({'name':name,'NT_display_BC':1-nt['civil_open'],'MT_actual_strict_BC':int(c[3]),'MT_rounded_BC':int(c[4]),'gap_NT_minus_rounded':1-nt['civil_open']-int(c[4]),'gap_NT_minus_actual_strict':1-nt['civil_open']-int(c[3]),'MT_source':excerpt('File51a',mt_table['line_start']+2+k,mt_table['line_start']+2+k),'NT_source':nt['source']})
assert len(round_bridge)==22
out={
'purpose':'Preparation only for C832–C931: exact supplied tables and bounded candidate diagnostics; no numbered action has been executed by this preparation.',
'sources':{k:{'path':str(p),'sha256':hashlib.sha256(p.read_bytes()).hexdigest(),'bytes':len(p.read_bytes())} for k,p in SOURCES.items()},
'literal_tables':T,
'source_excerpts':[
excerpt('File43',639,670),excerpt('File43',752,780),excerpt('File43',536,587),
excerpt('File54',412,423),excerpt('File54',449,502),excerpt('File54',679,726),
excerpt('File54',149,169),excerpt('File54',207,231),excerpt('File15',355,416),excerpt('File51a',384,390),
],
'convenience':{
'full_File43_display_ledger':rows,
'Luke_primary_domain':{'head':'5326 BC','terminal':'AD 65','rows':77,'boundaries':78,'head_index_from_6BC':76,'terminal_index_from_6BC':-1,'Jesus_birth_index_from_6BC':0,'Adam_index_from_6BC':75},
'Matthew_locked_spans':{'BirthHinge':2800,'Carrier':2870,'birth_head_BC':2806,'envelope_head_BC':2876,'Jesus_birth_BC':6,'carrier_terminal_AD':65},
'File54_key_fork':{'Enoch_index':69,'Jared_index':70,'Adam_index':75,'source_span':4830,'P_span':4900,'E_span':5250,'base_hinge_BC':6,'parallel_rail_BC':36},
'File54_full_chiasm':{'boundary_labels':['5326 BC','3856 BC','1406 BC','AD 65'],'civil_coordinates':[-5325,-3855,-1405,65],'roles':['Luke outer head','BJ Creation','Conquest','Luke primary terminal'],'durations':[1470,2450,1470],'Luke_units':[21,35,21],'jubilee_units':[30,50,30]},
},
'derived_candidate_diagnostics':{
'status':'Provisional preparation calculations, for root to select and independently execute.',
'complete_positive_lattice_returns':returns,
'common_49_70_coarsening':common,
'complete_Luke_to_MT_rounded_bridge':round_bridge,
'primary_reflection':{'civil_midpoint':-2630,'label':'2631 BC','coordinate_formula':'x -> -5260-x','index_formula':'k -> 77-k','boundary_count':78,'fixed_source_boundary_count':0,'BJ_subpath_boundaries_paired':[21,56]},
},
'guards':[
'File43 full table is display-only: it is not an independent textual chronology and cannot derive or overwrite source span locks.',
'76 names Adam through Jesus create75 inter-name intervals; the names-span76*70 and outer God display block are separately typed.',
'Matthew2806 is birth-hinge;2876 is envelope. The visible41-name carrier sequence is not silently changed to42 rows.',
'God is a figurative bookend; no divine-origin chronology.',
'The 78th row AD65–135 is a further final-generation display extension, outside the primary77-row5390 completion.',
'All cross-axis comparisons here use civil BC+AD-1; Rounded crossing BC+AD-2 must not be imported.',
'The 36BC rail is admitted; AD35 is the secondary terminal. The rail-window and6BC-to-AD25 bridge remain separate.',
'File54 Gear3/Year6 Jared3656/3716 comparisons are out of current active scope; no upstream Gear transport.',
'File54 old pointer calls File52c inverse of inverse; current latest File52c and explicit user exclusion control. No second inversion.',
'File54 shared4836 cumulative Flood comparison does not merge node roles or replace whole source-controlled Flood ranges.',
'No new statistical trials or direct Luke dependence on Jubilees are inferred.',
],
}
OUT.mkdir(parents=True,exist_ok=True)
(OUT/'nt_inputs.json').write_text(json.dumps(out,indent=2,ensure_ascii=False)+'\n')
print(json.dumps({'tables':len(T),'ledger_rows':len(rows),'source_count':len(SOURCES),'returns':returns,'coarse_boundaries':common,'rounded_bridge_gaps':[x['gap_NT_minus_rounded'] for x in round_bridge]},ensure_ascii=False,indent=2))
Evidence
prepare nt inputs.py
Linked sources and evidence
Edition and provenance
prepare_nt_inputs.py
SHA-256 0603e6896358e5e16440d30871e67cb4d0309d93080ccb33bc33d19ef62e7842
C480–C1634/Research_Cycles/C0832_C0931/prep/prepare_nt_inputs.py