Note

This is an old version of the documentation. See http://docs.astropy.org/en/stable for the latest version.

Using astropy.vo.validator

VO services validator is used by STScI to support Simple Cone Search. Currently, only Cone Search services are supported. A typical user should not need the validator. However, this could be used by VO service providers to validate their services. Currently, any service to be validated has to be registered in STScI VAO Registry.

Inspection of Validation Results

astropy.vo.validator.inspect inspects results from Validation for Simple Cone Search. It reads in JSON files of VOSDatabase residing in astropy.vo.Conf.vos_baseurl, which can be changed to point to a different location.

Configurable Items

This parameter is set via Configuration system (astropy.config):

Examples

>>> from astropy.vo.validator import inspect

Load Cone Search validation results from astropy.vo.Conf.vos_baseurl (by default, the one used by Simple Cone Search):

>>> r = inspect.ConeSearchResults()
Downloading http://.../conesearch_good.json
|===========================================|  48k/ 48k (100.00%)        00s
Downloading http://.../conesearch_warn.json
|===========================================|  85k/ 85k (100.00%)        00s
Downloading http://.../conesearch_exception.json
|===========================================| 3.0k/3.0k (100.00%)        00s
Downloading http://.../conesearch_error.json
|===========================================| 4.0k/4.0k (100.00%)        00s

Print tally. In this example, there are 13 Cone Search services that passed validation with non-critical warnings, 14 with critical warnings, 1 with exceptions, and 2 with network error:

>>> r.tally()
good: 13 catalog(s)
warn: 14 catalog(s)
exception: 1 catalog(s)
error: 2 catalog(s)
total: 30 catalog(s)

Print a list of good Cone Search catalogs, each with title, access URL, warning codes collected, and individual warnings:

>>> r.list_cats('good')
Guide Star Catalog 2.3 1
http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&
W48,W50
.../vo.xml:136:0: W50: Invalid unit string 'pixel'
.../vo.xml:155:0: W48: Unknown attribute 'nrows' on TABLEDATA
# ...
USNO-A2 Catalogue 1
http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2&
W17,W42,W21
.../vo.xml:4:0: W21: vo.table is designed for VOTable version 1.1 and 1.2...
.../vo.xml:4:0: W42: No XML namespace specified
.../vo.xml:15:15: W17: VOTABLE element contains more than one DESCRIPTION...

List Cone Search catalogs with warnings, excluding warnings that were ignored in astropy.vo.validator.Conf.noncritical_warnings, and writes the output to a file named 'warn_cats.txt' in the current directory. This is useful to see why the services failed validations:

>>> with open('warn_cats.txt', 'w') as fout:
...     r.list_cats('warn', fout=fout, ignore_noncrit=True)

List the titles of all good Cone Search catalogs:

>>> r.catkeys['good']
[u'Guide Star Catalog 2.3 1',
 u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 1',
 u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 2',
 u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 3', ...,
 u'USNO-A2 Catalogue 1']

Print the details of catalog titled 'USNO-A2 Catalogue 1':

>>> r.print_cat('USNO-A2 Catalogue 1')
{
    "capabilityClass": "ConeSearch",
    "capabilityStandardID": "ivo://ivoa.net/std/ConeSearch",
    "capabilityValidationLevel": "",
    "contentLevel": "#University#Research#Amateur#",
    # ...
    "version": "",
    "waveband": "#Optical#"
}
Found in good

Load Cone Search validation results from a local directory named 'subset'. This is useful if you ran your own Validation for Simple Cone Search and wish to inspect the output databases. This example reads in validation of STScI Cone Search services done in Validation for Simple Cone Search Examples:

>>> from astropy.vo import conf
>>> with conf.set_temp('vos_baseurl', './subset/'):
>>>     r = inspect.ConeSearchResults()
>>> r.tally()
good: 19 catalog(s)
warn: 7 catalog(s)
exception: 2 catalog(s)
error: 0 catalog(s)
total: 28 catalog(s)
>>> r.catkeys['good']
[u'Advanced Camera for Surveys 1',
 u'Berkeley Extreme and Far-UV Spectrometer 1',
 u'Copernicus Satellite 1',
 u'Extreme Ultraviolet Explorer 1', ...,
 u'Wisconsin Ultraviolet Photo-Polarimeter Experiment 1']