MivotViewer

class pyvo.mivot.MivotViewer(votable_path, tableref=None)[source]

Bases: object

MivotViewer is a PyVO table wrapper aiming at providing a model view on VOTable data read with usual tools.

Constructor of the MivotViewer class.

Parameters:
votable_pathstr, parsed VOTable or DALResults instance

VOTable that will be parsed with the parser of Astropy, which extracts the annotation block.

tablerefstr, optional

Used to identify the table to process. If not specified, the first table is taken by default.

Attributes Summary

annotation_seeker

Return an API to search various components in the XML mapping block.

connected_table

getter for the identifier the astropy.table instance the viewer is connected to

connected_table_ref

getter for the identifier the table the viewer is connected to

dm_instance

resource_seeker

Return an API to search various components in the VOTabel resource.

table_row

getter for the current astropy.table.array row

votable

returns the Astropy parsed votable

xml_view

xml_viewer

returns

Methods Summary

close()

with statement implementation

get_first_instance_dmtype([tableref])

Return the dmtype of the head INSTANCE (first TEMPLATES child).

get_globals_models()

Get collection types in GLOBALS.

get_models()

Get a dictionary of models and their URLs.

get_table_ids()

Return a list of the table located just below self._resource.

get_templates_models()

Get dmtypes (except ivoa:..) of all INSTANCE/COLLECTION of all TEMPLATES.

next()

jump to the next table row and update the MivotInstance instance

next_table_row()

Iterate once on the table row

rewind()

Rewind the table iterator on the table the veizer is connected with.

Attributes Documentation

annotation_seeker

Return an API to search various components in the XML mapping block.

connected_table

getter for the identifier the astropy.table instance the viewer is connected to

connected_table_ref

getter for the identifier the table the viewer is connected to

dm_instance
Returns:
A Python object (MivotInstance) built from the XML view of
the mapped model with attribute values set from the last values
of the last read data rows
resource_seeker

Return an API to search various components in the VOTabel resource.

table_row

getter for the current astropy.table.array row

votable

returns the Astropy parsed votable

xml_view
Returns:
The XML view on the current data row
xml_viewer
returns

XMLViewer tuned to browse the TEMPLATES content

Methods Documentation

close()[source]

with statement implementation

get_first_instance_dmtype(tableref=None)[source]

Return the dmtype of the head INSTANCE (first TEMPLATES child). If no INSTANCE is found, take the first COLLECTION.

Parameters:
tablerefstr or None, optional

Identifier of the table.

Returns
——-
~`xml.etree.ElementTree.Element`

The first child of TEMPLATES.

get_globals_models()[source]

Get collection types in GLOBALS. Collection types are GLOBALS/COLLECTION/INSTANCE@dmtype: used for collections of static objects.

Returns:
dict

A dictionary containing the dmtypes of all the top-level INSTANCE/COLLECTION of GLOBALS. The structure of the dictionary is {‘COLLECTION’: [dmtypes], ‘INSTANCE’: [dmtypes]}.

get_models()[source]

Get a dictionary of models and their URLs.

Returns:
dict: Model names and a lists of their URLs.

The format is {‘model’: [url], …}.

get_table_ids()[source]

Return a list of the table located just below self._resource.

get_templates_models()[source]

Get dmtypes (except ivoa:..) of all INSTANCE/COLLECTION of all TEMPLATES. Note: COLLECTION not implemented yet.

Returns:
dict: A dictionary containing dmtypes of all INSTANCE/COLLECTION of all TEMPLATES.

The format is {‘tableref’: {‘COLLECTIONS’: [dmtypes], ‘INSTANCE’: [dmtypes]}, …}.

next()[source]

jump to the next table row and update the MivotInstance instance

Returns:
MivotInstance: the updated instance or None

it he able end has been reached

next_table_row()[source]

Iterate once on the table row

Returns:

numpy row: the current table row of None if the end of the table has been reached

rewind()[source]

Rewind the table iterator on the table the veizer is connected with.