SLAResults¶
-
class
pyvo.dal.sla.
SLAResults
(votable, url=None)[source]¶ Bases:
pyvo.dal.query.DALResults
The list of matching spectral lines resulting from a spectal line catalog (SLA) query. Each record contains a set of metadata that describes a source or observation within the requested circular region (i.e. a “cone”). The number of records in the results is available via the
nrecs
attribute or by passing it to the Python built-inlen()
function.This class supports iterable semantics; thus, individual records (in the form of
SLARecord
instances) are typically accessed by iterating over anSLAResults
instance.>>> results = pyvo.linesearch(url, wavelength='0.0265/0.0280') >>> for spl in results: ... print(("{0}: {1}".format(spl.species_name, spl.wavelength)))
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.SLAResults
is essentially a wrapper around an Astropyvotable
Table
instance where the columns contain the various metadata describing the images. One can access that VOTable directly via thevotable
attribute. Thus, when one retrieves a whole column viagetcolumn()
, the result is a Numpy array. Alternatively, one can manipulate the results as an AstropyTable
via the following conversion:>>> table = results.votable.to_table()
SLAResults
supports the array item operator[...]
in a read-only context. When the argument is numerical, the result is anSLARecord
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.initialize the cursor. This constructor is not typically called by directly applications; rather an instance is obtained from calling a SLAQuery’s execute().