table_column_to_votable_datatype

astropy.io.votable.converters.table_column_to_votable_datatype(column)[source]

Given a astropy.table.Column instance, returns the attributes necessary to create a VOTable FIELD element that corresponds to the type of the column.

This necessarily must perform some heuristics to determine the type of variable length arrays fields, since they are not directly supported by Numpy.

If the column has dtype of “object”, it performs the following tests:

  • If all elements are byte or unicode strings, it creates a variable-length byte or unicode field, respectively.
  • If all elements are numpy arrays of the same dtype and with a consistent shape in all but the first dimension, it creates a variable length array of fixed sized arrays. If the dtypes match, but the shapes do not, a variable length array is created.

If the dtype of the input is not understood, it sets the data type to the most inclusive: a variable length unicodeChar array.

Parameters:
column : astropy.table.Column instance
Returns:
attributes : dict

A dict containing ‘datatype’ and ‘arraysize’ keys that can be set on a VOTable FIELD element.