Expand description
Rust-native reader and writer for the LIGO_LW XML format.
LIGO_LW is the XML container used across the International Gravitational-Wave Observatory Network for tabular event data (single-detector triggers, coincidences, sky-map metadata) as well as the diagnostic-test (DTT) document family. This crate parses LIGO_LW documents into typed Rust structures, writes them back out in a round-trippable form, and transparently decompresses gzip input (and, behind feature flags, bzip2 and xz).
The parser is intentionally tolerant of the LIGO_LW format quirks
observed in real files emitted by the LVK low-latency pipelines
(gstlal, mbta, pycbc, spiir, aframe, cwb, mly): mixed whitespace,
trailing delimiters, quoted strings with embedded commas, modern
int_8s identifiers alongside legacy ilwd:char strings, and
cross-table column-name prefixes.
Structs§
- Array
- An
Arrayelement. - Coinc
Inspiral Event - A single coincident inspiral event distilled from a coinc.xml document. This is the shape the alert-manager clustering layer consumes.
- Column
- Dim
- A
Dimelement inside an<Array>. - Document
- A parsed LIGO_LW document.
- Generic
Element - A generic LIGO_LW element preserved verbatim for elements the parser does not have a dedicated representation for.
- Ligo
LwElement - A
<LIGO_LW>element. The document’s root is one of these; DTT-style documents nest them. - Param
- A
Paramelement. Carries metadata about a single typed value and the raw text payload. Decode the payload by inspectingParam::ty. - Sngl
Inspiral - A single-detector inspiral trigger.
- Table
- A
Tableelement. - Time
- A
Timeelement. Thevalueis preserved as text because the upstream type system distinguishes GPS, ISO-8601, and other formats that we leave to the caller to interpret.
Enums§
- Array
Encoding - How the
<Stream>body of an<Array>was encoded on the wire. - Child
- One element that can sit inside a
<LIGO_LW>(or other) container. - Error
- Ligo
Type - LIGO_LW column / param data types.
- Value
- A typed cell value parsed from a LIGO_LW Stream row.
Functions§
- parse_
bytes - Parse a complete LIGO_LW document from a byte slice.
- parse_
path - Parse a LIGO_LW document from a filesystem path, dispatching on the
file extension to a decompressor:
.gz(always available),.bz2(Cargo featurebzip2),.xz(Cargo featurexz). Plain.xmland anything else are read verbatim. - parse_
reader - Parse a LIGO_LW document from any
Readsource. The implementation reads the input into a buffer; this is fine for the kilobyte-to-low- megabyte files the library targets. - write_
to_ bytes - Serialize a document to a byte buffer. The output begins with an XML 1.0 declaration and the standard LIGO_LW DOCTYPE.
- write_
to_ path - Serialize a document to a filesystem path. The file extension
controls compression:
.gzwrites throughflate2;.bz2is behind thebzip2feature;.xzis behind thexzfeature. Anything else is written uncompressed. - write_
to_ writer - Serialize a document to any
Writesink.