Skip to content

Commit

Permalink
Improve FITS identification in astropy_table_read
Browse files Browse the repository at this point in the history
  • Loading branch information
dhomeier committed Sep 15, 2022
1 parent d24e005 commit 0c6e4a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ v1.6.0 (unreleased)
* Fix an issue where the histogram layer artist would not redraw if
the histogram sum was zero. [#2300]

* Add check for FITS files mistaken as ASCII in Python 3.11 to ``astropy_table_read``. [#2321]

v1.5.0 (2022-06-28)
-------------------

Expand Down
5 changes: 4 additions & 1 deletion glue/core/data_factories/astropy_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def astropy_table_read(*args, **kwargs):
# also more generally, we should first try the ASCII readers.
if 'format' not in kwargs:
try:
return Table.read(*args, format='ascii', **kwargs)
t = Table.read(*args, format='ascii', **kwargs)
# Double-check for certain FITS files that may be read in as ASCII in Python 3.11
if not (len(t) == 1 and [c.value[0] for c in t.itercols()][:3] == ['SIMPLE', '=', 'T']):
return t
except Exception:
pass

Expand Down

0 comments on commit 0c6e4a2

Please sign in to comment.