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

Incorrect reading of multi-line Explanations in MRT/CDS ReadMes #15608

Closed
jobovy opened this issue Nov 13, 2023 · 0 comments · Fixed by #15617
Closed

Incorrect reading of multi-line Explanations in MRT/CDS ReadMes #15608

jobovy opened this issue Nov 13, 2023 · 0 comments · Fixed by #15617

Comments

@jobovy
Copy link
Contributor

jobovy commented Nov 13, 2023

Description

I'm trying to read this table (Table 1 from this paper) using astropy.io.ascii and this fails with

ValueError: Unknown data type ""times"" for column "critical"

This error points to a multi-line Explanation in the ReadMe being read wrong. This seems to happen because the first non-whitespace character in the second line is a number (the line is " 200 times the critical density"), because just adding a letter in front of the 200 lets the table be read. It seems like what's happening is that the parser thinks the line is a new column because it starts with a number.

Expected behavior

Read the table without error

How to Reproduce

Download the table:

curl -O "https://content.cld.iop.org/journals/0004-637X/958/1/62/revision1/apjacfaebt1_mrt.txt?Expires=1700495421&Signature=SIYhtzfO-4l4Dl29Ojz8F5dbTWg4M29Wl35YY18F2gcruZmr2KqVJsMIyFeq7HducHiWBnGwxhun3idcK5yEDRz67iyFmxSxx-60oM4h7W6uNQTqXpvW9zuTMhsaGSSumQTXttKsfMYIClooDDefUYWWHrV0KQGfvSAIfARmo5BW8F3iQciDVhoBS-VdsOt6yky306fZfFUZz7SMreNfz3cSANVwX~LKJQKmy0NK8yAT8zLc7bppPWK6CkzORdI0MZ-EWHyZI~ktOe9aZhDJ-NKLaDymFkqJ3xTggUVcrLBrb~CnfxI4hsQ34TXnMclVrrd7GAvGWLj~Df8JA2zWPA__&Key-Pair-Id=KL1D8TIY3N7T8"

then open Python and do

from astropy.io import ascii
tab= ascii.read("apjacfaebt1_mrt.txt",format='cds')

Versions

macOS-14.0-arm64-arm-64bit
Python 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:38:29) [Clang 13.0.1 ]
astropy 5.3.4
Numpy 1.25.0
pyerfa 2.0.0.1
Scipy 1.11.0
Matplotlib 3.7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants