Conversation
…within the POSYDON grid (min track mass is 0.1 Msun). Also added a helper to scale lifetimes to the equivalent POSYDON lifetime for collAIder predictions.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new mass-track selection can pass duplicate xp values into np.interp at the grid bounds, which can yield NaNs when target_mass equals the min/max track mass.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the encounter physics utilities to better support collAIder predictions by adding a helper that converts a main-sequence fractional age into a physical age using POSYDON v2 TAMS lifetimes, including a fallback for the lowest-mass tracks that don’t reach the central-H threshold within the grid history.
Changes:
- Added
convert_fractional_age()to map fractional main-sequence age → physical age (Gyr) via POSYDON v2 TAMS lifetimes. - Added fallback behavior for tracks that never reach central H < 1e-5 (use last history age).
File summaries
| File | Description |
|---|---|
| src/encounter_physics.py | Adds a lifetime-scaling helper based on POSYDON v2 TAMS ages (with a low-mass fallback). |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+108
to
+113
| if target_mass <= masses.min(): | ||
| matches = np.argmin(masses), np.argmin(masses) | ||
| elif target_mass >= masses.max(): | ||
| matches = np.argmax(masses), np.argmax(masses) | ||
| else: | ||
| matches = np.argsort(np.abs(masses - target_mass))[:2] |
Comment on lines
+128
to
+129
| tams_age = ages[-1] # if never reach 10^-5 central H,use the last age. This only affects the | ||
| # lowest mass stars (< 0.1137 MSun), which reach between 2*10^(-5) and 10^(-4) central H in the history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removed line of code causing crashes for stars that don't reach TAMS and/or not included in the POSYDON grid (min track mass is 0.1 Msun). Also added a helper to scale lifetimes to the equivalent POSYDON lifetime for collAIder predictions.
Modified the shared POSYDON track lookup used by StellarRadiusEstimator and convert_fractional_age into helper functions.