astropy / astropy/astropy

astropy.table writes int8 column in boolean in FITS output

Open
#11,963 8 comments 0 reactions 0 assignees View on GitHub
io.fits unified-io
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 18h
Merged PRs (30d)
74

Description

### Description

When writing an astropy Table containing a np.int8 column into a FITS file, that column becomes boolean in the output
```
import numpy as np
from astropy.table import Table

t = Table()
t['a'] = np.array([-1, 0, 1, 2], dtype=np.int8)
print(t['a'].dtype) # int8
t.write('test.fits')

tt = Table.read('test.fits')
print(tt['a'].dtype) # bool
```

### System Details
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
[Clang 10.0.0 ]
Numpy 1.20.3
astropy 4.2.1

Contributor guide

Open the contributing guide

Research direction

Start with the Table.write and Table.read entry points using the reproducer in the issue, then trace the FITS output and input handling for np.int8 columns. Run the example with the listed Python, NumPy, and Astropy versions; done means the column remains int8 after writing to and reading from a FITS file.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.