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 importlib.resources import as_file, files
>>> 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
>>> with as_file(files('ligo.skymap.io.tests.data').joinpath(
...         'G197392_coinc.xml.gz')) as f:
...     xmldoc = utils.load_filename(f, contenthandler=ContentHandler)
>>> table = lsctables.SnglInspiralTable.get_table(xmldoc)
>>> table[0].process_id
0