Skip to content

GAIA: new simplified cross match method #3320

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

Conversation

cosmoJFH
Copy link
Contributor

@cosmoJFH cosmoJFH commented May 16, 2025

Dear astroquery team,

The current implementation of the astroquery.gaia built-in cross-match tool relies in a sub-optimal intermediate ADQL query. Furthermore (and after uploading a table to the user space), it requires a 3-step approach involving different functionalities (each of them requiring multiple "user clicks"):

  1. Update the user table metadata to flag the positional (ra & dec) fields using a dedicated method ("update_user_table" - see Sect 2.5 in the astroquery.gaia documentation)
  2. Launch the built-in cross-match method ("cross_match" - see Sect 2.6 in the astroquery.gaia documentation)
  3. Launch a sub-optimal and complicated ADQL query using the "launch_job" or "launch_job_async" method (see Sect 2.6 in the astroquery.gaia documentation).

We propose to streamline this procedure to improve the user experience and hopefully promote the usage of this functionality by updating the current implementation.

The proposed mechanism:

  1. allows to obtain a basic cross-match using a single step (versus three steps currently).
  2. allows to perform cross-matches between: user_table X user_table, user_table X GACS_table, and GACS_table X GACS_table (as in the current implementation).

We have developed the new method cross_match_basic as well as new tests. This change is backward compatible with the present implementation of the cross-match method.

cc @esdc-esac-esa-int

jira: GAIASWRQ-25

@bsipocz bsipocz added this to the v0.4.11 milestone May 16, 2025
@cosmoJFH cosmoJFH force-pushed the ESA_gaia_GAIASWRQ-25_improve_cross-match branch 3 times, most recently from a80c138 to dc0fac9 Compare May 16, 2025 17:32
Copy link

codecov bot commented May 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.97%. Comparing base (823e49f) to head (e63ae6b).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3320      +/-   ##
==========================================
+ Coverage   69.88%   69.97%   +0.08%     
==========================================
  Files         232      232              
  Lines       19761    19814      +53     
==========================================
+ Hits        13810    13864      +54     
+ Misses       5951     5950       -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cosmoJFH cosmoJFH force-pushed the ESA_gaia_GAIASWRQ-25_improve_cross-match branch 9 times, most recently from 49dbbfe to 34b324d Compare May 19, 2025 09:24
@cosmoJFH cosmoJFH force-pushed the ESA_gaia_GAIASWRQ-25_improve_cross-match branch from 7fb5b9d to e63ae6b Compare June 2, 2025 09:43
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Overall looks good, I just have minor comments.

And please rebase so it picks up the recent fixes and will pass the RTD build.

@@ -853,15 +848,155 @@ def load_user(self, user_id, *, verbose=False):

return self.is_valid_user(user_id=user_id, verbose=verbose)

def cross_match_basic(self, *, table_a_full_qualified_name, table_a_column_ra, table_a_column_dec,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice this weirdness in the argument names before, e.g. why do we need qualified in there, what does it even mean?

Anyway, I see that it's some historical heritage that we haven't spotted before, so let's keep it to have a consistent API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"qualified" means that the name of the table must contain the schema. Something like "my_schema.my_table"

Comment on lines 860 to 862
#. updates the user table metadata to flag the positional RA/Dec columns;
#. launches a positional cross-match as an asynchronous query;
#. returns all the columns from both tables plus the angular distance (deg) for the cross-matched sources.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this won't be auto resolved into numbers in the docstrings, only when sphinx rendered, so could you please instead spell out the numberings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Changes committed to the branch.

the ‘dec’ column in the table table_b_full_qualified_name
results_name : str, optional, default None
custom name defined by the user for the job that is going to be created
radius : float (arc. seconds), optional, default 1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be useful to accept Quantity radius, too, not just floats

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The methods cross_match and cross_match_basic now accept radius as a Quantity

@cosmoJFH cosmoJFH force-pushed the ESA_gaia_GAIASWRQ-25_improve_cross-match branch from 09f2f1b to f7948be Compare June 3, 2025 09:38
@cosmoJFH
Copy link
Contributor Author

cosmoJFH commented Jun 3, 2025

Branch rebased.

Comment on lines 858 to 860
step:
1. updates the user table metadata to flag the positional RA/Dec columns;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this lack of an empty line is the cause for the sphinx failure

Suggested change
step:
1. updates the user table metadata to flag the positional RA/Dec columns;
step:
1. updates the user table metadata to flag the positional RA/Dec columns;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Changes committed to the branch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll investigate what goes wrong with the oldest and dev builds, I'm certain it is unrelated, yet it's something new and concerning so I rather check them out first to be sure.

@cosmoJFH cosmoJFH force-pushed the ESA_gaia_GAIASWRQ-25_improve_cross-match branch from c05573e to 2676412 Compare June 3, 2025 14:50
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

CI failures are unrelated and have been fixed in main, thus I go ahead with the merge as is.

@bsipocz bsipocz merged commit 8b57bef into astropy:main Jun 4, 2025
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants