Table

class astropy.io.votable.tree.Table(votable, ID=None, name=None, ref=None, ucd=None, utype=None, nrows=None, id=None, config={}, 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._DescriptionProperty

TABLE 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 Resource has type == ‘meta’) array will have zero-length.

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

Attributes Summary

fields A list of Field objects describing the types of each of the data columns.
format [required] The serialization format of the table. Must be
groups A list of Group objects describing how the columns and parameters are grouped.
infos A list of Info objects for the table.
links A list of Link objects (pointers to other documents or servers through a URI) for the table.
nrows [immutable] The number of rows in the table, as specified in
params A list of parameters (constant-valued columns) for the table.
ref

Methods 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 Table instance from a given astropy.table.Table instance.
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_group_by_id(ref[, before]) Looks up a GROUP element by the given ID.
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_number kwarg).
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.
parse(iterator, config)
to_table() Convert this VO Table to an astropy.table.Table instance.
to_xml(w, **kwargs)

Attributes Documentation

fields[source]

A list of Field objects describing the types of each of the data columns.

format[source]

[required] The serialization format of the table. Must be one of:

‘tabledata’ (TABLEDATA), ‘binary’ (BINARY), ‘fits’ (FITS).

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[source]

A list of Group objects describing how the columns and parameters are grouped. Currently this information is only kept around for round-tripping and informational purposes.

infos[source]

A list of Info objects for the table. Allows for post-operational diagnostics.

A list of Link objects (pointers to other documents or servers through a URI) for the table.

nrows[source]

[immutable] The number of rows in the table, as specified in the XML file.

params[source]

A list of parameters (constant-valued columns) for the table. Must contain only Param objects.

ref[source]

Methods Documentation

create_arrays(nrows=0, config={})[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 Table instance from a given astropy.table.Table instance.

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_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

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_number kwarg).

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.

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

Convert this VO Table to an astropy.table.Table instance.

Warning

Variable-length array fields may not be restored identically when round-tripping through the astropy.table.Table instance.

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

Page Contents