Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(psp): Composite PSP #301

Merged
merged 2 commits into from
May 21, 2024
Merged

Conversation

nstarman
Copy link
Contributor

@nstarman nstarman commented May 7, 2024

This PR allows for PhaseSpacePosition that are composites of other PSPs.
A composite PSP acts like a single PSP but is a dictionary of PSPs.
This is structurally similar to CompositePotential.

In particular I apply this to MockStream so that we have distinct leading and trailing arms. Rather than doing a stepped slice index to find each arm, it's just a mockstream["leading"] getitem. When accessing the composite properties, e.g. q it's just interleaved in the concatenation by the release-time.

Having a composite PSP means it will be easier to support other star ejection mechanisms from progenitors, e.g. 3-body encounters. Then we'd have mockstream["threebody"].

The alternative to this PR is to have a string label list on on the mockstream. I don't think that's as clean (since we will need to always ensure that slicing and ordering is maintained), but it is maybe simpler.
Thinking more, perhaps the string label list approach is the best thing to start with? But then we should really clean up the df sampling logic happen in mockstreamgenerator.

@nstarman nstarman added this to the v0.1 milestone May 7, 2024
@nstarman nstarman force-pushed the stream-branches branch 3 times, most recently from 521adf3 to 9b130a3 Compare May 8, 2024 03:48
@nstarman
Copy link
Contributor Author

nstarman commented May 8, 2024

Note to self: failing because of patrick-kidger/diffrax#412

@nstarman nstarman changed the title feat(pop): Composite PSP feat(psp): Composite PSP May 8, 2024
@nstarman nstarman force-pushed the stream-branches branch 2 times, most recently from feb7731 to 25cce1e Compare May 9, 2024 15:01
Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 97.27273% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 94.88%. Comparing base (aca045a) to head (f6d5c09).

Files Patch % Lines
src/galax/dynamics/_compat.py 66.66% 2 Missing ⚠️
src/galax/coordinates/_psp/base_composite.py 97.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #301      +/-   ##
==========================================
+ Coverage   94.38%   94.88%   +0.49%     
==========================================
  Files          60       62       +2     
  Lines        2351     2404      +53     
==========================================
+ Hits         2219     2281      +62     
+ Misses        132      123       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nstarman
Copy link
Contributor Author

nstarman commented May 9, 2024

TODO: stack Vecs. RN it doesn't work (and isn't tested!)

@nstarman nstarman requested review from adrn and jnibauer May 9, 2024 18:02
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
@nstarman
Copy link
Contributor Author

nstarman commented May 21, 2024

The followup to this PR is to let the DF determine the PSP type. So FardalDF would produce MockStreamArm. A CoreSprayDF would produce a PSP (or some other class). The whole thing gets wrapped up into a MockStream composite object (which we might want to rename as well?).

Signed-off-by: nstarman <nstarman@users.noreply.github.com>
@nstarman nstarman marked this pull request as ready for review May 21, 2024 16:18
@nstarman nstarman merged commit d305016 into GalacticDynamics:main May 21, 2024
14 checks passed
@nstarman nstarman deleted the stream-branches branch May 21, 2024 16:19
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