parse#
- astropy.io.votable.parse(source, columns=None, invalid='exception', verify=None, chunk_size=256, table_number=None, table_id=None, filename=None, unit_format=None, datatype_mapping=None, _debug_python_based_parser=False)[source]#
 Parses a VOTABLE xml file (or file-like object), and returns a
VOTableFileobject.- Parameters:
 - sourcepython:path-like object or python:file-like object
 Path or file-like object containing a VOTABLE xml file. If file, must be readable.
- columnspython:sequence of 
python:str, optional List of field names to include in the output. The default is to include all fields.
- invalid
python:str, optional One of the following values:
‘exception’: throw an exception when an invalid value is encountered (default)
‘mask’: mask out invalid values
- verify{‘ignore’, ‘warn’, ‘exception’}, optional
 When
'exception', raise an error when the file violates the spec, otherwise either issue a warning ('warn') or silently continue ('ignore'). Warnings may be controlled using the standard Python mechanisms. See thewarningsmodule in the Python standard library for more information. When not provided, uses the configuration settingastropy.io.votable.verify, which defaults to ‘ignore’.Changed in version 4.0:
verifyreplaces thepedanticargument, which will be deprecated in future.Changed in version 5.0: The
pedanticargument is deprecated.Changed in version 6.0: The
pedanticargument is removed.- chunk_size
python: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
python: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 withtable_id.- table_id
python:str, optional The ID of the table in the file to read in. Should not be used with
table_number.- filename
python: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
python:str,astropy.units.format.Basesubclass orpython: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, andvounit. A custom formatter may be provided by passing aBasesubclass. IfNone(default), the unit format to use will be the one specified by the VOTable specification (which iscdsup to version 1.3 of VOTable, andvounitin more recent versions of the spec).- datatype_mapping
python:dict, optional A mapping of datatype names (
str) to valid VOTable datatype names (str). For example, if the file being read contains the datatype “unsignedInt” (an invalid datatype in VOTable), include the mapping{"unsignedInt": "long"}.
- Returns:
 - votable
VOTableFileobject 
- votable
 
See also
astropy.io.votable.exceptionsThe exceptions this function may raise.