VOSDatabase¶
-
class
astroquery.vo_conesearch.vos_catalog.VOSDatabase(tree)[source]¶ Bases:
astroquery.vo_conesearch.vos_catalog.VOSBaseA class to represent a collection of
VOSCatalog.Parameters: tree : JSON tree
Raises: VOSError
If given
treedoes not have ‘catalogs’ key or catalog is invalid.Attributes Summary
versionDatabase version number. Methods Summary
add_catalog(name, cat[, allow_duplicate_url])Add a catalog to database. add_catalog_by_url(name, url, **kwargs)Like add_catalog()but the catalog is created with only the given name and access URL.create_empty()Create an empty database of VO services. delete_catalog(name)Delete a catalog from database with given name. delete_catalog_by_url(url)Like delete_catalog()but using access URL.from_json(filename, **kwargs)Create a database of VO services from a JSON file. from_registry(registry_url[, timeout])Create a database of VO services from VO registry URL. get_catalog(name)Get one catalog of given name. get_catalog_by_url(url)Like get_catalog()but using access URL look-up.get_catalogs()Iterator to get all catalogs. get_catalogs_by_url(url)Like get_catalogs()but using access URL look-up.list_catalogs([pattern, sort])List catalog names. list_catalogs_by_url([pattern, sort])Like list_catalogs()but using access URL.merge(other, **kwargs)Merge two database together. to_json(filename[, overwrite])Write database content to a JSON file. Attributes Documentation
-
version¶ Database version number.
Methods Documentation
-
add_catalog(name, cat, allow_duplicate_url=False)[source]¶ Add a catalog to database.
Parameters: name : str
Primary key for the catalog.
cat :
VOSCatalogCatalog to add.
allow_duplicate_url : bool
Allow catalog with duplicate access URL?
Raises: VOSError
Invalid catalog.
DuplicateCatalogName
Catalog with given name already exists.
DuplicateCatalogURL
Catalog with given access URL already exists.
-
add_catalog_by_url(name, url, **kwargs)[source]¶ Like
add_catalog()but the catalog is created with only the given name and access URL.Parameters: name : str
Primary key for the catalog.
url : str
Access URL of the service. This is used to build queries.
kwargs : dict
Keywords accepted by
add_catalog().
-
classmethod
create_empty()[source]¶ Create an empty database of VO services.
Empty database format:
{ "__version__": 1, "catalogs" : { } }
Returns: db :
VOSDatabaseEmpty database.
-
delete_catalog(name)[source]¶ Delete a catalog from database with given name.
Parameters: name : str
Primary key identifying the catalog.
Raises: MissingCatalog
If catalog is not found.
-
delete_catalog_by_url(url)[source]¶ Like
delete_catalog()but using access URL. On multiple matches, all matches are deleted.
-
classmethod
from_json(filename, **kwargs)[source]¶ Create a database of VO services from a JSON file.
Example JSON format for Cone Search:
{ "__version__": 1, "catalogs" : { "My Cone Search": { "capabilityClass": "ConeSearch", "title": "My Cone Search", "url": "http://foo/cgi-bin/search?CAT=bar&", ... }, "Another Cone Search": { ... } } }
Parameters: filename : str
JSON file.
kwargs : dict
Keywords accepted by
get_readable_fileobj().Returns: db :
VOSDatabaseDatabase from given file.
-
classmethod
from_registry(registry_url, timeout=60, **kwargs)[source]¶ Create a database of VO services from VO registry URL.
This is described in detail in Building the Database from Registry, except for the
validate_xxxkeys that are added by the validator itself.Parameters: registry_url : str
URL of VO registry that returns a VO Table. For example, see
astroquery.vo_conesearch.validator.conf.cs_mstr_list. Pedantic is automatically set toFalsefor parsing.timeout : number
Temporarily set
astropy.utils.data.conf.remote_timeoutto this value to avoid time out error while reading the entire registry.kwargs : dict
Keywords accepted by
get_readable_fileobj().Returns: db :
VOSDatabaseDatabase from given registry.
Raises: VOSError
Invalid VO registry.
-
get_catalog(name)[source]¶ Get one catalog of given name.
Parameters: name : str
Primary key identifying the catalog.
Returns: obj :
VOSCatalogRaises: MissingCatalog
If catalog is not found.
-
get_catalog_by_url(url)[source]¶ Like
get_catalog()but using access URL look-up. On multiple matches, only first match is returned.
-
get_catalogs_by_url(url)[source]¶ Like
get_catalogs()but using access URL look-up.
-
list_catalogs(pattern=None, sort=True)[source]¶ List catalog names.
Parameters: pattern : str or
NoneIf given string is anywhere in a catalog name, it is considered a matching catalog. It accepts patterns as in
fnmatchand is case-insensitive. By default, all catalogs are returned.sort : bool
Sort output in alphabetical order. If not sorted, the order depends on dictionary hashing. Default is
True.Returns: out_arr : list of str
List of catalog names.
-
list_catalogs_by_url(pattern=None, sort=True)[source]¶ Like
list_catalogs()but using access URL.
-
merge(other, **kwargs)[source]¶ Merge two database together.
Parameters: other :
VOSDatabaseThe other database to merge.
kwargs : dict
Keywords accepted by
add_catalog().Returns: db :
VOSDatabaseMerged database.
Raises: VOSError
Invalid database or incompatible version.
-