Field

class astropy.io.votable.tree.Field(votable, ID=None, name=None, datatype=None, arraysize=None, ucd=None, unit=None, width=None, precision=None, utype=None, ref=None, type=None, id=None, xtype=None, config={}, pos=None, **extra) [edit on github][source]

Bases: astropy.io.votable.tree.SimpleElement, astropy.io.votable.tree._IDProperty, astropy.io.votable.tree._NameProperty, astropy.io.votable.tree._XtypeProperty, astropy.io.votable.tree._UtypeProperty, astropy.io.votable.tree._UcdProperty

FIELD element: describes the datatype of a particular column of data.

The keyword arguments correspond to setting members of the same name, documented below.

If ID is provided, it is used for the column name in the resulting recarray of the table. If no ID is provided, name is used instead. If neither is provided, an exception will be raised.

Attributes Summary

links A list of Link instances used to reference more details about the meaning of the FIELD.
precision Along with width, defines the numerical accuracy associated with the data.
arraysize Specifies the size of the multidimensional array if this FIELD contains more than a single value.
unit A string specifying the units for the FIELD.
datatype [required] The datatype of the column. Valid values (as
type The type attribute on FIELD elements is reserved for future extensions.
width Along with precision, defines the numerical accuracy associated with the data.
values A Values instance (or None) defining the domain of the column.
ref On FIELD elements, ref is used only for informational purposes, for example to refer to a COOSYS element.

Methods Summary

parse(iterator, config)
to_xml(w, **kwargs)
to_table_column(column) Sets the attributes of a given astropy.table.Column instance to match the information in this Field.
from_table_column(votable, column) Restores a Field instance from a given astropy.table.Column instance.
uniqify_names(fields) Make sure that all names and titles in a list of fields are unique, by appending numbers if necessary.

Attributes Documentation

A list of Link instances used to reference more details about the meaning of the FIELD. This is purely informational and is not used by the astropy.io.votable package.

precision[source]

Along with width, defines the numerical accuracy associated with the data. These values are used to limit the precision when writing floating point values back to the XML file. Otherwise, it is purely informational – the Numpy recarray containing the data itself does not use this information.

arraysize[source]

Specifies the size of the multidimensional array if this FIELD contains more than a single value.

See multidimensional arrays.

unit[source]

A string specifying the units for the FIELD.

datatype[source]

[required] The datatype of the column. Valid values (as defined by the spec) are:

‘boolean’, ‘bit’, ‘unsignedByte’, ‘short’, ‘int’, ‘long’, ‘char’, ‘unicodeChar’, ‘float’, ‘double’, ‘floatComplex’, or ‘doubleComplex’

Many VOTABLE files in the wild use ‘string’ instead of ‘char’, so that is also a valid option, though ‘string’ will always be converted to ‘char’ when writing the file back out.

type[source]

The type attribute on FIELD elements is reserved for future extensions.

width[source]

Along with precision, defines the numerical accuracy associated with the data. These values are used to limit the precision when writing floating point values back to the XML file. Otherwise, it is purely informational – the Numpy recarray containing the data itself does not use this information.

values[source]

A Values instance (or None) defining the domain of the column.

ref[source]

On FIELD elements, ref is used only for informational purposes, for example to refer to a COOSYS element.

Methods Documentation

parse(iterator, config) [edit on github][source]
to_xml(w, **kwargs) [edit on github][source]
to_table_column(column) [edit on github][source]

Sets the attributes of a given astropy.table.Column instance to match the information in this Field.

classmethod from_table_column(votable, column) [edit on github][source]

Restores a Field instance from a given astropy.table.Column instance.

classmethod uniqify_names(fields) [edit on github][source]

Make sure that all names and titles in a list of fields are unique, by appending numbers if necessary.

Page Contents