# Requires Python and pyswisseph. Swiss Ephemeris AGPL or commercial licensing applies.
import json,datetime as d
from pathlib import Path
import swisseph as s
O=Path(__file__).resolve().parent
refs=[{'id':'declaration-noon','name':'Declaration day · noon UT benchmark','utc':'1776-07-04T12:00:00Z','note':'A transparent daytime comparison for the Declaration’s adoption date. Noon UT is a sampling convention, not a documented national birth time.','source':'https://www.archives.gov/milestone-documents/declaration-of-independence'}, {'id':'sibly','name':'Sibly tradition · 17:10 Philadelphia LMT','utc':'1776-07-04T22:10:36Z','note':'An astrological convention, not a verified signing time. Uses 17:10 local mean time at 75°09′ W (UTC +5h00m36s). NCGR cites this Sibly convention; alternate chart traditions exist. Planetary comparisons only; no houses or ascendant are assigned here.','source':'https://ncgrastrology.org/wp-content/uploads/publications/geocosmic-journal-archive/2013_NCGR_Journal_2013.pdf'}, {'id':'constitution-noon','name':'Constitution signed · noon UT benchmark','utc':'1787-09-17T12:00:00Z','note':'A separate institutional milestone. Noon UT is a sampling convention, not a documented signing hour or an alternative claim about the Declaration.','source':'https://www.archives.gov/milestone-documents/constitution'}]
for r in refs:
 t=d.datetime.fromisoformat(r['utc'].replace('Z','+00:00'));j=s.julday(t.year,t.month,t.day,t.hour+t.minute/60+t.second/3600);r['positions']={}
 for n,c in [('Sun',s.SUN),('Moon',s.MOON),('Mercury',s.MERCURY),('Venus',s.VENUS),('Mars',s.MARS),('Jupiter',s.JUPITER),('Saturn',s.SATURN),('Uranus',s.URANUS)]:
  p,f=s.calc_ut(j,c,s.FLG_MOSEPH|s.FLG_SPEED);assert f&s.FLG_MOSEPH;r['positions'][n]={'longitude':p[0],'latitude':p[1],'speed':p[3]}
json.dump({'meta':{'ephemeris':'Swiss Ephemeris 2.10.03, explicit Moshier, apparent geocentric tropical positions; UT with built-in Delta T.','method':'Compare current carriers against each declared reference with the same 0/60/90/120/180° and 3° longitude tolerance. No reference is selected by default. This is a comparison of positions, not evidence for a national destiny.','readingVersion':'1.2.0'},'references':refs,'readingSources':[{'name':'Western traditional domiciles and planetary descriptions · Ptolemy I','url':'https://penelope.uchicago.edu/Thayer/E/Roman/Texts/Ptolemy/Tetrabiblos/1B*.html'},{'name':'Contemporary Western November 2026 interpretation','url':'https://www.astrology.com/article/november-2026-astrology-key-dates/'},{'name':'Greek planetary names and star stories','url':'https://www.theoi.com/greek-mythology/star-myths.html'}]},open(O/'reading-references.json','w'),ensure_ascii=False,indent=2)
