//! Reproduce the daily UTC-noon tropical/Lahiri Sun-sign sampling protocol. //! //! Run from a repository checkout: //! `cargo run --locked -p triastra-astrology-engine --example reproduce_sun_sign_study` //! //! Standard output is CSV; the observed count summary goes to standard error. //! This performs a new run with the current checkout and available ephemeris //! environment. It does not replay the preserved original study binary or prove //! which native backend supplied positions; the wrapper omits backend-return flags. //! Numerical values are emitted with the original consumer's 17 decimal places, //! not as a claim of physical precision. No customer data or provider calls are used. use std::error::Error; use std::io::{self, BufWriter, Write}; use triastra_astrology_engine::astro::{ ephemeris::SwissEphemerisWrapper, julian_day::civil_date_to_jd_noon, zodiac::{longitude_to_sign_sidereal, longitude_to_sign_tropical}, }; use triastra_contracts::Planet; fn main() -> Result<(), Box> { let mut day = jiff::civil::date(2000, 1, 1); let end = jiff::civil::date(2001, 1, 1); let ephemeris = SwissEphemerisWrapper::global(); let mut total = 0_usize; let mut same = 0_usize; let mut output = BufWriter::new(io::stdout().lock()); writeln!( output, "kind,utc,jd,tropical_longitude_deg,lahiri_longitude_deg,tropical_sign,lahiri_sign" )?; // Keep native calls serial and let the canonical wrapper own Swiss state. while day < end { let jd = civil_date_to_jd_noon(day); let (tropical, _, _, _) = ephemeris.calculate_planet_position(&Planet::Sun, jd)?; let (lahiri, _, _, _) = ephemeris.calculate_sidereal_planet_position_lahiri(&Planet::Sun, jd)?; let tropical_sign = longitude_to_sign_tropical(tropical)?; let lahiri_sign = longitude_to_sign_sidereal(lahiri)?; writeln!( output, "row,{day}T12:00:00Z,{jd:.17},{tropical:.17},{lahiri:.17},{tropical_sign:?},{lahiri_sign:?}" )?; total += 1; same += usize::from(tropical_sign == lahiri_sign); day = day.tomorrow()?; } if total != 366 { return Err("incomplete protocol sample frame".into()); } output.flush()?; eprintln!( "sampled_instants={total} same_sign={same} different_sign={}", total - same ); Ok(()) }