DatalinkResults

class pyvo.dal.adhoc.DatalinkResults(votable, url=None, session=None)[source]

Bases: pyvo.dal.adhoc.DatalinkResultsMixin, pyvo.dal.DALResults

The list of matching records resulting from an datalink query. Each record contains a set of metadata that describes an available record matching the query constraints. The number of records in the results is available by passing it to the Python built-in len() function.

This class supports iterable semantics; thus, individual records (in the form of Record instances) are typically accessed by iterating over an DatalinkResults instance.

Alternatively, records can be accessed randomly via getrecord() or through a Python Database API (v2) Cursor (via cursor()). Column-based data access is possible via the getcolumn() method.

DatalinkResults is essentially a wrapper around an Astropy votable Table instance where the columns contain the various metadata describing the images. One can access that VOTable directly via the votable attribute. Thus, when one retrieves a whole column via getcolumn(), the result is a Numpy array. Alternatively, one can manipulate the results as an Astropy Table via the following conversion:

>>> table = results.to_table()

DatalinkResults supports the array item operator [...] in a read-only context. When the argument is numerical, the result is an Record instance, 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.

Methods Summary

bysemantics(self, semantics) return the rows with the dataset identified by the given semantics
clone_byid(self, id) return a clone of the object with results and corresponding
get_first_proc(self) returns the first datalink row with a processing service.
getdataset(self[, timeout]) return the first row with the dataset identified by semantics #this
getrecord(self, index) return a representation of a datalink result record that follows dictionary semantics.
iter_procs(self) iterate over all rows with a processing service

Methods Documentation

bysemantics(self, semantics)[source]

return the rows with the dataset identified by the given semantics

Returns:
Sequence of DatalinkRecord

a sequence of dictionary-like wrappers containing the result record

clone_byid(self, id)[source]
return a clone of the object with results and corresponding
resources matching a given id
Returns:
Sequence of DatalinkRecord

a sequence of dictionary-like wrappers containing the result record

get_first_proc(self)[source]

returns the first datalink row with a processing service.

getdataset(self, timeout=None)[source]

return the first row with the dataset identified by semantics #this

Returns:
DatalinkRecord

a dictionary-like wrapper containing the result record.

getrecord(self, index)[source]

return a representation of a datalink result record that follows dictionary semantics. The keys of the dictionary are those returned by this instance’s fieldnames attribute. The returned record has the additional function getdataset()

Parameters:
index : int

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

Record
iter_procs(self)[source]

iterate over all rows with a processing service