Skip to content

[XMatch] fix: upload of two local tables is now possible#3116

Merged
bsipocz merged 1 commit into
astropy:mainfrom
cds-astro:fix-xmatch-two-local-files
Oct 4, 2024
Merged

[XMatch] fix: upload of two local tables is now possible#3116
bsipocz merged 1 commit into
astropy:mainfrom
cds-astro:fix-xmatch-two-local-files

Conversation

@ManonMarchand

@ManonMarchand ManonMarchand commented Oct 4, 2024

Copy link
Copy Markdown
Member

Hello astroquery 🙂

In the files dictionary sent to XMatch, the second table was written over the first one, resulting in a confusing "missing cat1" error even if the user did give a cat1. This fixes #3115 , closes #1687 and closes #1786

I did not add a remote test, only a local one. Is it ok?

@codecov

codecov Bot commented Oct 4, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.38%. Comparing base (ba9350a) to head (5c4a02b).
Report is 121 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3116      +/-   ##
==========================================
+ Coverage   67.36%   67.38%   +0.02%     
==========================================
  Files         233      233              
  Lines       18415    18417       +2     
==========================================
+ Hits        12405    12411       +6     
+ Misses       6010     6006       -4     

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

@ManonMarchand ManonMarchand changed the title fix: upload of two local tables is now possible [XMatch] fix: upload of two local tables is now possible Oct 4, 2024
@ManonMarchand ManonMarchand requested a review from bsipocz October 4, 2024 10:18
@bsipocz bsipocz added the bug label Oct 4, 2024
@bsipocz bsipocz added this to the v0.4.8 milestone Oct 4, 2024

@bsipocz bsipocz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the fix!

Local only tests for this is fully reasonable.

Comment thread astroquery/xmatch/core.py
fp = StringIO()
cat.write(fp, format='ascii.csv')
fp.seek(0)
kwargs['files'].update({catstr: (f'cat{cat_index}.csv', fp.read())})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suppose you don't have to regenerate cat{cat_index} here, but reuse it from L127 as f'{catstr}', however this is a ridiculous level of nitpicking, so I'll just go ahead and merge the fix instead :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, yes it was better than what I did. Don't hesitate to change something if it happens again in an other PR, I won't be offended 🙂

@bsipocz bsipocz merged commit 9faae2b into astropy:main Oct 4, 2024
@ManonMarchand ManonMarchand deleted the fix-xmatch-two-local-files branch October 10, 2024 14:26
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.

XMatch.query missing cat1 when usign two previously uploaded tables Parsing tables for XMatch not working Can't XMatch two local tables/files

2 participants