Table¶
-
class
astropy.io.votable.tree.Table(votable, ID=None, name=None, ref=None, ucd=None, utype=None, nrows=None, id=None, config=None, pos=None, **extra)[source] [edit on github]¶ Bases:
astropy.io.votable.tree.Element,astropy.io.votable.tree._IDProperty,astropy.io.votable.tree._NameProperty,astropy.io.votable.tree._UcdProperty,astropy.io.votable.tree._DescriptionPropertyTABLE element: optionally contains data.
It contains the following publicly-accessible and mutable attribute:
array: A Numpy masked array of the data itself, where each row is a row of votable data, and columns are named and typed based on the <FIELD> elements of the table. The mask is parallel to the data array, except for variable-length fields. For those fields, the numpy array’s column type is “object” ("O"), and another masked array is stored there.If the Table contains no data, (for example, its enclosing
Resourcehastype== ‘meta’) array will have zero-length.The keyword arguments correspond to setting members of the same name, documented below.
Attributes Summary
fieldsA list of Fieldobjects describing the types of each of the data columns.format[required] The serialization format of the table. Must be groupsA list of Groupobjects describing how the columns and parameters are grouped.infosA list of Infoobjects for the table.linksA list of Linkobjects (pointers to other documents or servers through a URI) for the table.nrows[immutable] The number of rows in the table, as specified in paramsA list of parameters (constant-valued columns) for the table. refMethods Summary
create_arrays([nrows, config])Create a new array to hold the data based on the current set of fields, and store them in the array and member variable. from_table(votable, table)Create a Tableinstance from a givenastropy.table.Tableinstance.get_field_by_id(ref[, before])Looks up a FIELD or PARAM element by the given ID. get_field_by_id_or_name(ref[, before])Looks up a FIELD or PARAM element by the given ID or name. get_fields_by_utype(ref[, before])Looks up a FIELD or PARAM element by the given utype and returns an iterator emitting all matches. get_group_by_id(ref[, before])Looks up a GROUP element by the given ID. get_groups_by_utype(ref[, before])Looks up a GROUP element by the given utype and returns an iterator emitting all matches. is_empty()Returns True if this table doesn’t contain any real data because it was skipped over by the parser (through use of the table_numberkwarg).iter_fields_and_params()Recursively iterate over all FIELD and PARAM elements in the TABLE. iter_groups()Recursively iterate over all GROUP elements in the TABLE. iter_info()parse(iterator, config)For internal use. to_table([use_names_over_ids])Convert this VO Table to an astropy.table.Tableinstance.to_xml(w, **kwargs)For internal use. Attributes Documentation
-
format¶ [required] The serialization format of the table. Must be one of:
Note that the ‘fits’ format, since it requires an external file, can not be written out. Any file read in with ‘fits’ format will be read out, by default, in ‘tabledata’ format.
-
groups¶ A list of
Groupobjects describing how the columns and parameters are grouped. Currently this information is only kept around for round-tripping and informational purposes.
-
nrows¶ [immutable] The number of rows in the table, as specified in the XML file.
-
params¶ A list of parameters (constant-valued columns) for the table. Must contain only
Paramobjects.
-
ref¶
Methods Documentation
-
create_arrays(nrows=0, config=None)[source] [edit on github]¶ Create a new array to hold the data based on the current set of fields, and store them in the array and member variable. Any data in the existing array will be lost.
nrows, if provided, is the number of rows to allocate.
-
classmethod
from_table(votable, table)[source] [edit on github]¶ Create a
Tableinstance from a givenastropy.table.Tableinstance.
-
get_field_by_id(ref, before=None) [edit on github]¶ Looks up a FIELD or PARAM element by the given ID.
-
get_field_by_id_or_name(ref, before=None) [edit on github]¶ Looks up a FIELD or PARAM element by the given ID or name.
-
get_fields_by_utype(ref, before=None) [edit on github]¶ Looks up a FIELD or PARAM element by the given utype and returns an iterator emitting all matches.
-
get_group_by_id(ref, before=None) [edit on github]¶ Looks up a GROUP element by the given ID. Used by the group’s “ref” attribute
-
get_groups_by_utype(ref, before=None) [edit on github]¶ Looks up a GROUP element by the given utype and returns an iterator emitting all matches.
-
is_empty()[source] [edit on github]¶ Returns True if this table doesn’t contain any real data because it was skipped over by the parser (through use of the
table_numberkwarg).
-
iter_fields_and_params()[source] [edit on github]¶ Recursively iterate over all FIELD and PARAM elements in the TABLE.
-
iter_groups()[source] [edit on github]¶ Recursively iterate over all GROUP elements in the TABLE.
-
iter_info()[source] [edit on github]¶
-
parse(iterator, config)[source] [edit on github]¶ For internal use. Parse the XML content of the children of the element.
Parameters: iterator : xml iterator
An iterator over XML elements as returned by
get_xml_iterator.config : dict
The configuration dictionary that affects how certain elements are read.
Returns: self : Element
Returns self as a convenience.
-
to_table(use_names_over_ids=False)[source] [edit on github]¶ Convert this VO Table to an
astropy.table.Tableinstance.Parameters: use_names_over_ids : bool, optional
When
Trueuse thenameattributes of columns as the names of columns in theastropy.table.Tableinstance. Since names are not guaranteed to be unique, this may cause some columns to be renamed by appending numbers to the end. Otherwise (default), use the ID attributes as the column names... warning::
Variable-length array fields may not be restored identically when round-tripping through the
astropy.table.Tableinstance.
-
to_xml(w, **kwargs)[source] [edit on github]¶ For internal use. Output the element to XML.
Parameters: w : astropy.utils.xml.writer.XMLWriter object
An XML writer to write to.
kwargs : dict
Any configuration parameters to control the output.
-