[AstroPy] Accessing a FITS table generates "ValueError: Inconsistent data column lengths: set([0, 27645])"

Derek Homeier derek at astro.physik.uni-goettingen.de
Tue Apr 17 09:23:24 EDT 2018


On 17. Apr 2018, at 2:45 PM, Aldcroft, Thomas <aldcroft at head.cfa.harvard.edu> wrote:
> 
> That particular HDU (#8) has a table with a column that has data type 0J.  This the source of the problem.  I see that numpy arrays can have a length with zero-width (e.g. shape=(10, 0)), so in theory astropy should be able to support this.  If you can file this as an issue on GitHub that would be very helpful.
> 
I see some similar problems in this minimal example:

a = np.ones(shape=(5,), dtype=[ ('X', 'f4'), ('Y', '2i2'), ('Z', '0i4')])
t1 = Table(a)
t2 = Table([a[n] for n in a.dtype.names if a[n].shape[-1]>0])

Creating t1 still works for me, and I can in fact access t1[‘Z’].data, but trying e.g. to print the table raises
an IndexError, while t2 is safe as expected.

Cheers,
					Derek



More information about the AstroPy mailing list