[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 16:41:42 EDT 2018


On 17 Apr 2018, at 9:58 pm, Jordan Alexander <jordan.alexander at aut.ac.nz> wrote:
> 
>> Can you read hdulist[1].data (which has a zero width column as well)?
> 
> fails in the same way, as you predicted, given the zero width column.
> 
> As suggested, I will file this issue with https://github.com/astropy/astropy/issues.  
> 
> The FITS file in question with tables containing zero-width columns that generates this issue is ~0.5Gbytes, so will try to find a smaller-sized example file.... 
> 
> Will follow-up with your untested work-around, Tom...

Thanks for the follow-up, Jordan!

Could you make one more test and check what happens if you try

tbl = Table(np.array(hdulist[1].data)) ?

- hdulist[1].data is a FITS_rec, which is basically a container for a numpy record array,
but I am wondering if casting it to a regular (structured) ndarray will let it proceed as far
as creating the table, as it did in my tests.

For the example file, you might try

hdulist[:2].writeto(‘ValueError.fits’)

which should create a file from just the 0th and 1st HDU, sufficient to demonstrate the issue
(unless it already fails along the way on the 0-dim column…).

Best,
					Derek



More information about the AstroPy mailing list