LIGO_LW¶
- class igwn_ligolw.ligolw.LIGO_LW(attrs=None)¶
Bases:
EmptyElementLIGO_LW element.
Attributes Summary
The "Name" attribute.
The "Type" attribute.
Methods Summary
get_ligo_lw(xmldoc[, name])Scan xmldoc for a LIGO_LW element with .Name name.
Recurses over all Table elements within this LIGO_LW elem whose next_id attributes are not None, and uses the .get_next_id() method of each of those Tables to generate and assign new IDs to their rows.
Attributes Documentation
- Name¶
The “Name” attribute.
- Type¶
The “Type” attribute.
- tagName = 'LIGO_LW'¶
- validchildren = frozenset({'AdcData', 'AdcInterval', 'Array', 'Comment', 'Detector', 'IGWDFrame', 'LIGO_LW', 'Param', 'Stream', 'Table', 'Time'})¶
Methods Documentation
- classmethod get_ligo_lw(xmldoc, name=None)¶
Scan xmldoc for a LIGO_LW element with .Name name. Raises ValueError if not exactly 1 such element is found. If name is None (default), then all LIGO_LW elements are considered to match (it is still an error if there is not exactly 1).
- reassign_table_row_ids()¶
Recurses over all Table elements within this LIGO_LW elem whose next_id attributes are not None, and uses the .get_next_id() method of each of those Tables to generate and assign new IDs to their rows. The modifications are recorded, and finally all ID attributes in all rows of all tables are updated to fix cross references to the modified IDs.
This function is used by ligolw_add to assign new IDs to rows when merging documents in order to make sure there are no ID collisions. Using this function in this way requires the .get_next_id() methods of all Table elements to yield unused IDs, otherwise collisions will result anyway. See the .sync_next_id() method of the Table class for a way to initialize the .next_id attributes so that collisions will not occur.
Example:
>>> from igwn_ligolw import ligolw >>> from igwn_ligolw import lsctables >>> xmldoc = ligolw.Document() >>> xmldoc.appendChild(ligolw.LIGO_LW()).appendChild(lsctables.SnglInspiralTable.new()) [] >>> xmldoc.childNodes[-1].reassign_table_row_ids()