Skip to content

Commit e701754

Browse files
authored
Merge pull request #608 from msdemlei/open-more-regtap-api
Adding RegistryResults and RegistryResource to the registry API
2 parents 130d08d + 4706df9 commit e701754

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

docs/registry/index.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ you would say:
134134
... registry.Freetext("AGB"))
135135

136136
After that, ``resources`` is an instance of
137-
:py:class:`~pyvo.registry.regtap.RegistryResults`, which you can iterate over. In
137+
:py:class:`~pyvo.registry.RegistryResults`, which you can iterate over. In
138138
interactive data discovery, however, it is usually preferable to use the
139139
``to_table`` method for an overview of the resources available:
140140

@@ -165,13 +165,12 @@ And to look for tap resources *in* a specific cone, you would do
165165
object ...
166166
------------------------------- ...
167167
ivo://cds.vizier/j/a+a/688/a104 ...
168-
ivo://cds.vizier/j/aj/166/68 ...
168+
ivo://cds.vizier/j/apj/938/73 ...
169169

170170
Astropy Quantities are also supported for the radius angle of a SkyCoord-defined circular region:
171171

172172
.. doctest-remote-data::
173173

174-
>>> from astropy.coordinates import SkyCoord
175174
>>> from astropy import units as u
176175
>>> registry.search(registry.Freetext("Wolf-Rayet"),
177176
... registry.Spatial((SkyCoord("23d +3d"), 180*u.Unit('arcmin')), intersect="enclosed"))
@@ -181,7 +180,7 @@ Astropy Quantities are also supported for the radius angle of a SkyCoord-defined
181180
object ...
182181
------------------------------- ...
183182
ivo://cds.vizier/j/a+a/688/a104 ...
184-
ivo://cds.vizier/j/aj/166/68 ...
183+
ivo://cds.vizier/j/apj/938/73 ...
185184

186185
Where ``intersect`` can take the following values:
187186
* 'covers' is the default and returns resources that cover the geometry provided,
@@ -205,7 +204,7 @@ are not), but it is rather clunky, and in the real VO short name
205204
collisions should be very rare.
206205

207206
Use the ``get_service`` method of
208-
:py:class:`~pyvo.registry.regtap.RegistryResource` to obtain a DAL service
207+
:py:class:`~pyvo.registry.RegistryResource` to obtain a DAL service
209208
object for a particular sort of interface.
210209
To query the fourth match using simple cone search, you would
211210
thus say:
@@ -229,8 +228,8 @@ the first conesearch it finds.
229228
However some providers provide multiple services of the same type
230229
-- for example in VizieR you'll find one conesearch per table.
231230
In this case, you can inspect the available `~pyvo.registry.regtap.Interface` to services with
232-
`~pyvo.registry.regtap.RegistryResource.list_interfaces`. Then, you can refine your
233-
instructions to `~pyvo.registry.regtap.RegistryResource.get_service` with a keyword
231+
`~pyvo.registry.RegistryResource.list_interfaces`. Then, you can refine your
232+
instructions to `~pyvo.registry.RegistryResource.get_service` with a keyword
234233
constraint on the description ``get_service(service_type='conesearch', keyword='sncat')``.
235234

236235
.. doctest-remote-data::
@@ -363,7 +362,7 @@ to find what x-ray images that have of CasA. For the arguments you will
363362
enter ``'image'`` for the service type and ``'x-ray'`` for the waveband.
364363
The position is provided by the Astropy library.
365364

366-
The query returns a :py:class:`~pyvo.registry.regtap.RegistryResults` object
365+
The query returns a :py:class:`~pyvo.registry.RegistryResults` object
367366
which is a container holding a table of matching services. In this example
368367
it returns 33 matching services.
369368

@@ -432,12 +431,12 @@ Search results
432431
==============
433432

434433
What is coming back from registry.search is
435-
:py:class:`pyvo.registry.regtap.RegistryResults` which is rather
434+
:py:class:`pyvo.registry.RegistryResults` which is rather
436435
similar to :ref:`pyvo-resultsets`; just remember that for interactive
437436
use there is the ``to_tables`` method discussed above.
438437

439438
The individual items are instances of
440-
:py:class:`~pyvo.registry.regtap.RegistryResource`, which expose many
439+
:py:class:`~pyvo.registry.RegistryResource`, which expose many
441440
pieces of metadata (e.g., title, description, creators, etc) in
442441
attributes named like their RegTAP counterparts (see the class
443442
documentation). Some attributes deserve a second look.

pyvo/registry/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
The regtap module supports access to the IVOA Registries
66
"""
77

8-
from .regtap import search, ivoid2service, get_RegTAP_query, choose_RegTAP_service
8+
from .regtap import (search, ivoid2service,
9+
get_RegTAP_query,
10+
choose_RegTAP_service,
11+
RegistryResults, RegistryResource)
912

1013
from .rtcons import (Constraint, SubqueriedConstraint,
1114
Freetext, Author, Servicetype, Waveband, Datamodel, Ivoid,
@@ -15,4 +18,5 @@
1518
"Freetext", "Author",
1619
"Servicetype", "Waveband", "Datamodel", "Ivoid", "UCD",
1720
"Spatial", "Spectral", "Temporal",
18-
"choose_RegTAP_service", "RegTAPFeatureMissing"]
21+
"choose_RegTAP_service", "RegTAPFeatureMissing",
22+
"RegistryResults", "RegistryResource",]

pyvo/registry/regtap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def search(*constraints: rtcons.Constraint,
235235
236236
Returns
237237
-------
238-
~pyvo.registry.regtap.RegistryResults`
238+
~pyvo.registry.RegistryResults`
239239
a container holding a table of matching resource (e.g. services)
240240
241241
"""

0 commit comments

Comments
 (0)