-
Notifications
You must be signed in to change notification settings - Fork 7
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
KeyError when querying APASS catalogue #73
Comments
I noticed that this happens with only some of the stars I query result in this issue. It looks like the APASS9 catalog on Vizier doesn't contain recno (perhaps it did in the past, as I did come across in on a different mirror but no longer see it there). A fast workaround is to implement a try except, so that the code can continue to run if there's an issue querying APASS9, for example (but modify as you see fit):
This seems to work for me. I haven't made a request to merge into the main with this because it's not really a resolution to the issue and perhaps the developers will get a chance to update the code in a more suitable way. If I do have some time to get to a better solution, I'll update this. |
I also noticed this behavior on targets that did not show this error before, even though the query did not find APASS data. I installed It seems https://stellarphot.readthedocs.io/latest/api/stellarphot.apass_dr9.html |
Thank you both for your help! I didn't need to call from the APASS catalogue so I was able to use this code to bypass the error that was appearing. I had tried doing something similar before but didn't realise that I needed to edit it before I ran the setup.py file. Now that I've done that it is sorted - just thought I'd add this in case anyone else is having the same issue. Cheers! |
Indeed, Vizier took out the recno column. I pushed an update that ignores APASS until I have time to properly resolve this. |
I have been running this package for a little while now and never had any issue with querying the catalogues. However, now when I run the code it goes through the TYCHO2 function alright, but then I get 'KeyError: 'recno'' when it tries to run through the APASS catalogue. I have pasted the full error below:
KeyError Traceback (most recent call last)
Cell In[2], line 6
3 dec = -4.3371428022
4 gaia_id = 3023459583984210304
----> 6 s = Star(starname, ra, dec, g_id=gaia_id)
File ~/anaconda3/lib/python3.11/site-packages/astroARIADNE-1.1.1-py3.11.egg/astroARIADNE/star.py:182, in Star.init(self, starname, ra, dec, g_id, plx, plx_e, rad, rad_e, temp, temp_e, lum, lum_e, dist, dist_e, Av, Av_e, offline, mag_dict, verbose, ignore, dustmap)
177 if verbose:
178 print(
179 colored('\t\t*** LOOKING UP ARCHIVAL INFORMATION ***',
180 c)
181 )
--> 182 lib = Librarian(starname, self.ra, self.dec, g_id=self.g_id,
183 mags=self.get_mags, ignore=ignore)
184 self.g_id = lib.g_id
185 self.tic = lib.tic
File ~/anaconda3/lib/python3.11/site-packages/astroARIADNE-1.1.1-py3.11.egg/astroARIADNE/librarian.py:168, in Librarian.init(self, starname, ra, dec, radius, g_id, mags, ignore)
166 if mags:
167 self.gaia_query()
--> 168 self.get_magnitudes()
169 idx = self.used_filters >= 1
170 self.used_filters[idx] = 1
File ~/anaconda3/lib/python3.11/site-packages/astroARIADNE-1.1.1-py3.11.egg/astroARIADNE/librarian.py:328, in Librarian.get_magnitudes(self)
326 continue
327 if c == 'APASS':
--> 328 self._get_apass(current_cat)
329 continue
330 elif c == 'Wise':
File ~/anaconda3/lib/python3.11/site-packages/astroARIADNE-1.1.1-py3.11.egg/astroARIADNE/librarian.py:613, in Librarian._get_apass(self, cat)
611 def _get_apass(self, cat):
612 print('Checking catalog APASS')
--> 613 mask = cat['recno'] == int(self.ids['APASS'])
614 self._retrieve_from_cat(cat[mask], 'APASS')
File ~/anaconda3/lib/python3.11/site-packages/astropy/table/table.py:2093, in Table.getitem(self, item)
2091 def getitem(self, item):
2092 if isinstance(item, str):
-> 2093 return self.columns[item]
2094 elif isinstance(item, (int, np.integer)):
2095 return self.Row(self, item)
File ~/anaconda3/lib/python3.11/site-packages/astropy/table/table.py:267, in TableColumns.getitem(self, item)
256 """Get items from a TableColumns object.
257
258 ::
(...)
264 tc[1:3] # <TableColumns names=('b', 'c')>
265 """
266 if isinstance(item, str):
--> 267 return OrderedDict.getitem(self, item)
268 elif isinstance(item, (int, np.integer)):
269 return list(self.values())[item]
KeyError: 'recno'
Any help on why this might be occuring now after I've already run it fine a few times would be greatly appreciated.
The text was updated successfully, but these errors were encountered: