Skip to content
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

BUG: Gaia call throwing KeyError #265

Closed
troyraen opened this issue Apr 1, 2024 · 1 comment
Closed

BUG: Gaia call throwing KeyError #265

troyraen opened this issue Apr 1, 2024 · 1 comment

Comments

@troyraen
Copy link
Contributor

troyraen commented Apr 1, 2024

Using astroquery v0.4.7, the Gaia call is throwing a new error. Pasted below. I have not looked into it and don't know whether our code needs to change or if there is a bug in somewhere else in the chain.

KeyError                                  Traceback (most recent call last)
Cell In[3], line 4
      1 gaiastarttime = time.time()
      3 # get Gaia light curves
----> 4 df_lc_gaia = gaia_get_lightcurves(sample_table, search_radius=1/3600, verbose=0)
      6 # add the resulting dataframe to all other archives
      7 df_lc.append(df_lc_gaia)

File ~/raen/fdn-tmp/light_curves/code_src/gaia_functions.py:45, in gaia_get_lightcurves(sample_table, search_radius, verbose)
     40     return MultiIndexDFObject()
     42 # Extract Light curves ===============
     43 # request the EPOCH_PHOTOMETRY from the Gaia DataLink Service
---> 45 gaia_df = Gaia_retrieve_epoch_photometry(gaia_table)
     47 #if the epochal photometry is empty, return an empty dataframe
     48 if len(gaia_df) == 0:

File ~/raen/fdn-tmp/light_curves/code_src/gaia_functions.py:138, in Gaia_retrieve_epoch_photometry(gaia_table)
    118 """
    119 Function to retrieve EPOCH_PHOTOMETRY catalog product for Gaia
    120 entries using the DataLink. Note that the IDs need to be DR3 source_id and needs to be a list.
   (...)
    132     
    133 """
    135 # gaia datalink server has a threshold of max 5000 requests,
    136 # so we break the input datasets into chunks of size <=5000 sources
    137 # and then send each chunk into the datalink server
--> 138 ids = list(gaia_table["source_id"])
    139 dl_threshold = 5000  # Datalink server threshold
    140 ids_chunks = list(Gaia_chunks(ids, dl_threshold))

File /opt/conda/envs/science_demo/lib/python3.11/site-packages/astropy/table/table.py:2061, in Table.__getitem__(self, item)
   2059 def __getitem__(self, item):
   2060     if isinstance(item, str):
-> 2061         return self.columns[item]
   2062     elif isinstance(item, (int, np.integer)):
   2063         return self.Row(self, item)

File /opt/conda/envs/science_demo/lib/python3.11/site-packages/astropy/table/table.py:264, in TableColumns.__getitem__(self, item)
    253 """Get items from a TableColumns object.
    254 
    255 ::
   (...)
    261   tc[1:3] # <TableColumns names=('b', 'c')>
    262 """
    263 if isinstance(item, str):
--> 264     return OrderedDict.__getitem__(self, item)
    265 elif isinstance(item, (int, np.integer)):
    266     return list(self.values())[item]

KeyError: 'source_id'

Originally posted by @troyraen in #207 (comment)

@bsipocz
Copy link
Member

bsipocz commented May 3, 2024

There were some server side changes to the TAP tables at ESA that capitalized source_id (if you go into debug mode then you can see a SOURCE_ID column).

I merged a fix for this into astroquery, and pushed a dev release to pypi, so a pip install -U --pre astroquery should do the trick now. I wonder whether we need to update the requirements version to be 0.4.8 dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants