astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v0.3 »
- VOTable XML handling (`astropy.io.votable`) »
- parse

# parse

`astropy.io.votable.table.``parse`(source, columns=None, invalid=u'exception', pedantic=None, chunk_size=256, table_number=None, table_id=None, filename=None, unit_format=None, _debug_python_based_parser=False)

  Parses a VOTABLE xml file (or file-like object), and returns a `VOTable` object.

  Parameters:

  source : str or readable file-like object

  > Path or file object containing a VOTABLE xml file.

  columns : sequence of str, optional

  > List of field names to include in the output. The default is to include all fields.

  invalid : str, optional

  > One of the following values:

  > > - ‘exception’: throw an exception when an invalid value is encountered (default)
  > > - ‘mask’: mask out invalid values

  pedantic : bool, optional

  > When `True`, raise an error when the file violates the spec, otherwise issue a warning. Warnings may be controlled using the standard Python mechanisms. See the `warnings` module in the Python standard library for more information. When not provided, uses the configuration setting `astropy.io.votable.pedantic`, which defaults to False.

  chunk_size : int, optional

  > The number of rows to read before converting to an array. Higher numbers are likely to be faster, but will consume more memory.

  table_number : int, optional

  > The number of table in the file to read in. If `None`, all tables will be read. If a number, 0 refers to the first table in the file, and only that numbered table will be parsed and read in. Should not be used with `table_id`.

  table_id : str, optional

  > The ID of the table in the file to read in. Should not be used with `table_number`.

  filename : str, optional

  > A filename, URL or other identifier to use in error messages. If filename is None and source is a string (i.e. a path), then source will be used as a filename for error messages. Therefore, filename is only required when source is a file-like object.

  unit_format : str, astropy.units.format.Base instance or None, optional

  > The unit format to use when parsing unit attributes. If a string, must be the name of a unit formatter. The built-in formats include `generic`, `fits`, `cds`, and `vounit`. A custom formatter may be provided by passing a `astropy.units.format.Base` instance. If `None` (default), the unit format to use will be the one specified by the VOTable specification (which is `cds` up to version 1.2 of VOTable, and (probably) `vounit` in future versions of the spec).

  Returns: | votable : `astropy.io.votable.tree.VOTableFile` object

  See also

  `astropy.io.votable.exceptions`
    The exceptions this function may raise.