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=None, pos=None, **extra)[source]¶
Bases:
SimpleElement
,_IDProperty
,_NameProperty
,_XtypeProperty
,_UtypeProperty
,_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
Specifies the size of the multidimensional array if this FIELD contains more than a single value.
[required] The datatype of the column.
A list of
Link
instances used to reference more details about the meaning of the FIELD.Along with
width
, defines the numerical accuracy associated with the data.On FIELD elements, ref is used only for informational purposes, for example to refer to a COOSYS or TIMESYS element.
The type attribute on FIELD elements is reserved for future extensions.
A
Values
instance (orNone
) defining the domain of the column.Along with
precision
, defines the numerical accuracy associated with the data.Methods Summary
from_table_column
(votable, column)Restores a
Field
instance from a givenastropy.table.Column
instance.parse
(iterator, config)For internal use.
to_table_column
(column)Sets the attributes of a given
astropy.table.Column
instance to match the information in thisField
.to_xml
(w, **kwargs)For internal use.
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¶
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 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.
- links¶
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 theastropy.io.votable
package.
- precision¶
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¶
On FIELD elements, ref is used only for informational purposes, for example to refer to a COOSYS or TIMESYS element.
- width¶
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]¶
Restores a
Field
instance from a givenastropy.table.Column
instance.
- parse(iterator, config)[source]¶
For internal use. Parse the XML content of the children of the element.
- Parameters:
- iterator
xml
python:iterable An iterator over XML elements as returned by
get_xml_iterator
.- config
python:dict
The configuration dictionary that affects how certain elements are read.
- iterator
- Returns:
- self
Element
Returns self as a convenience.
- self
- to_table_column(column)[source]¶
Sets the attributes of a given
astropy.table.Column
instance to match the information in thisField
.
- to_xml(w, **kwargs)[source]¶
For internal use. Output the element to XML.
- Parameters:
- w
astropy.utils.xml.writer.XMLWriter
object
An XML writer to write to.
- **kwargs
python:dict
Any configuration parameters to control the output.
- w