[AstroPy] help with writing a boolean column with astropy.io.Table

Aldcroft, Thomas aldcroft at head.cfa.harvard.edu
Thu Jan 9 12:44:41 EST 2014


Hi Rose,

I'm able to reproduce this and I've confirmed that the test.fits file
output seems to be correct (by reading with an independent FITS reader).
 This would appear to be a bug in FITS reading, though it's just a little
surprising that something so basic as reading a FITS file with a boolean
column could have a bug like this.

I'm opening an astropy github issue on this now.

- Tom


On Thu, Jan 9, 2014 at 11:57 AM, Finn, Rose <rfinn at siena.edu> wrote:

> Hi,
>
> I am trying to write a fits table with astropy.io.Table and am having
> trouble with a boolean array.  Basically, all the values turn out to be
> false, regardless of what the values are in the input array.  I have
> included an example below - any help would be appreciated!  I am trying to
> avoid writing the table with astropy.io.fits because it is cumbersome.
>  Everything works fine with floating point arrays.
>
> Thanks,
> Rose
>
>
> from astropy.io import Column
>
> from astropy.table import Table
>
> from astropy.table import Column
>
> newcol=Column(data=np.ones(10),name='test',dtype='bool')
>
> dt=Table()
>
> dt.add_column(newcol)
>
> dt.write('test.fits')
>
> dat=dt.read('test.fits')
>
> In [*48*]: dat['test']
>
> Out[*48*]:
>
> <Column name='test' unit=None format=None description=None>
>
> array([False, False, False, False, False, False, False, False, False,
> False], dtype=bool)
>
>
> In [*45*]: newcol
>
> Out[*45*]:
>
> <Column name='test' unit=None format=None description=None>
>
> array([ True,  True,  True,  True,  True,  True,  True,  True,  True,
> True], dtype=bool)
>
>
> --
> Rose A. Finn
> Department of Physics & Astronomy
> Siena College
> Loudonville, NY  12211
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20140109/c705fb50/attachment.html>


More information about the AstroPy mailing list