LIGO-LW I/O Utilities (ligo.skymap.util.ilwd)

Tools for adapting LIGO-LW row ID formats.

ligo.skymap.util.ilwd.use_in(ContentHandler)[source] [edit on github]

Convert from old-style to new-style row IDs on the fly.

This is loosely adapted from ligo.lw.utils.ilwd.strip_ilwdchar().

Notes

When building a ContentHandler, this must be the _outermost_ decorator, outside of ligo.lw.lsctables.use_in(), ligo.lw.param.use_in(), or ligo.lw.table.use_in().

Examples

>>> from pkg_resources import resource_filename
>>> from ligo.lw import array, ligolw, lsctables, param, table, utils
>>> from ligo.skymap.util import ilwd
>>> @ilwd.use_in
... @lsctables.use_in
... @param.use_in
... @table.use_in
... class ContentHandler(ligolw.LIGOLWContentHandler):
...     pass
>>> filename = resource_filename(
...     'ligo.skymap.io.tests', 'data/G197392_coinc.xml.gz')
>>> xmldoc = utils.load_filename(filename, contenthandler=ContentHandler)
>>> table = lsctables.SnglInspiralTable.get_table(xmldoc)
>>> table[0].process_id
0