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

Handle unbound orbits in actionAngle-related functions in new Orbit class #383

Open
jobovy opened this issue Jun 4, 2019 · 7 comments
Open

Comments

@jobovy
Copy link
Owner

jobovy commented Jun 4, 2019

In the new Orbit class, pure Python actionAngle-related functions fail for unbound orbits and cause the entire function to fail when Orbit contains multiple objects. Need to catch the unbound orbits without raising an error (see also #371).

@jobovy jobovy added this to the v1.6 milestone Jun 4, 2019
@jobovy jobovy added the pinned label Feb 10, 2020
@jobovy jobovy modified the milestones: v1.6, v1.7 Apr 21, 2020
@jobovy jobovy modified the milestones: v1.7, v1.8 Jul 11, 2021
@jobovy jobovy modified the milestones: v1.8, v1.9 Jun 24, 2022
@jobovy jobovy modified the milestones: v1.9, v1.10 Jun 28, 2023
@RaynaRampalli
Copy link

Hi, I'm running into this issue when calculating actions for 3+ million stars using galpy and am looping thru each star one by one. Do you have any suggested simple workarounds for suppressing the error and just returning nans or something for now? I've tried a couple things and no luck. Thank you!

@jobovy
Copy link
Owner Author

jobovy commented Jun 17, 2024

Hi, I'm running into this issue when calculating actions for 3+ million stars using galpy and am looping thru each star one by one. Do you have any suggested simple workarounds for suppressing the error and just returning nans or something for now? I've tried a couple things and no luck. Thank you!

Thanks for reaching out, sounds like we might actually finally have to fix this issue! Quick question: Can you determine the stars for which the action-angle calculation fails just by determining which stars are unbound, that is, have E > E(infinity)? For example, assuming the orb object is an Orbit instance with multiple objects, some of which have failing action-angles, do

import numpy
from galpy.potential import MWPotential2014, evaluatePotentials
indx= orb.E(pot=MWPotential2014,use_physical=False) < evaluatePotentials(MWPotential2014,numpy.inf,0.,use_physical=False)

Does indx than have the index for all objects that have successful action-angle coordiantes (and True^indx the index for all objects for which they fail?). If that method works, then it should be easy for you to do and I can then also use it to create a fix for this issue. Thanks!

@jobovy
Copy link
Owner Author

jobovy commented Jun 26, 2024

Hi @RaynaRampalli! Just wanted to check whether you've had a chance to try the fix that I suggested above? I'm getting ready to release a new version of galpy soon and it would be nice to include a proper fix to this issue then. Thanks!

@RaynaRampalli
Copy link

RaynaRampalli commented Jun 26, 2024 via email

@jobovy jobovy modified the milestones: v1.10, v1.11 Jul 7, 2024
@jobovy
Copy link
Owner Author

jobovy commented Nov 14, 2024

This fell off my radar until I came across this issue again just now, but I was wondering whether you ever had a chance to check the fix that I suggested @RaynaRampalli?

@RaynaRampalli
Copy link

RaynaRampalli commented Nov 21, 2024 via email

@jobovy
Copy link
Owner Author

jobovy commented Nov 23, 2024

So sorry, I got really busy with travel and application season. I just tried out your solution, and it does work! Will incorporate it into my action calculations going forward, thank you so much.

Great, thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants