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

Finn, Rose rfinn at siena.edu
Thu Jan 9 11:57:49 EST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20140109/954096f6/attachment.html>


More information about the AstroPy mailing list