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)[source] [edit on github]

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

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

Methods Summary

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

Attributes Documentation

arraysize[source]

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

See multidimensional arrays.

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.

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.

ref[source]

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

type[source]

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

unit[source]

A string specifying the units for the FIELD.

values[source]

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

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.

Methods Documentation

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

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

parse(iterator, config)[source] [edit on github]
to_table_column(column)[source] [edit on github]

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

to_xml(w, **kwargs)[source] [edit on github]
classmethod uniqify_names(fields)[source] [edit on github]

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

Page Contents