OA is a compact, explainable interior model for the interview exercise: computing and plotting mass-radius relationships for differentiated planets. The implementation is inspired by the following works: Seager et al. (2007) and Huang et al. (2022).
The model is intentionally staged:
- Modified-polytrope EOS and single shooting.
- Double shooting to a fitting mass.
- Seager-inspired cold EOS regimes for Fe, MgSiO3, and H2O.
- Optional low-pressure EOS sensitivity experiments.
- Thin isothermal ideal-gas atmosphere.
- MAGRATHEA-like explicit ideal-gas envelope layer with self-gravity.
- A small emulator trained on OA outputs.
cd /home/gugli/OA_model
source .venv/bin/activatepython -m pytest -qTask 2 uses the completed clean dataset at
data/emulator_dataset_30k_checkpoints/emulator_dataset_clean.csv (with the
identical figures/emulator_dataset_clean.csv as a fallback). It never starts
dataset generation implicitly. Run the complete candidate comparison,
grouped-curve selection, evaluation, plotting, and benchmark with:
python scripts/train_emulator.pyResults are written to data/emulator_task2/, the selected inference bundle
is data/emulator_task2/selected_emulator.joblib, and diagnostic plots use the
figures/emulator_task2_*.png prefix. Repeating the same command with the same
dataset and training configuration validates and reuses the cached results;
changing either invalidates that cache.
The model is a single fast surrogate for OA within the sampled parameter domain and the fixed 0.1-bar transit-pressure convention. It is not an independent physical model and should not be used for extrapolation.
The Python builder is the source of truth for the extended notebook. Generate it, then execute every cell with an unlimited notebook timeout:
python scripts/build_mr_exercise_notebook.py
jupyter nbconvert --to notebook --execute OA_mass_radius_exercise_extended.ipynb --inplace --ExecutePreprocessor.timeout=-1If Task 2 outputs are already complete, the notebook loads the cached
artifacts. If they are missing, it invokes scripts/train_emulator.py; it does
not regenerate the Task 1 dataset.
jupyter nbconvert --to notebook --execute OA_mass_radius_model.ipynb --inplaceThe fiducial condensed model is cold and temperature-independent. EOS-regime switching is not treated as a physical phase diagram. Bare-solid radii are defined near zero pressure, while atmospheric transit radii are defined at 100 mbar. The water EOS is a Seager et al. (2007)-style bulk-radius construction, not a detailed near-surface water mineralogy model. TFD is conditional and is not implemented in v1 because the validated 0.1-15 Earth-mass grid remains below the Seager TFD thresholds.
The explicit gas-envelope option treats the envelope as the outermost mass layer, so the gas mass contributes to enclosed mass during the hydrostatic integration. Its default gas EOS remains intentionally simple: ideal H/He, isothermal above 100 bar and adiabatic below. Warnings are emitted when the gas base pressure exceeds 0.1 GPa, when the gas mass fraction exceeds 1%, or when deep-envelope temperatures leave the conservative pedagogical regime.