Skip to content

Fix mass consistency for configured second-moon properties#4

Merged
wiyth00 merged 3 commits into
mainfrom
fix/configured-second-moon-mass
Jul 25, 2026
Merged

Fix mass consistency for configured second-moon properties#4
wiyth00 merged 3 commits into
mainfrom
fix/configured-second-moon-mass

Conversation

@wiyth00

@wiyth00 wiyth00 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

Keep a customized second moon's radius, bulk density, and dynamical mass internally consistent.

baseline.yaml exposes radius_km and density_kg_m3, but _baseline_elements() supplies the package-default SECOND_MOON_MASS_KG regardless of those configured values. As a result, changing either bulk property could silently leave the N-body and saved-model mass at the original 838 km / 3344 kg m⁻³ value.

This patch makes OrbitalElements enforce the invariant at the model boundary:

  • Adds spherical_mass_kg(radius_km, density_kg_m3) with finite-positive input validation.
  • Recalculates mass_kg when radius or density is customized while mass remains at the package default.
  • Retains an explicit non-default mass, supporting independently constrained masses.
  • Rejects non-finite or non-positive radii, densities, and explicit masses.
  • Adds regression coverage for recalculation, explicit-mass retention, validation, and the original baseline mass.

Scientific impact

The checked-in baseline configuration is unchanged: 838 km and 3344 kg m⁻³ still produce the same 8.2430310159e21 kg mass, so published baseline outputs should not move.

Alternate configurations that changed radius or density without also changing mass will now use the physically derived mass. That is the intended correction and may change their trajectories, stability results, tides, and eclipse catalogs.

  • No change to computed results
  • Results change for previously inconsistent custom configurations (described above)

Checklist

  • ruff check . passes — CI pending
  • pytest passes — CI pending
  • New behaviour is covered by tests
  • User-facing scientific impact documented above

@wiyth00
wiyth00 merged commit eea375f into main Jul 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant