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

Paul Kuin npkuin at gmail.com
Tue May 31 14:56:22 EDT 2016


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

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
>
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy
>
>


-- 

* * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * *
Dr. N.P.M. Kuin      (n.kuin at ucl.ac.uk)
phone +44-(0)1483 (prefix) -204111 (work)
mobile +44(0)7806985366  skype ID: npkuin
Mullard Space Science Laboratory  – University College London  –
Holmbury St Mary – Dorking – Surrey RH5 6NT–  U.K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160531/98b1f72e/attachment.html>


More information about the AstroPy mailing list