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

Getting ESO headers fails to retrieve keyword values which include a / #3208

Open
gmella opened this issue Feb 10, 2025 · 2 comments
Open

Getting ESO headers fails to retrieve keyword values which include a / #3208

gmella opened this issue Feb 10, 2025 · 2 comments
Labels

Comments

@gmella
Copy link

gmella commented Feb 10, 2025

Code tries to figure out the comment splitting on / leaving out the right part reading ESO headers. But keyword values are truncated before / when it includes one or more in its value.

The output of next python code snippet should provide the full instrument name with a revision ID on top of next input values:

HIERARCH ESO INS ID = 'GRAVITY/176642' / Instrument ID.
HIERARCH ESO INS ID = 'PIONIER/$Revision: 350678 $' / Instrument ID.
from astroquery.eso.core import EsoClass
eso = EsoClass()
headers = eso.get_headers(["GRAVI.2024-09-27T07:22:10.935","PIONI.2024-01-12T08:55:01.576"])
print(headers["HIERARCH ESO INS ID"])

At present time, the output is :

HIERARCH ESO INS ID
-------------------
             GRAVIT
             PIONIE

If this is a bug, I guess that a fix should also manage multiple quotes occurences with and without escaping and maybe other tricky cases ...

@keflavich keflavich added the eso label Feb 10, 2025
@keflavich
Copy link
Contributor

The table reader has incorrectly set the string length, apparently:

>>> headers["HIERARCH ESO INS ID"]
<Column name='HIERARCH ESO INS ID' dtype='str6' length=2>
GRAVIT
PIONIE

@gmella
Copy link
Author

gmella commented Feb 11, 2025

The table reader has incorrectly set the string length, apparently:

No, this is the number of rows of the astropy.table.Table for the get_headers call where I queried two dataproduct IDs.

From the next line of code ( value = value.split('/', 1)[0].strip()) , the value is retrieved from the right part after the first '=' splitting with '/'. But the assumption that the left part contains the keyword value fails when the value itself contains a /

value = value.split('/', 1)[0].strip()

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

No branches or pull requests

2 participants