Validation: src/mors/stellarevo.py
What this page checks
This page checks how MORS interpolates and manages the stellar-structure tracks of Spada et al. (2013)1.
StarEvo in mors.stellarevo reads stellar evolutionary models and interpolates bolometric luminosity, stellar radius, and effective temperature as functions of stellar mass and age.
Validation means that a test runs the code on a case with a known right answer and checks the result within a stated tolerance.
If this part of the code is wrong, every stellar luminosity, radius and temperature of MORS is wrong, and so are the values that PROTEUS reads.
Each case below says why the check exists, what it tests, how we know the right answer and why it matters; a box "Test details" ends each case.
Solar calibration
Why this check exists. The interpolation can read the wrong track, use the wrong age unit (the code expects Myr), or rescale the native units without an error message. Near 1 Msun, a track one 0.05 Msun bin away changes the luminosity by 26 to 35 %, outside the 0.15 Lsun (15 %) tolerance.
What it tests. stellarevo.Value(Mstar, Age, key) reads the Spada et al. (2013) grid (24 mass bins from 0.1 to 1.25 Msun, loaded from FWL_DATA) and returns structural quantities by linear interpolation in age, then in mass. The native units are solar luminosities for Lbol, solar radii for Rstar and K for Teff. The Spada et al. (2013) models are solar-calibrated. At the solar age of 4.57 Gyr, the interpolated 1 Msun track returns 1.080 Lsun, 1.015 Rsun and 5844 K. These lie 8.0 %, 1.5 % and 1.2 % above the solar values (1 Lsun, 1 Rsun and 5772 K). The test asserts that L lands inside 0.15 Lsun of unity, R lands inside 0.05 Rsun of unity, and Teff deviates by under 3% from 5772 K. A companion test (test_stellarevo_luminosity_increases_with_mass) samples masses from 0.3 to 1.2 Msun and asserts strict monotonic increase, with the lightest and heaviest tracks separated by more than two orders of magnitude.
How we know the right answer. The Spada et al. (2013) tracks are solar-calibrated, so a 1 Msun star at the solar age must reproduce the Sun: unity in luminosity and radius in solar units, and the standard solar effective temperature of 5772 K. The companion test adds an independent check on the mass ordering of the tracks.
Why it matters. physicalmodel, rotevo and star take the stellar structure from a StarEvo grid, and synthesis calls Value and Lbol.
How to read the plot. The x-axis is the age in Myr on a log scale. The 3 panels show \(L\) in \(L_\odot\), \(R\) in \(R_\odot\) and \(T_\mathrm{eff}\) in K. The line is the 1 Msun Spada et al. (2013) track and gives context. The test asserts the track values at 4.57 Gyr (circles) against the Sun (squares). The error bars are the tolerances: 0.15 \(L_\odot\) (15 %), 0.05 \(R_\odot\) (5 %) and 3 % of 5772 K. A pass means that each circle lies inside its error bar.
Test details
- Reference: Spada et al. (2013)1 solar-calibrated tracks; solar effective temperature 5772 K
- Tolerance:
atol=0.15Lsun on L,atol=0.05Rsun on R,rtol=0.03on Teff at 4.57 Gyr - Test id:
tests/test_stellarevo.py::test_stellarevo_solar_calibration - Command:
pytest tests/test_stellarevo.py::test_stellarevo_solar_calibration(needsFWL_DATAwith the tracks)
Grid compiled from the raw tracks
Why this check exists. Reading the raw .track1 and .track2 files can go wrong through a wrong column, a dropped conversion from log to linear values, or a wrong age unit. Each of these moves the solar point of the compiled grid without an error message.
What it tests. The test compiles the grid from scratch using raw track files in FWL_DATA. It checks that the freshly compiled 1 Msun track satisfies the solar calibration at 4.57 Gyr, and verifies that a second construction yields the same Lbol and Teff.
How we know the right answer. The solar calibration of the Spada et al. (2013) tracks, as in the case above, with wider tolerances. A wrong column or unit moves the solar point outside them. The second construction must give the same values to rtol=1e-12.
Why it matters. MORS compiles the grid from the raw files when no compiled grid exists and writes it as a cache that later runs read. If the write fails, MORS logs a warning and compiles the grid again in the next run.
How to read the plot. The x-axis is the age on a log scale; the lines are Lbol and Rstar of the freshly compiled 1 Msun grid and give context. The test asserts the compiled values at 4.57 Gyr (circles) against 1 Lsun and 1 Rsun (squares, error bars 0.2 Lsun and 0.1 Rsun). The plus (+) is the luminosity of a second construction, asserted equal to a relative 1e-12, too small to see. A pass means that each circle lies inside its error bar and the plus sits on the top circle. The cache file location, the 0.5 Lsun guard and the equal effective temperatures are asserted but not drawn.
Known limit. The test compares Lbol and Rstar with the solar reference, but checks Teff only against a second construction from the same code, so a Teff left in log units does not fail it. It also does not check that the second construction reads the cache file.
Test details
- Reference: Spada et al. (2013)1 raw track files
- Tolerance:
atol=0.2Lsun on L andatol=0.1Rsun on R at 4.57 Gyr;LbolandTeffat 1 Msun and 4.57 Gyr from a second construction agree withrtol=1e-12(the test does not check that this construction reads the cache file) - Test id:
tests/test_stellarevo.py::test_grid_compiled_from_raw_tracks_matches_saved_grid - Command:
pytest tests/test_stellarevo.py::test_grid_compiled_from_raw_tracks_matches_saved_grid(needsFWL_DATAwith the tracks)
Related code
src/mors/stellarevo.py:StarEvo,Value,Lbol,Rstar,Teff, and moment-of-inertia wrappers.src/mors/physicalmodel.py: converts the nativeLbolto erg/s for the rotation tracks thatStarholds; see star.md.tests/test_stellarevo.py:test_stellarevo_solar_calibrationandtest_grid_compiled_from_raw_tracks_matches_saved_grid.
References
-
F. Spada, P. Demarque, Y.-C. Kim, A. Sills, The Radius Discrepancy in Low-mass Stars: Single versus Binaries, The Astrophysical Journal, 776, 87, 2013. SciX. ↩↩↩