TAPResults¶
-
class
pyvo.dal.TAPResults(votable, url=None, session=None)[source]¶ Bases:
pyvo.dal.adhoc.DatalinkResultsMixin,pyvo.dal.DALResultsThe list of matching images resulting from an image (SIA) query. Each record contains a set of metadata that describes an available image matching the query constraints. The number of records in the results is available via the
nrecsattribute or by passing it to the Python built-inlen()function.This class supports iterable semantics; thus, individual records (in the form of
Recordinstances) are typically accessed by iterating over anTAPResultsinstance.Alternatively, records can be accessed randomly via
getrecord()or through a Python Database API (v2) Cursor (viacursor()). Column-based data access is possible via thegetcolumn()method.TAPResultsis essentially a wrapper around an AstropyvotableTableinstance where the columns contain the various metadata describing the images. One can access that VOTable directly via thevotableattribute. Thus, when one retrieves a whole column viagetcolumn(), the result is a Numpy array. Alternatively, one can manipulate the results as an AstropyTablevia the following conversion:>>> table = results.table
SIAResultssupports the array item operator[...]in a read-only context. When the argument is numerical, the result is anRecordinstance, representing the record at the position given by the numerical index. If the argument is a string, it is interpreted as the name of a column, and the data from the column matching that name is returned as a Numpy array.Attributes Summary
return the info element as dictionary
return the query status
Methods Summary
getrecord(index)return a representation of a tap result record that follows dictionary semantics.
Attributes Documentation
-
infos¶ return the info element as dictionary
-
query_status¶ return the query status
Methods Documentation
-
getrecord(index)[source]¶ return a representation of a tap result record that follows dictionary semantics. The keys of the dictionary are those returned by this instance’s fieldnames attribute. The returned record has additional image-specific properties
- Parameters
- indexint
the integer index of the desired record where 0 returns the first record
- Returns
- REc
a dictionary-like wrapper containing the result record metadata.
- Raises
- IndexError
if index is negative or equal or larger than the number of rows in the result table.
See also
-