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().


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().


>>> from importlib import resources
>>> 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 resources.path('',
...                     'G197392_coinc.xml.gz') as path:
...     xmldoc = utils.load_filename(path, contenthandler=ContentHandler)
>>> table = lsctables.SnglInspiralTable.get_table(xmldoc)
>>> table[0].process_id