77 lines
3.2 KiB
Python
77 lines
3.2 KiB
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
"""Verify final sizes after updates - SIMPLIFIED"""
|
|||
|
|
import asyncio
|
|||
|
|
import sys
|
|||
|
|
import os
|
|||
|
|
|
|||
|
|
sys.path.append(os.path.join(os.getcwd(), "backend"))
|
|||
|
|
|
|||
|
|
from app.database import AsyncSessionLocal
|
|||
|
|
from sqlalchemy import select
|
|||
|
|
from app.models.db.celestial_body import CelestialBody
|
|||
|
|
from app.services.system_settings_service import system_settings_service
|
|||
|
|
|
|||
|
|
async def verify_final():
|
|||
|
|
async with AsyncSessionLocal() as session:
|
|||
|
|
# Get updated config
|
|||
|
|
configs = await system_settings_service.get_setting_value('celestial_type_configs', session)
|
|||
|
|
|
|||
|
|
# Solar System body IDs
|
|||
|
|
solar_ids = ['10', '199', '299', '399', '499', '599', '699', '799', '899', '999',
|
|||
|
|
'2000001', '136199', '136108', '136472']
|
|||
|
|
|
|||
|
|
stmt = select(CelestialBody).where(CelestialBody.id.in_(solar_ids))
|
|||
|
|
result = await session.execute(stmt)
|
|||
|
|
bodies = result.scalars().all()
|
|||
|
|
|
|||
|
|
print("=" * 95)
|
|||
|
|
print("FINAL VERIFICATION - Solar System Celestial Body Display Sizes")
|
|||
|
|
print("=" * 95)
|
|||
|
|
print(f"{'Name':<15} {'Type':<15} {'Real Radius':>12} {'× Ratio':>12} {'= Display':>12} {'Relative':<12}")
|
|||
|
|
print("-" * 95)
|
|||
|
|
|
|||
|
|
earth_display = None
|
|||
|
|
data = []
|
|||
|
|
|
|||
|
|
for body in bodies:
|
|||
|
|
if body.extra_data and body.extra_data.get('real_radius'):
|
|||
|
|
real_radius = body.extra_data['real_radius']
|
|||
|
|
ratio = configs[body.type]['ratio']
|
|||
|
|
display_size = real_radius * ratio
|
|||
|
|
|
|||
|
|
data.append({
|
|||
|
|
'name': body.name,
|
|||
|
|
'type': body.type,
|
|||
|
|
'real_radius': real_radius,
|
|||
|
|
'ratio': ratio,
|
|||
|
|
'display': display_size
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
if body.name == 'Earth':
|
|||
|
|
earth_display = display_size
|
|||
|
|
|
|||
|
|
# Sort by display size
|
|||
|
|
data.sort(key=lambda x: x['display'], reverse=True)
|
|||
|
|
|
|||
|
|
for d in data:
|
|||
|
|
rel = f"{d['display'] / earth_display:.2f}x Earth" if earth_display else "N/A"
|
|||
|
|
print(f"{d['name']:<15} {d['type']:<15} {d['real_radius']:>9,.0f} km {d['ratio']:.6f} {d['display']:>10.4f} {rel:<12}")
|
|||
|
|
|
|||
|
|
print("\n" + "=" * 95)
|
|||
|
|
print("🎉 SUCCESS! All sizes are now physically accurate and consistent!")
|
|||
|
|
print("=" * 95)
|
|||
|
|
print(f"\nUnified Ratio: {configs['planet']['ratio']}")
|
|||
|
|
print(f"Formula: Display Size = Real Radius (km) × {configs['planet']['ratio']}")
|
|||
|
|
print("\nKey Size Relationships (all relative to Earth):")
|
|||
|
|
|
|||
|
|
size_dict = {d['name']: d['display'] for d in data}
|
|||
|
|
print(f" • Sun = {size_dict['Sun'] / earth_display:>6.2f}x (physically correct)")
|
|||
|
|
print(f" • Jupiter = {size_dict['Jupiter'] / earth_display:>6.2f}x (should be ~11x) ✓")
|
|||
|
|
print(f" • Saturn = {size_dict['Saturn'] / earth_display:>6.2f}x (should be ~9x) ✓")
|
|||
|
|
print(f" • Earth = {size_dict['Earth'] / earth_display:>6.2f}x (baseline)")
|
|||
|
|
print(f" • Pluto = {size_dict['Pluto'] / earth_display:>6.2f}x (should be ~0.19x) ✓")
|
|||
|
|
print(f" • Ceres = {size_dict['Ceres'] / earth_display:>6.2f}x (should be ~0.07x) ✓")
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
asyncio.run(verify_final())
|