Document¶
- class igwn_ligolw.ligolw.Document(attrs=None)¶
Bases:
EmptyElementDescription of a LIGO LW file.
Attributes Summary
Methods Summary
Make sure the leading child node is a LIGO_LW element.
register_process(program, paramdict, **kwargs)Ensure the document has sensible process and process_params tables, synchronize the process table's ID generator, add a new row to the table for the current process, and add rows to the process_params table describing the options in paramdict.
write([fileobj, xsl_file])Write the document.
Attributes Documentation
- tagName = 'Document'¶
- validchildren = frozenset({'LIGO_LW'})¶
Methods Documentation
- ensure_llw_at_toplevel()¶
Make sure the leading child node is a LIGO_LW element. Used in a variety of places for sanity checking document structure before starting other operations. Returns self on success, or raises ValueError if the 0th child node of self is not a LIGO_LW element.
- register_process(program, paramdict, **kwargs)¶
Ensure the document has sensible process and process_params tables, synchronize the process table’s ID generator, add a new row to the table for the current process, and add rows to the process_params table describing the options in paramdict. program is the name of the program. paramdict is expected to be the .__dict__ contents of an optparse.OptionParser options object, or the equivalent. Any keyword arguments are passed to lsctables.Process.initialized(), see that method for more information. The new process row object is returned.
The document tree must have a LIGO_LW element at the top level. ValueError is raised if this condition is not met.
Example
>>> xmldoc = Document() >>> xmldoc.appendChild(LIGO_LW()) <igwn_ligolw.ligolw.LIGO_LW object at ...> >>> process = xmldoc.register_process("program_name", {"verbose": True})
- write(fileobj=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, xsl_file=None)¶
Write the document.