Description
Astropy Table writing and reading to/from fits looses the information about dimensionality,
if the cell data written is a 1d array with a single entry.
Then, on reading back the data, it will be read as a number, so ndim=0, instead of ndim=1.
Expected behavior
Preserve this informatino
Actual behavior
Wrong dimensionality
Steps to Reproduce
❯ python
Python 3.8.5 (default, Sep 5 2020, 10:50:12)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from astropy.table import Table
>>> t = Table({'x': [[1], [2]]})
>>> t.write('/tmp/test.fits', overwrite=True)
>>> t['x'].shape
(2, 1)
>>> Table.read('/tmp/test.fits')['x'].shape
(2,)
The error seems to be in both reading and writing.
The writing part fails to add the TDIM keyword and the reading part has a regex that does not match a tuple with just one entry.
System Details
Linux-5.8.10-1-MANJARO-x86_64-with-glibc2.2.5
Python 3.8.5 (default, Sep 5 2020, 10:50:12)
[GCC 10.2.0]
Numpy 1.19.2
astropy 4.0.1.post1
Scipy 1.5.2
Matplotlib 3.3.2
Description
Astropy
Tablewriting and reading to/from fits looses the information about dimensionality,if the cell data written is a 1d array with a single entry.
Then, on reading back the data, it will be read as a number, so ndim=0, instead of ndim=1.
Expected behavior
Preserve this informatino
Actual behavior
Wrong dimensionality
Steps to Reproduce
The error seems to be in both reading and writing.
The writing part fails to add the
TDIMkeyword and the reading part has a regex that does not match a tuple with just one entry.System Details