MivotViewer

class pyvo.mivot.viewer.MivotViewer(votable_path, tableref=None, resolve_ref=False)[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, DALResults, VOTableFile

Reference of the VOTable from which Astropy will extracts the annotation block

tablerefstr, optional

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

resolve_refboolean

Ask for references between MIVOT instances to be resolved (referenced instances are copied into the host object). This is usually used to copy the coordinates systems into the object that uses them.

Parameters
———-
resolve_refbool, optional

If True, replace the REFERENCE elements with a copy of the objects they refer to. e.g. copy the space coordinates system, usually located in the GLOBALS block, in the position objects Default is False.

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_globals_instances

dm_instance

dm_instances

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

Methods Summary

close()

with statement implementation

get_dm_instance_dmtypes(tableref)

Return the dmtypes of the INSTANCEs children of the TEMPLATES block mapping the data table identified by tableref.

get_models()

Get a dictionary of models and their URLs.

get_table_ids()

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

next_row_view()

jump to the next table row and update the MivotInstance instance with the row values

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_globals_instances
Returns:
[MivotInstance]: The list of Python objects (MivotInstance) built from the XML views of

the GLOBALS children, whose attribute values are set from the values of the current read data row. This method allows to retrieve the GLOBALS (coordinates systems usually) even when the viewer is in resolve_ref=False mode or if the reference to the coordinates systems have not been setup in the objects representing the mapped data.

dm_instance
Returns:
MivotInstance: The Python object (MivotInstance) built from the XML view of the

first ‘TEMPLATES’ child, with the attribute values set according to the values of the current read data row.

dm_instances
Returns:
[MivotInstance]: The list of Python objects (MivotInstance) built from the XML views of

the TEMPLATES children, whose attribute values are set from the values of the current read data row.

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

Methods Documentation

close()[source]

with statement implementation

get_dm_instance_dmtypes(tableref)[source]

Return the dmtypes of the INSTANCEs children of the TEMPLATES block mapping the data table identified by tableref.

Parameters:
tablerefstr or None

Identifier of the data table.

Returns:
[string]

list of dmtypes

Raises:
MivotError

if no INSTANCE can be found

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.

next_row_view()[source]

jump to the next table row and update the MivotInstance instance with the row values

Returns:
[MivotInstance]

List of updated instances 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.