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: HSA raise the correct error rather than LoginError #3005

Open
jkrick opened this issue May 9, 2024 · 3 comments
Open

BUG: HSA raise the correct error rather than LoginError #3005

jkrick opened this issue May 9, 2024 · 3 comments

Comments

@jkrick
Copy link

jkrick commented May 9, 2024

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".

  1. 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.
  2. 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") 
@bsipocz bsipocz added the esa.hsa label May 9, 2024
@bsipocz
Copy link
Member

bsipocz commented May 9, 2024

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

@jespinosaar
Copy link
Contributor

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.

@bsipocz bsipocz added the bug label May 10, 2024
@bsipocz bsipocz changed the title astroquery.esa.hsa download_data LoginError BUG: HSA raise the correct error rather than LoginError May 10, 2024
@bsipocz
Copy link
Member

bsipocz commented May 10, 2024

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.

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