BUG: HSA raise the correct error rather than LoginError
I am trying to search the herschel archive for multiple sources (I'll wait to hit it with 1000's, but am testing now with 10). I am seeing a strange "LoginError: Data protected by proprietary rights. Please check your credentials".
- I can't imagine that there is herschel proprietary data still, given that the telescope hasn't taken data in years, so I am guessing something else is going on, but have sent a herschel helpdesk message to see if I can't get a definitive answer on that.
- I tried a "try except" around the call to say don't grab those observation_id that appear to be proprietary, but python won't let me do an
except LoginError. It tells me "NameError: name 'LoginError' is not defined". (and I tried, but it doesn't work to 'except NameError')
Is it possible for astroquery to throw some other, recognizable error, so I can move around this problem? I'll take other suggested workarounds!
Thanks,
minimum example, using the coords and syntax for query_hsa_tap that are listed in the astroquery readthedocs page (https://astroquery.readthedocs.io/en/latest/esa/hsa/hsa.html):
from astroquery.esa.hsa import HSA
test_table = HSA.query_hsa_tap("select top 10 observation_id from hsa.v_active_observation where "
"contains(point('ICRS', hsa.v_active_observation.ra, hsa.v_active_observation.dec), "
"circle('ICRS', 100.2417,9.895, 1.1))=1")
for row in test_table:
print(str(row['observation_id']) ) #confirm that syntax is not the problem
try:
HSA.download_data(observation_id=str(row['observation_id']), retrieval_type='OBSERVATION',
instrument_name='PACS', download_dir = 'data/herschel')
except LoginError:
#there is some problem here with the observation_id which causes Herschel to think it is proprietary
#we just won't get this data, move on to the next observation
print("loginerror")
I'm not yet labelling it as a bug, as astroquery may very well hit something on the server side that returns the proprietary response.
I'll follow-up directly with Jessica about point no2, the immediate workarounds and importing the errors problem, so we should keep only the parts affecting astroquery and HSA in this issue.
cc @jespinosaar
Hi all,
Regarding this issue, I think the error is misleading. I have been checking and the same commands are failing due to an observation that is associated to a different instrument (not PACS). To fix this, you can modify your initial query to the following one:
select top 10 observation_id from hsa.v_active_observation join hsa.instrument using (instrument_oid) where contains(point('ICRS', hsa.v_active_observation.ra, hsa.v_active_observation.dec), circle('ICRS', 100.2417,9.895, 1.1))=1 and hsa.instrument.instrument_name='PACS'.
But it is true the error shown is not correct.
But it is true the error shown is not correct.
I flagged this as a bug then, and also modified the title of the issue.