[AstroPy] astropy.table.Table problems with VOTable input and FITS output

Frederic V. Hessman hessman at astro.physik.uni-goettingen.de
Wed Apr 29 09:19:18 EDT 2020


I'm trying to read tables exported by exoplanet.eu (exoplanet databse portal) in VOTable format.

Here's a mini 1-row table in their format:



astropy.table.Table didn't like the extra "description" attribute for the <RESOURCE> tag used by exoplanet.eu

	<RESOURCE description="Exoplanet ...">

(the description should have been placed as an extra daughter tag) but that was easily removed.  Thereafter, I got this error when trying to re-write it as a FITS table (where I can store metadata - the old problem with astropy VOTables...):

Python 3.5.9 (default, Nov  2 2019, 03:07:41) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from astropy.table import Table
>>> tab = Table.read ('test.vot',format='votable')
>>> tab.write ('test.fits',format='fits',overwrite=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/table/connect.py", line 114, in __call__
    registry.write(instance, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/registry.py", line 566, in write
    writer(data, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/fits/connect.py", line 387, in write_table_fits
    table_hdu = table_to_hdu(input, character_as_bytes=True)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/fits/convenience.py", line 480, in table_to_hdu
    table_hdu = BinTableHDU.from_columns(np.array(table.filled()), header=hdr, character_as_bytes=True)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/fits/hdu/table.py", line 125, in from_columns
    coldefs = cls._columns_type(columns)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/fits/column.py", line 1375, in __init__
    self._init_from_array(input)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/fits/column.py", line 1410, in _init_from_array
    format = self._col_format_cls.from_recformat(ftype)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/fits/column.py", line 273, in from_recformat
    return cls(_convert_format(recformat, reverse=True))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/fits/column.py", line 2401, in _convert_format
    return _convert_record2fits(format)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/io/fits/column.py", line 2364, in _convert_record2fits
    raise ValueError('Illegal format `{}`.'.format(format))
ValueError: Illegal format `object`.


Note that the table was initially input just fine: all of the data is there and accessible.  The problem was just in storing it in FITS format.

Any ideas?

Rick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20200429/70c13247/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.vot
Type: application/octet-stream
Size: 21366 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/astropy/attachments/20200429/70c13247/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20200429/70c13247/attachment-0003.html>


More information about the AstroPy mailing list