file_io.ADESXMLReader
Reader for MPC ADES observation files in XML form (issue #44).
ADES XML wraps each observation in an <optical> (or <radar>) element
whose child tags are the ADES field names – the same fields the CSV/PSV reader
consumes, e.g. provID, stn, obsTime, ra, dec, mag.
Both the “flat” form (<ades><optical>...</optical></ades>) and the
<obsBlock>-wrapped form are handled: we collect every <optical>/
<radar> element anywhere under the root.
Each record becomes one row; the union of all field tags becomes the columns
(missing fields are filled, exactly as a mixed CSV would be). Field text is
coerced to numeric where possible, while the primary-id and station columns are
kept as strings – mirroring CSVDataReader so downstream code sees an
identical structured array regardless of whether the input was CSV, PSV, or XML.
Attributes
Classes
Read MPC ADES observation data stored as XML into a structured array. |
Functions
|
Strip any XML namespace from a tag: |
|
Parse an ADES XML file into a list of per-observation dicts. |
Module Contents
- parse_ades_xml(filename, record_tags=_RECORD_TAGS)[source]
Parse an ADES XML file into a list of per-observation dicts.
Uses streaming
iterparseso large files do not load the whole DOM at once. Each returned dict maps ADES field name -> stripped text value for one observation record.
- class ADESXMLDataReader(filename, sep=None, **kwargs)[source]
Bases:
layup.utilities.file_io.ObjectDataReader.ObjectDataReaderRead MPC ADES observation data stored as XML into a structured array.
- _get_fixed_dtypes()[source]
Columns forced to
str(identifiers, not numbers).Mirrors
CSVDataReader._get_fixed_dtypes()so the primary-id and station columns are never coerced to numeric (e.g. station"024"must stay a string, not become24).