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
696 stars 397 forks source link

Getting KeyError: 'a-mass' when calling ephemerides() for JPL Horizons #1279

Closed FidelElie closed 5 years ago

FidelElie commented 5 years ago

I keep getting an error when attempting to query JPL horizons to get back only astromertic right ascension and declination. Here is the code I am using:

from astroquery.jplhorizons import Horizons
# coordinates for sliding springs observatory in Australia
location = {'lon' : 149.066111, 'lat' : -31.2768056, 'elevation': 1.1645}
obj = Horizons(id='Ceres', location=location, epochs=2450634.183786772)
eph = obj.ephemerides(quantities=1, refsystem='B1950')

The full trace back is:

File "c:\Users\Fidel\Dropbox\Work\University\Year 4\Semester 1\Senior Honours Project\Code\PlateFinder v0.4\Tests\download_test.py", line 11, in <module>
    eph = obj.ephemerides(quantities=1, refsystem='B1950')
  File "C:\Users\Fidel\Anaconda3\lib\site-packages\astroquery\utils\class_or_instance.py", line 25, in f
    return self.fn(obj, *args, **kwds)
  File "C:\Users\Fidel\Anaconda3\lib\site-packages\astroquery\utils\process_asyncs.py", line 29, in newmethod
    result = self._parse_result(response, verbose=verbose)
  File "C:\Users\Fidel\Anaconda3\lib\site-packages\astroquery\jplhorizons\core.py", line 1223, in _parse_result
    data = self._parse_horizons(response.text)
  File "C:\Users\Fidel\Anaconda3\lib\site-packages\astroquery\jplhorizons\core.py", line 1171, in _parse_horizons
    data['a-mass'] = data['a-mass'].filled(999)
  File "C:\Users\Fidel\Anaconda3\lib\site-packages\astropy\table\table.py", line 1222, in __getitem__
    return self.columns[item]
  File "C:\Users\Fidel\Anaconda3\lib\site-packages\astropy\table\table.py", line 106, in __getitem__
    return OrderedDict.__getitem__(self, item)
KeyError: 'a-mass

I am using windows 10 build 17134.376 version 1803.

bsipocz commented 5 years ago

cc @mommermi

mommermi commented 5 years ago

@fiddycodes why only query RA and Dec, if you can also have airmass for the same price ? :) I'll take care of this!

FidelElie commented 5 years ago

@mommermi I've made a programme that finds objects on plates taken from a telescope. In the full programme I query roughly 17000 dates from this plate catalogue in sets of 350. JPL Horizons will only allow me to query this amount consistently. I don't want to risk adding quantities I don't need and causing the set size to decrease. I've been querying the raw response as a workaround.

mkelley commented 5 years ago

Ah, I independently fixed this with #1284 !

mommermi commented 5 years ago

@bsipocz @keflavich I think this issue can be closed.