-
-
Notifications
You must be signed in to change notification settings - Fork 408
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 non-ICRS coordinates in query functions #3164
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3164 +/- ##
=======================================
Coverage 68.69% 68.70%
=======================================
Files 231 231
Lines 19214 19220 +6
=======================================
+ Hits 13199 13205 +6
Misses 6015 6015 ☔ View full report in Codecov by Sentry. |
4dc257f
to
f2bd777
Compare
4baa044
to
50648fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should live in the commons function, or you could use what we already have for simbad (_parse_coordinate_and_convert_to_icrs)?
(or also move the simbad one to commons? cc @ManonMarchand )
_parse_coordinate_and_convert_to_icrs
astroquery/mast/utils.py
Outdated
@@ -121,6 +121,32 @@ def resolve_object(objectname): | |||
return coordinates | |||
|
|||
|
|||
def parse_coordinates(coordinates): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be a kwarg argument for commons.parse_coordinates
instead? e.g. to convert right at the end before returning the current output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean a parameter like return_frame
or something to that effect that you could pass in a value like 'ICRS' and get the coordinate back in whatever frame was given?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just made this change! I added a return_frame
parameter to utils.commons.parse_coordinates
that defaults to None
. If it is provided and the coordinates are not already in that frame, it will attempt to transform them. If the transformation fails, a warning is issued and the coordinates are returned as is, without the transformation.
Oh that methods only parses coordinates if I detect that they are written as a sim-script string. This is an old way of writing coordinates that only existed in the former Simbad interface (hence this is in Simbad's utils and not in commons). |
f83c591
to
0746ddf
Compare
This PR handles coordinates passed into query functions that are not in the ICRS frame. If it is found that the given coordinates are not in ICRS, they are transformed.