df.streamspraydf: allow callable, time-dependent progenitor_mass#880
Open
jobovy wants to merge 1 commit into
Open
df.streamspraydf: allow callable, time-dependent progenitor_mass#880jobovy wants to merge 1 commit into
jobovy wants to merge 1 commit into
Conversation
`progenitor_mass` now accepts either a scalar/Quantity (existing behaviour) or a callable `M(t)` of the progenitor-time coordinate (t=0 = now, t<0 = past). Quantity input and/or output are auto-detected with the same four-branch pattern used by `AnyAxisymmetricRazorThinDiskPotential`. Internally the value is stored as `self._progenitor_mass_fn`, evaluated at the per-particle stripping time in `_calc_rtide` and in `chen24spraydf.spray_df`'s escape-velocity calculation. The legacy `self._progenitor_mass` attribute is retained, pinned to the present-day mass for backward compatibility. Tests added in test_streamspraydf.py (callable=scalar equivalence, evolving-mass tidal-radius scaling, attribute back-compat, array-input vectorisation) and in test_quantity.py for all three Quantity in/out combinations. Tutorial notebook gains a worked example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #880 +/- ##
=======================================
Coverage 99.92% 99.92%
=======================================
Files 225 225
Lines 33875 33911 +36
Branches 710 710
=======================================
+ Hits 33848 33884 +36
Misses 27 27 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
progenitor_massonbasestreamspraydf/chen24spraydf/fardal15spraydfnow accepts either a scalar/Quantity(existing behaviour) or a callableM(t)of the progenitor-time coordinate (t=0is now,t<0is past).AnyAxisymmetricRazorThinDiskPotential.self._progenitor_mass_fnand evaluated at each particle's stripping time in_calc_rtideand in the Chen24 escape-velocity calculation. The legacyself._progenitor_massattribute is kept, pinned to the present-day mass.tests/test_streamspraydf.py(callable=scalar equivalence, evolving-mass tidal-radius scaling, attribute back-compat, vectorisation) and intests/test_quantity.py(all three Quantity in/out combinations, both spray models).Test plan
pytest tests/test_streamspraydf.py— 27 passedpytest tests/test_quantity.py -k 'streamspraydf or progmass'— 7 passed (3 new + 4 existing)jupyter nbconvert --to notebook --execute --inplace doc/source/tutorials/streams/streamspraydf.ipynb— executes cleanly🤖 Generated with Claude Code