astropy / astroquery

Functions and classes to access online data resources. Maintainers: @keflavich and @bsipocz and @ceb8
http://astroquery.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
688 stars 392 forks source link

Switch to dict instead of ordered dict in Vizier find_catalogs #3023

Open ManonMarchand opened 1 month ago

ManonMarchand commented 1 month ago

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.

keflavich commented 1 month ago

I'm onboard with both changes.

bsipocz commented 1 month ago

Yeap, both sounds reasonable.

ManonMarchand commented 2 weeks ago

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.