Erweitere Baryzentrum-Übergangstabelle

This commit is contained in:
2026-08-30 20:14:49 +02:00
parent 09dc6198ac
commit 0427e3cf2c
2 changed files with 115 additions and 1 deletions
+24
View File
@@ -5801,8 +5801,11 @@ def action_barycenter(args: list[str]) -> dict:
days_per_step = 365.25 / steps_per_year
start_jd = now_time.tt - years_back * 365.25
series = []
threshold_events = []
max_dist_au = 0.0
max_proj_dist_au = 0.0
previous_time_tt = None
previous_inside = None
for i in range(total_steps + 1):
t = astronomy.Time(start_jd + i * days_per_step)
s = astronomy.BaryState(astronomy.Body.Sun, t)
@@ -5813,6 +5816,26 @@ def action_barycenter(args: list[str]) -> dict:
max_dist_au = d
if dp > max_proj_dist_au:
max_proj_dist_au = dp
inside_sun = dp <= _SUN_RADIUS_AU
if previous_time_tt is not None and inside_sun != previous_inside:
left_tt = previous_time_tt
right_tt = t.tt
for _ in range(24):
middle_tt = (left_tt + right_tt) / 2
middle_sun = astronomy.BaryState(astronomy.Body.Sun, astronomy.Time(middle_tt))
middle_inside = math.hypot(-middle_sun.x, -middle_sun.y) <= _SUN_RADIUS_AU
if middle_inside == previous_inside:
left_tt = middle_tt
else:
right_tt = middle_tt
event_dt = datetime(2000, 1, 1, 12, tzinfo=timezone.utc) + timedelta(days=(left_tt + right_tt) / 2)
threshold_events.append({
"date_utc": event_dt.strftime("%Y-%m-%dT%H:%M:%SZ"),
"state": "inside" if inside_sun else "outside",
})
previous_time_tt = t.tt
previous_inside = inside_sun
dt_utc = datetime(2000, 1, 1, 12, tzinfo=timezone.utc) + timedelta(days=t.tt - 0.0)
# Epoche J2000.0 = 2000-01-01 12:00 TT ≈ UTC (Differenz <1 min hier vernachlässigt)
series.append({
@@ -5889,6 +5912,7 @@ def action_barycenter(args: list[str]) -> dict:
},
"series": series,
"series_dates": series_dates,
"threshold_events": threshold_events,
"now_index": now_index,
"max_dist_solar_radii": round(max_dist_au / _SUN_RADIUS_AU, 3),
"max_proj_dist_solar_radii": round(max_proj_dist_au / _SUN_RADIUS_AU, 3),