Skip to main content
`Ctrl`+`K`

# Reference/API

## astropy.io.votable Package

This package reads and writes data formats used by the Virtual Observatory (VO) initiative, particularly the VOTable XML format.

### Functions

`from_table`(table[, table_id]) | Given an `Table` object, return a `VOTableFile` file structure containing just that single table.
`is_votable`(source) | Reads the header of a file to determine if it is a VOTable file.
`parse`(source[, columns, invalid, verify, ...]) | Parses a VOTABLE xml file (or file-like object), and returns a `VOTableFile` object.
`parse_single_table`(source, **kwargs) | Parses a VOTABLE xml file (or file-like object), reading and returning only the first `TableElement` instance.
`validate`(source[, output, xmllint, filename]) | Prints a validation report for the given file.
`writeto`(table, file[, tabledata_format]) | Writes a `VOTableFile` to a VOTABLE xml file.

### Classes

`Conf`() | Configuration parameters for `astropy.io.votable`.

## astropy.io.votable.tree Module

### Classes

`CooSys`([ID, equinox, epoch, system, id, ...]) | COOSYS element: defines a coordinate system.
`Element`() | A base class for all classes that represent XML elements in the VOTABLE file.
`Field`(votable[, ID, name, datatype, ...]) | FIELD element: describes the datatype of a particular column of data.
`FieldRef`(table, ref[, ucd, utype, config, pos]) | FIELDref element: used inside of GROUP elements to refer to remote FIELD elements.
`Group`(table[, ID, name, ref, ucd, utype, ...]) | GROUP element: groups FIELD and PARAM elements.
`Info`([ID, name, value, id, xtype, ref, ...]) | INFO elements: arbitrary key-value pairs for extensions to the standard.
`Link`([ID, title, value, href, action, id, ...]) | LINK elements: used to reference external documents and servers through a URI.
`MivotBlock`([content]) | MIVOT Block holder: Processing VO model views on data is out of the scope of Astropy.
`Param`(votable[, ID, name, value, datatype, ...]) | PARAM element: constant-valued columns in the data.
`ParamRef`(table, ref[, ucd, utype, config, pos]) | PARAMref element: used inside of GROUP elements to refer to remote PARAM elements.
`Resource`([name, ID, utype, type, id, ...]) | RESOURCE element: Groups TABLE and RESOURCE elements.
`TableElement`(votable[, ID, name, ref, ucd, ...]) | TABLE element: optionally contains data.
`TimeSys`([ID, timeorigin, timescale, ...]) | TIMESYS element: defines a time system.
`VOTableFile`([ID, id, config, pos, version]) | VOTABLE element: represents an entire file.
`Values`(votable, field[, ID, null, ref, ...]) | VALUES element: used within FIELD and PARAM elements to define the domain of values.

## astropy.io.votable.converters Module

This module handles the conversion of various VOTABLE datatypes to/from TABLEDATA and BINARY formats.

### Functions

`get_converter`(field[, config, pos]) | Get an appropriate converter instance for a given field.
`table_column_to_votable_datatype`(column) | Given a `astropy.table.Column` instance, returns the attributes necessary to create a VOTable FIELD element that corresponds to the type of the column.

### Classes

`Converter`(field[, config, pos]) | The base class for all converters.

## astropy.io.votable.ucd Module

This file contains routines to verify the correctness of UCD strings.

### Functions

`check_ucd`(ucd[, ...]) | Returns False if ucd is not a valid unified content descriptor.
`parse_ucd`(ucd[, ...]) | Parse the UCD into its component parts.

## astropy.io.votable.util Module

Various utilities and cookbook-like things.

### Functions

`coerce_range_list_param`(p[, frames, numeric]) | Coerces and/or verifies the object p into a valid range-list-format parameter.
`convert_to_writable_filelike`(fd[, compressed]) | Returns a writable file-like object suitable for streaming output.

## astropy.io.votable.validator Package

Validates a large collection of web-accessible VOTable files, and generates a report as a directory tree of HTML files.

### Functions

`make_validation_report`([urls, destdir, ...]) | Validates a large collection of web-accessible VOTable files.

## astropy.io.votable.xmlutil Module

Various XML-related utilities.

### Functions

`check_anyuri`(uri[, config, pos]) | Raises a `VOTableSpecError` if uri is not a valid URI.
`check_id`(ID[, name, config, pos]) | Raises a `VOTableSpecError` if ID is not a valid XML ID.
`check_mime_content_type`(content_type[, ...]) | Raises a `VOTableSpecError` if content_type is not a valid MIME content type.
`check_token`(token, attr_name[, config, pos]) | Raises a `ValueError` if token is not a valid XML token.
`fix_id`(ID[, config, pos]) | Given an arbitrary string, create one that can be used as an xml id.
`validate_schema`(filename[, version]) | Validates the given file against the appropriate VOTable schema.

## astropy.io.votable.dataorigin Module

Extract Data Origin in VOTable

### References

DataOrigin is a vocabulary described in the IVOA note: https://www.ivoa.net/documents/DataOrigin/

### Notes

This API retrieve Metadata from INFO in VOTable. The information can be found at different level in a VOTable :

- global level

- resource level

- table level

### Contents

- Query information: Each element is considered to be unique in the VOTable. Information concerns publisher, date of execution, contact, request, etc.

- Dataset origin : basic provenance information.

### Examples

    >>> from astropy.io.votable import parse
    >>> from astropy.io.votable.dataorigin import extract_data_origin
    >>> data_origin = extract_data_origin(parse("https://vizier.cds.unistra.fr/viz-bin/conesearch/II/246/out?RA=0&DEC=0&SR=0.1"))
    >>> print(data_origin)
    publisher: CDS
    server_software: 7.4.5
    service_protocol: ivo://ivoa.net/std/ConeSearch/v1.03
    request: https://vizier.cds.unistra.fr/viz-bin/conesearch/II/246/out?RA=0&DEC=0&SR=0.1
    request_date: 2025-03-03T12:54:26
    contact: cds-question@unistra.fr
    ...
    >>> uri_request = data_origin.query.request
    >>> creators =  data_origin.origin[0].creator

### Functions

`add_data_origin_info`(vot_element, info_name, ...) | Update VOTable element with information compatible
`extract_data_origin`(vot_element) | Extract DataOrigin in a VO element

### Classes

`DataOrigin`() | Data class storing both information about query execution
`DatasetOrigin`([votable_element]) | Data class storing the basic provenance for a Dataset.
`QueryOrigin`() | Data class storing query execution information that generated the VOTable.