astroquery icon indicating copy to clipboard operation
astroquery copied to clipboard

Switch to dict instead of ordered dict in Vizier find_catalogs

Open ManonMarchand opened this issue 1 year ago • 3 comments

Since astroquery is for python > 3.10, I was wondering if you'd be on board to switch the result of Vizier.find_tables to normal dictionaries here:

https://github.com/astropy/astroquery/blob/25e6521ad3e86f5b2285d08e736cd3417159482d/astroquery/vizier/core.py#L836

I was thinking something like:

return {R.name: R.description for R in vo_tree.resources}

And I guess the changes to the API would be minimal, but we'd have a nicer repr. Or is there a specific reason that I missed for this?

Also,could we return the description directly instead of the astropy.io.votable.tree.Resource ? The only other information that I think might be useful would be the number of rows in the catalog.

ManonMarchand avatar Jun 06 '24 13:06 ManonMarchand

I'm onboard with both changes.

keflavich avatar Jun 06 '24 14:06 keflavich

Yeap, both sounds reasonable.

bsipocz avatar Jun 07 '24 00:06 bsipocz

So, this motivated #3028 which will make find_catalogs way faster. However, switching to a dictionary will remove the possibility to do this (in the docs here):

from astroquery.vizier import Vizier
catalog_list = Vizier.find_catalogs('Kang W51')
catalogs = Vizier.get_catalogs(catalog_list.values())
print(catalogs)

Where we use values instead of keys. So that's actually a change of API. Maybe not such a good idea.

ManonMarchand avatar Jun 20 '24 12:06 ManonMarchand

Not sure this is worth the API change anymore, I'm happy with the speed-up from the maintenance PR

ManonMarchand avatar Jul 22 '24 08:07 ManonMarchand