Package ligolw
source code
DOM-like library for handling LIGO Light Weight XML files. For more
information on the Python DOM specification and SAX document content
handlers, please refer to the Python standard library reference and the
documentation it links to.
Here is a brief tutorial for a common use case: load a LIGO
Light-Weight XML document containing tabular data complying with the LSC
table definitions, access rows in the tables including the use of
ID-based cross references, modify the contents of a table, and finally
write the document back to disk. Please see the documentation for the
modules, classes, functions, and methods shown below for more
information.
Example:
>>>
>>> from glue.ligolw import ligolw
>>> from glue.ligolw import lsctables
>>> from glue.ligolw import utils as ligolw_utils
>>>
>>>
>>> class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
... pass
...
>>> lsctables.use_in(LIGOLWContentHandler)
>>>
>>>
>>> filename = "demo.xml.gz"
>>> xmldoc = ligolw_utils.load_filename(filename, contenthandler = LIGOLWContentHandler, verbose = True)
>>>
>>>
>>>
>>> process_table = lsctables.ProcessTable.get_table(xmldoc)
>>> sngl_inspiral_table = lsctables.SnglInspiralTable.get_table(xmldoc)
>>>
>>>
>>> for row in sngl_inspiral_table:
... row.mtotal = row.mass1 + row.mass2
...
>>>
>>> index = dict((row.process_id, row) for row in process_table)
>>>
>>>
>>>
>>>
>>> for row in sngl_inspiral_table:
... process = index[row.process_id]
... print "%s@%s: %s s" % (process.username, process.node, str(row.get_end()))
...
>>>
>>>
>>> ligolw_utils.write_filename(xmldoc, filename, gz = filename.endswith(".gz"), verbose = True)
Version:
git id 8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5
Date:
2017-12-05 15:29:36 +0000
Author:
Kipp Cannon <kipp.cannon@ligo.org>
- glue.ligolw._ilwd: C extension module providing the ilwdchar parent class for row ID
classes.
- glue.ligolw.array: While the ligolw module provides classes and parser support for
reading and writing LIGO Light Weight XML documents, this module
supplements that code with classes and parsers that add
intelligence to the in-RAM document representation.
- glue.ligolw.dbtables: This module provides an implementation of the Table element that
uses a database engine for storage.
- glue.ligolw.ilwd: The ilwd:char type is used to store ID strings for objects within
LIGO Light-Weight XML files.
- glue.ligolw.ligolw: This module provides class definitions corresponding to the
elements that can be found in a LIGO Light Weight XML file.
- glue.ligolw.lsctables: LSC Table definitions.
- glue.ligolw.param: High-level support for Param elements.
- glue.ligolw.table: While the ligolw module provides classes and parser support for
reading and writing LIGO Light Weight XML documents, this module
supplements that code with classes and parsers that add
intelligence to the in-RAM document representation.
- glue.ligolw.tokenizer: This module provides a tokenizer for LIGO Light Weight XML Stream
and Array elements, as well as other utilities to assist in packing
parsed tokens into various data storage units.
- glue.ligolw.types: Definitions of type strings found in LIGO Light Weight XML files.
- glue.ligolw.utils: Library of utility code for LIGO Light Weight XML applications.
|
|
__package__ = ' glue.ligolw '
|