[AstroPy] How can I create a VOtable from a python list?

Susana Sanchez susanasanche at gmail.com
Mon Mar 4 06:43:20 EST 2013


Hello all,

How can I create a VOtable from a list (a python list) of rows using astropy?

Reading the documentation, I found the method "from_table" of the
class VOTableFile, this method needs as argument an instance of the
class astropy.table.table.Table, so I did the following:

t=astropy.table.table.Table([["CIG12",1.2345,0,2,999,"COMMENT"],["CIG122",1.23452,0,2,9992,"COMMENT2"]])
votable = VOTableFile()
votable.from_table(t)


But here I got this error:

/usr/local/lib/python2.6/dist-packages/numpy/ma/core.pyc in
__new__(cls, data, mask, dtype, copy, subok, ndmin, fill_value,
keep_mask, hard_mask, shrink, **options)
   2692             # Or assume it's a sequence of bool/int

   2693             except TypeError:
-> 2694                 mask = np.array([tuple([m] * len(mdtype)) for
m in mask],
   2695                                  dtype=mdtype)
   2696             # Make sure the mask and the data have the same shape

TypeError: 'NoneType' object is not iterable


Reading the error message,  I thought it could be related with the
mask, so I tried to create the mask of the table t (with the method
t.create_mask()), and then to build the VOTableFile from this table,
but I got the same error.

I would be very gratefully, If anyone can help me or give me any hint.

Thanks,
Susana.



More information about the AstroPy mailing list