[AstroPy] Error when opening Vizier FITS table with astropy Table.read

Eric Jensen ejensen1 at swarthmore.edu
Tue May 31 15:25:41 EDT 2016


On May 31, 2016, at 2:56 PM, Paul Kuin <npkuin at gmail.com> wrote:

> Have you tried to read the fits file with astropy.io.fits ? What do you get then for the table? 

It opens the file without error, and I can examine the header.  But as soon as I try to access any part of the data structure, I get the same ValueError about TNULL3 shown below. 



> 
> On Tue, May 31, 2016 at 7:07 PM, Eric Jensen <ejensen1 at swarthmore.edu> wrote:
> Hi all,
> 
> I’m trying to read a FITS table associated with an ApJ paper, and getting an error I don’t understand.  The table in question doesn’t have a standard ASCII/CDS version with the full header that astropy handles very well (in my experience) with format=‘ascii.cds’, so I was trying to use the FITS version linked here:
> 
> http://cdsarc.u-strasbg.fr/viz-bin/nph-Cat/fits?J%2FApJS%2F186%2F111/table4.dat
> 
> Looking at that URL, it would appear that Vizier may be doing an on-the-fly conversion to FITS?  But my hope was that using that would take into account the information in the Vizier README, and thus generate a nice table structure in Python without my having to identify columns by hand.  The plain-text version (http://cdsarc.u-strasbg.fr/vizier/ftp/cats/J/ApJS/186/111/table4.dat) doesn’t have header info, though such info is present in the separate README file. 
> 
> However, when I read the FITS file like this:
> 
> from astropy.table import Table
> datafile = 'J_ApJS_186_111_table4.dat.fits'
> t2 = Table.read(datafile, format='fits')
> 
> I get this error:
> ValueError: invalid literal for int() with base 10: '  '; the header may be missing the necessary TNULL3 keyword or the table contains invalid data
> Looking at the FITS header, there is indeed no TNULL3 keyword, but there is a TBNUL3 keyword:
> 
> TBNUL3  = '        '           / NULL (undefined) value                         
> 
> So presumably that keyword has the needed info, but not in the field astropy is expecting.  Is there any way to work around this? 
> 
> Possibly related - reading in that file in its text version, specifying format=‘cds’ and readme=‘ReadMe’ doesn’t work correctly either, because the ReadMe has a combined entry for Tables 4 and 5, and says in a note that the third field only applies to Table 5.  So this could just be a pathological case for this particular file, but I’m curious to know if anyone has encountered anything like this or has any recommendations. 
> 
> Thanks in advance for your help with this,
> 
> Eric
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160531/c13796bc/attachment.html>


More information about the AstroPy mailing list