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]¶
Convert from old-style to new-style row IDs on the fly.
This is loosely adapted from
igwn_ligolw.utils.ilwd.strip_ilwdchar()
.Notes
When building a ContentHandler, this must be the _outermost_ decorator, outside of
igwn_ligolw.lsctables.use_in()
,igwn_ligolw.param.use_in()
, origwn_ligolw.table.use_in()
.Examples
>>> from importlib.resources import as_file, files >>> from igwn_ligolw import ligolw, lsctables, utils >>> from ligo.skymap.util import ilwd >>> @ilwd.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