diff --git a/glue/bin/ligolw_combine_segments b/glue/bin/ligolw_combine_segments index 7dbde0f29f09d1aa5fe895d34c38461eb8cdf11e..36522b5ab4fde9fe4eb65b81c449ad2f14baeded 100755 --- a/glue/bin/ligolw_combine_segments +++ b/glue/bin/ligolw_combine_segments @@ -159,7 +159,7 @@ if __name__ == '__main__': values["process"]["jobid"] = None values["process"]["is_online"] = False - processTab = lsctables.table.get_table(doc, lsctables.ProcessTable.tableName) + processTab = lsctables.ProcessTable.get_table(doc) for column_name in values["process"]: try: column = processTab.appendColumn(column_name) diff --git a/glue/bin/ligolw_geo_fr_to_dq b/glue/bin/ligolw_geo_fr_to_dq index 9361a9b12093b635e92647de0df950824159d92f..edb7eb93647e55cd1d05afacfe4fb4471da78e38 100755 --- a/glue/bin/ligolw_geo_fr_to_dq +++ b/glue/bin/ligolw_geo_fr_to_dq @@ -310,7 +310,7 @@ def frame_to_dq_xml(frame_file, xml_root, ifo, type, version, comment, verbose=F segmentdb_utils.add_to_segment(outdoc,proc_id,seg_def_id,segs[flag]) # write the xml doc to disk - proctable = table.get_table(outdoc, lsctables.ProcessTable.tableName) + proctable = lsctables.ProcessTable.get_table(outdoc) proctable[0].end_time = gpstime.GpsSecondsFromPyUTC(time.time()) outname = gen_dq_xml_filename(xml_root, ifo, gps_start, duration) glue.utils.mkdir_p(os.path.dirname(outname)) diff --git a/glue/bin/ligolw_veto_def_check b/glue/bin/ligolw_veto_def_check index a1662b0a6e5eee641a9fc66f7487f687b92a2427..baf30d8de5e41bf4a2396657f5df06839f4a1450 100755 --- a/glue/bin/ligolw_veto_def_check +++ b/glue/bin/ligolw_veto_def_check @@ -88,7 +88,7 @@ for filename in veto_def_files: # load the veto definer file(s) xmldoc = ligolw_add.ligolw_add( ligolw.Document(), analyzed_files.keys() ) -veto_def_table = table.get_table(xmldoc, lsctables.VetoDefTable.tableName) +veto_def_table = lsctables.VetoDefTable.get_table(xmldoc) # create summary_file directory in output directory to store files to if not os.path.exists( '%s/%s' %( opts.output_directory, 'summary_files' ) ): @@ -113,8 +113,8 @@ else: global_segment = segments.segment(opts.start_time, global_end_time) # add the original file's process info -origproctab = table.get_table(xmldoc, lsctables.ProcessTable.tableName) -newproctab = table.get_table(outdoc, lsctables.ProcessTable.tableName) +origproctab = lsctables.ProcessTable.get_table(xmldoc) +newproctab = lsctables.ProcessTable.get_table(outdoc) for proc in origproctab: newproc = lsctables.Process() for x in newproc.__slots__: diff --git a/glue/glue/ligolw/lsctables.py b/glue/glue/ligolw/lsctables.py index 89ed729719f1d12713413c077f00a57168e1d525..dd8396f5a367d866abda2a68cd6607d4ec2a2f30 100644 --- a/glue/glue/ligolw/lsctables.py +++ b/glue/glue/ligolw/lsctables.py @@ -114,17 +114,17 @@ def New(Type, columns = None, **kwargs): </Table> """ new = Type(sax.xmlreader.AttributesImpl({u"Name": Type.tableName}), **kwargs) - colnamefmt = u":".join(Type.tableName.split(":")[:-1]) + u":%s" + colnamefmt = new.Name + u":%s" if columns is not None: for key in columns: if key not in new.validcolumns: - raise ligolw.ElementError("invalid Column '%s' for Table '%s'" % (key, new.tableName)) + raise ligolw.ElementError("invalid Column '%s' for Table '%s'" % (key, new.Name)) new.appendChild(table.Column(sax.xmlreader.AttributesImpl({u"Name": colnamefmt % key, u"Type": new.validcolumns[key]}))) else: for key, value in new.validcolumns.items(): new.appendChild(table.Column(sax.xmlreader.AttributesImpl({u"Name": colnamefmt % key, u"Type": value}))) new._end_of_columns() - new.appendChild(table.TableStream(sax.xmlreader.AttributesImpl({u"Name": Type.tableName, u"Delimiter": table.TableStream.Delimiter.default, u"Type": table.TableStream.Type.default}))) + new.appendChild(table.TableStream(sax.xmlreader.AttributesImpl({u"Name": new.getAttribute(u"Name"), u"Delimiter": table.TableStream.Delimiter.default, u"Type": table.TableStream.Type.default}))) return new diff --git a/glue/glue/segmentdb/logic.py b/glue/glue/segmentdb/logic.py index 3afa354d10bb60805ff62f8b46433fe89d89afd4..6a7ccf9101060169bfba102e2da58955aa282fe9 100644 --- a/glue/glue/segmentdb/logic.py +++ b/glue/glue/segmentdb/logic.py @@ -71,7 +71,7 @@ def run_file_operation(outdoc, filenames, use_segment_table, operation, preserve etc """ - proc_id = table.get_table(outdoc, lsctables.ProcessTable.tableName)[0].process_id + proc_id = lsctables.ProcessTable.get_table(outdoc)[0].process_id # load up the files into individual documents xmldocs = [ligolw_add.ligolw_add(ligolw.Document(), [fname]) for fname in filenames] @@ -86,7 +86,7 @@ def run_file_operation(outdoc, filenames, use_segment_table, operation, preserve return key for xmldoc in xmldocs: - seg_def_table = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) + seg_def_table = lsctables.SegmentDefTable.get_table(xmldoc) map (register_definer, seg_def_table) # For each unique segment definer, find the intersection @@ -146,7 +146,7 @@ def run_segment_operation(outdoc, filenames, segments, use_segment_table, operat etc """ - proc_id = table.get_table(outdoc, lsctables.ProcessTable.tableName)[0].process_id + proc_id = lsctables.ProcessTable.get_table(outdoc)[0].process_id if preserve: indoc = ligolw_add.ligolw_add(outdoc, filenames) diff --git a/glue/glue/segmentdb/segmentdb_utils.py b/glue/glue/segmentdb/segmentdb_utils.py index 82266f35e9e5ea320a6c2673845b7c216ca6558b..7d1e1c763de942fd766543336095a379198573da 100644 --- a/glue/glue/segmentdb/segmentdb_utils.py +++ b/glue/glue/segmentdb/segmentdb_utils.py @@ -313,16 +313,16 @@ def find_segments(doc, key, use_segment_table = True): filter_func = lambda x: str(x.ifos) == key_pieces[0] and (str(x.name) == key_pieces[1] or key_pieces[1] == '*') and (str(x.version) == key_pieces[2] or key_pieces[2] == '*') # Find all segment definers matching the critieria - seg_def_table = table.get_table(doc, lsctables.SegmentDefTable.tableName) + seg_def_table = lsctables.SegmentDefTable.get_table(doc) seg_defs = filter(filter_func, seg_def_table) seg_def_ids = map(lambda x: str(x.segment_def_id), seg_defs) # Find all segments belonging to those definers if use_segment_table: - seg_table = table.get_table(doc, lsctables.SegmentTable.tableName) + seg_table = lsctables.SegmentTable.get_table(doc) seg_entries = filter(lambda x: str(x.segment_def_id) in seg_def_ids, seg_table) else: - seg_sum_table = table.get_table(doc, lsctables.SegmentSumTable.tableName) + seg_sum_table = lsctables.SegmentSumTable.get_table(doc) seg_entries = filter(lambda x: str(x.segment_def_id) in seg_def_ids, seg_sum_table) # Combine into a segmentlist @@ -363,7 +363,7 @@ def ensure_segment_table(connection): def add_to_segment_definer(xmldoc, proc_id, ifo, name, version, comment=''): try: - seg_def_table = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) + seg_def_table = lsctables.SegmentDefTable.get_table(xmldoc) except: seg_def_table = lsctables.New(lsctables.SegmentDefTable, columns = ["process_id", "segment_def_id", "ifos", "name", "version", "comment"]) xmldoc.childNodes[0].appendChild(seg_def_table) @@ -385,7 +385,7 @@ def add_to_segment_definer(xmldoc, proc_id, ifo, name, version, comment=''): def add_to_segment(xmldoc, proc_id, seg_def_id, sgmtlist): try: - segtable = table.get_table(xmldoc, lsctables.SegmentTable.tableName) + segtable = lsctables.SegmentTable.get_table(xmldoc) except: segtable = lsctables.New(lsctables.SegmentTable, columns = ["process_id", "segment_def_id", "segment_id", "start_time", "start_time_ns", "end_time", "end_time_ns"]) xmldoc.childNodes[0].appendChild(segtable) @@ -405,7 +405,7 @@ def add_to_segment(xmldoc, proc_id, seg_def_id, sgmtlist): def add_to_segment_summary(xmldoc, proc_id, seg_def_id, sgmtlist, comment=''): try: - seg_sum_table = table.get_table(xmldoc, lsctables.SegmentSumTable.tableName) + seg_sum_table = lsctables.SegmentSumTable.get_table(xmldoc) except: seg_sum_table = lsctables.New(lsctables.SegmentSumTable, columns = ["process_id", "segment_def_id", "segment_sum_id", "start_time", "start_time_ns", "end_time", "end_time_ns", "comment"]) xmldoc.childNodes[0].appendChild(seg_sum_table) diff --git a/lalapps/src/inspiral/combinedFAR.py b/lalapps/src/inspiral/combinedFAR.py index ba9f11c0318573cff8fde6c5ce7ab4b2417f8c35..e073318215bf6d1acaf2d37393dae9d4489acf82 100755 --- a/lalapps/src/inspiral/combinedFAR.py +++ b/lalapps/src/inspiral/combinedFAR.py @@ -373,7 +373,7 @@ while not flag: try: outputFile=utils.load_filename(corsefiles[integ],\ gz=corsefiles[integ].endswith('.gz')) - origtbl = tab.get_table(outputFile, lsctables.SnglInspiralTable.tableName) + origtbl = lsctables.SnglInspiralTable.get_table(outputFile) flag = True except: integ = integ + 1 @@ -384,7 +384,7 @@ utils.write_filename(outputFile,opts.output_file, \ if opts.min_rate: for trig in loudestTrig: trig.alpha = trig.alpha / (FrgrndTime/3.15567360E7) - newtbl = tab.get_table(outputFile, lsctables.SnglInspiralTable.tableName) + newtbl = lsctables.SnglInspiralTable.get_table(outputFile) parent = newtbl.parentNode parent.replaceChild(loudestTrig,newtbl) utils.write_filename(outputFile,opts.output_file_loudest, \ diff --git a/lalapps/src/inspiral/lalapps_cbc_sbank.py b/lalapps/src/inspiral/lalapps_cbc_sbank.py index ccb2afca97ed9bd9cfc072d534b19e19f2674eac..00b32952b9b9283c0c9f60ab95898a71fcec0ced 100644 --- a/lalapps/src/inspiral/lalapps_cbc_sbank.py +++ b/lalapps/src/inspiral/lalapps_cbc_sbank.py @@ -366,7 +366,7 @@ for file_approx in opts.bank_seed: # add templates to bank tmpdoc = utils.load_filename(seed_file, contenthandler=ContentHandler) - sngl_inspiral = table.get_table(tmpdoc, lsctables.SnglInspiralTable.tableName) + sngl_inspiral = lsctables.SnglInspiralTable.get_table(tmpdoc) seed_waveform = waveforms[approx] bank.add_from_sngls(sngl_inspiral, seed_waveform) @@ -386,7 +386,7 @@ if opts.verbose: if opts.checkpoint and os.path.exists( fout + "_checkpoint.gz" ): xmldoc = utils.load_filename(fout + "_checkpoint.gz", contenthandler=ContentHandler) - tbl = table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + tbl = lsctables.SnglInspiralTable.get_table(xmldoc) [bank.insort(t) for t in Bank.from_sngls(tbl, tmplt_class, noise_model, opts.flow, opts.use_metric, opts.cache_waveforms, opts.neighborhood_size, opts.neighborhood_param, coarse_match_df=opts.coarse_match_df, iterative_match_df_max=opts.iterative_match_df_max, fhigh_max=opts.fhigh_max)] if opts.verbose: @@ -429,7 +429,7 @@ process = ligolw_process.register_to_xmldoc(xmldoc, "lalapps_cbc_sbank", if opts.trial_waveforms: trialdoc = utils.load_filename(opts.trial_waveforms, contenthandler=ContentHandler, gz=opts.trial_waveforms.endswith('.gz')) - trial_sngls = table.get_table(trialdoc, lsctables.SnglInspiralTable.tableName) + trial_sngls = lsctables.SnglInspiralTable.get_table(trialdoc) proposal = [tmplt_class.from_sngl(t, bank=bank) for t in trial_sngls] else: diff --git a/lalapps/src/inspiral/lalapps_cbc_sbank_choose_mchirp_boundaries.py b/lalapps/src/inspiral/lalapps_cbc_sbank_choose_mchirp_boundaries.py index 2e2539bc976501271dc729a16ab0354ea971e775..ce351244b3cb505575961472b5f7f583c8f1d0d0 100644 --- a/lalapps/src/inspiral/lalapps_cbc_sbank_choose_mchirp_boundaries.py +++ b/lalapps/src/inspiral/lalapps_cbc_sbank_choose_mchirp_boundaries.py @@ -67,7 +67,7 @@ templates = None for filename in filenames: xmldoc = utils.load_filename(filename, verbose=options.verbose, contenthandler=ContentHandler) - curr_tmps = table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + curr_tmps = lsctables.SnglInspiralTable.get_table(xmldoc) if templates is None: templates = curr_tmps else: diff --git a/lalapps/src/inspiral/lalapps_cbc_sbank_sim.py b/lalapps/src/inspiral/lalapps_cbc_sbank_sim.py index 34f97ba290d02c93b8eaa5d7327e5ee650fce23f..fe43561be98170f4085111e18837014e1034d3de 100644 --- a/lalapps/src/inspiral/lalapps_cbc_sbank_sim.py +++ b/lalapps/src/inspiral/lalapps_cbc_sbank_sim.py @@ -67,8 +67,8 @@ def ligolw_copy_process(xmldoc_src, xmldoc_dest): We want to copy over process and process_params tables to eventually merge them. """ - proc = table.get_table(xmldoc_src, lsctables.ProcessTable.tableName) - pp = table.get_table(xmldoc_src, lsctables.ProcessParamsTable.tableName) + proc = lsctables.ProcessTable.get_table(xmldoc_src) + pp = lsctables.ProcessParamsTable.get_table(xmldoc_src) xmldoc_dest.appendChild(ligolw.LIGO_LW()) xmldoc_dest.childNodes[-1].appendChild(proc) @@ -155,7 +155,7 @@ for file_approx in opts.template_bank: # add templates to bank tmpdoc = utils.load_filename(seed_file, contenthandler=ContentHandler) - sngl_inspiral = table.get_table(tmpdoc, lsctables.SnglInspiralTable.tableName) + sngl_inspiral = lsctables.SnglInspiralTable.get_table(tmpdoc) seed_waveform = waveforms[approx] bank.add_from_sngls(sngl_inspiral, seed_waveform) @@ -180,7 +180,7 @@ del sngls[:] # pick injection parameters xmldoc2 = utils.load_filename(inj_file, contenthandler=ContentHandler) ligolw_copy_process(xmldoc2, fake_xmldoc) -sims = table.get_table(xmldoc2, lsctables.SimInspiralTable.tableName) +sims = lsctables.SimInspiralTable.get_table(xmldoc2) # # sometime inspinj doesn't give us everything we want, so we give the @@ -233,11 +233,11 @@ ligolw_process.set_process_end_time(process) # output h5file.create_dataset("/match_map", data=match_map, compression='gzip', compression_opts=1) -proc = table.get_table(fake_xmldoc, lsctables.ProcessTable.tableName) +proc = lsctables.ProcessTable.get_table(fake_xmldoc) for p in proc: p.cvs_entry_time = 0 p.end_time = 0 h5file.create_dataset("/process", data=ligolw_table_to_array(proc)) -pp = table.get_table(fake_xmldoc, lsctables.ProcessParamsTable.tableName) +pp = lsctables.ProcessParamsTable.get_table(fake_xmldoc) h5file.create_dataset("/process_params", data=ligolw_table_to_array(pp)) h5file.close() diff --git a/lalapps/src/inspiral/lalapps_cbc_sbank_splitter.py b/lalapps/src/inspiral/lalapps_cbc_sbank_splitter.py index 537213524aefb4271bac2e715aad7484028b0753..936ea4320878b5611c1b071f50e7be66c16bb084 100644 --- a/lalapps/src/inspiral/lalapps_cbc_sbank_splitter.py +++ b/lalapps/src/inspiral/lalapps_cbc_sbank_splitter.py @@ -58,8 +58,8 @@ opts_dict = dict((k, v) for k, v in options.__dict__.iteritems() if v is not Fal for fname in filenames: xmldoc=utils.load_filename(fname, gz=fname.endswith(".gz"), verbose = options.verbose, contenthandler=ContentHandler) - sngl_inspiral_table=lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) - process_params_table = lsctables.table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName) + sngl_inspiral_table=lsctables.SnglInspiralTable.get_table(xmldoc) + process_params_table = lsctables.ProcessParamsTable.get_table(xmldoc) # Prepare process table with information about the current program process = ligolw_process.register_to_xmldoc(xmldoc, diff --git a/lalapps/src/inspiral/lalapps_ihope_daily_page.py b/lalapps/src/inspiral/lalapps_ihope_daily_page.py index 482641f9a6152478bdf0a9c9e76a12c50cca649f..f5523d124cbbfd08a1ebb44a81deadf3886cc120 100644 --- a/lalapps/src/inspiral/lalapps_ihope_daily_page.py +++ b/lalapps/src/inspiral/lalapps_ihope_daily_page.py @@ -459,7 +459,7 @@ def make_veto_files(engine, config, ifo, category, cluster, start_time, end_time for f in config['veto_definer_file'].split(','): xmldoc = utils.load_url(f, contenthandler=DefaultContentHandler) - veto_definers += table.get_table(xmldoc, lsctables.VetoDefTable.tableName) + veto_definers += lsctables.VetoDefTable.get_table(xmldoc) cats = [make_segdef(row, overall) for row in veto_definers if row.category == category and row.ifo == ifo] diff --git a/lalapps/src/inspiral/lalapps_trigger_hipe.py b/lalapps/src/inspiral/lalapps_trigger_hipe.py index c61f3ad7523882511e2ebd2256d8b96d3f0c87ee..dc899dad233955d2088b8d6bf5a08584bd80c535 100644 --- a/lalapps/src/inspiral/lalapps_trigger_hipe.py +++ b/lalapps/src/inspiral/lalapps_trigger_hipe.py @@ -194,7 +194,7 @@ def createInjectionFile(hipe_dir, cp, cpinj, injrun, injection_segment, # read in the file and the tables doc = utils.load_filename(new_injFile, contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - sims = table.get_table(doc, lsctables.SimInspiralTable.tableName) + sims = lsctables.SimInspiralTable.get_table(doc) return sims, injInterval, numberInjections, new_injFile @@ -613,7 +613,7 @@ if not opts.grb_file and (not opts.time or not opts.name): if opts.grb_file: xmldoc = utils.load_filename(opts.grb_file, gz=opts.grb_file.endswith('.gz'), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - ext_table = table.get_table(xmldoc,lsctables.ExtTriggersTable.tableName) + ext_table = lsctables.ExtTriggersTable.get_table(xmldoc) grb_time = ext_table[0].start_time grb_name = os.path.basename(opts.grb_file)[3:-4] grb_ra = ext_table[0].event_ra diff --git a/lalapps/src/inspiral/lalapps_write_ihope_page.py b/lalapps/src/inspiral/lalapps_write_ihope_page.py index df5dc5c9faacdf1ad4f339f3b31744f68e32d143..5c996b25e39e7adc79ded04cd12c4467ae588b27 100644 --- a/lalapps/src/inspiral/lalapps_write_ihope_page.py +++ b/lalapps/src/inspiral/lalapps_write_ihope_page.py @@ -2022,7 +2022,7 @@ def get_segments_tag(tag): # read segments from science segments xml file scifile = datadir + '/segments/' + ifo + '-SCIENCE_SEGMENTS-' + opts.gps_start_time + '-' + opts.duration + '.xml' scifile_xmldoc, digest = utils.load_fileobj(open(scifile, 'r'), contenthandler=ContentHandler) - scifile_segtable = table.get_table(scifile_xmldoc, lsctables.SegmentTable.tableName) + scifile_segtable = lsctables.SegmentTable.get_table(scifile_xmldoc) scifile_seglist = segments.segmentlist() for seg in scifile_segtable: endtime = seg.end_time + seg.end_time_ns * 10**(-9) @@ -2032,7 +2032,7 @@ def get_segments_tag(tag): # read segments from tag xml file file = datadir + '/segments/' + ifo + this_tag file_xmldoc, digest = utils.load_fileobj(open(file, 'r'), contenthandler=ContentHandler) - file_segtable = table.get_table(file_xmldoc, lsctables.SegmentTable.tableName) + file_segtable = lsctables.SegmentTable.get_table(file_xmldoc) file_seglist = segments.segmentlist() for seg in file_segtable: endtime = seg.end_time + seg.end_time_ns * 10**(-9) diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/bank_splitter b/lalapps/src/inspiral/s5_highmass_upper_limit/bank_splitter index 27c72ea1f2f4464820bf24ee9bbcfa054dee7dfd..cb8c3906541e3194b701bcd614d84378f0693259 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/bank_splitter +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/bank_splitter @@ -40,9 +40,9 @@ options_params=[("--filename","string",filenames),("--output_path","string", opt for file in filenames: xmldoc=utils.load_filename(filenames[0], gz=filenames[0].endswith(".gz"), verbose = options.verbose) - sngl_inspiral_table=lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) - process_params_table = lsctables.table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName) - tmpltbank_process_ids = lsctables.table.get_table(xmldoc, lsctables.ProcessTable.tableName).get_ids_by_program("tmpltbank") + sngl_inspiral_table=lsctables.SnglInspiralTable.get_table(xmldoc) + process_params_table = lsctables.ProcessParamsTable.get_table(xmldoc) + tmpltbank_process_ids = lsctables.ProcessTable.get_table(xmldoc).get_ids_by_program("tmpltbank") if options.add_f_final: for row in process_params_table: diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/convertROOT.py b/lalapps/src/inspiral/s5_highmass_upper_limit/convertROOT.py index c565a52ef41cbd7e449ff936ff2d6a055dc28f03..ebab45677e4f99cd28ec522fa781b138cb87bd2c 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/convertROOT.py +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/convertROOT.py @@ -92,7 +92,7 @@ def create_tables(xmldoc, rootfiles): xmldoc.childNodes[0].appendChild(coinc_event_map_table) do_process_table(xmldoc, sim_tree, liv_tree) - process_index = dict((int(row.process_id), row) for row in table.get_table(xmldoc, lsctables.ProcessTable.tableName)) + process_index = dict((int(row.process_id), row) for row in lsctables.ProcessTable.get_table(xmldoc)) do_summary_table(xmldoc, sim_tree, liv_tree) @@ -181,7 +181,7 @@ def get_multi_burst_row(multi_burst_table, sim_tree): def do_process_table(xmldoc, sim_tree, liv_tree): try: - process_table = table.get_table(xmldoc, lsctables.ProcessTable.tableName) + process_table = lsctables.ProcessTable.get_table(xmldoc) except ValueError: process_table = lsctables.New(lsctables.ProcessTable, ["process_id", "ifos", "comment", "program", "start_time", "jobid", @@ -216,7 +216,7 @@ def do_process_table(xmldoc, sim_tree, liv_tree): def do_summary_table(xmldoc, sim_tree, liv_tree): try: - search_summary = table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName) + search_summary = lsctables.SearchSummaryTable.get_table(xmldoc) except ValueError: search_summary = lsctables.New(lsctables.SearchSummaryTable, ["process_id", "nevents", "ifos", "comment", "in_start_time", @@ -224,7 +224,7 @@ def do_summary_table(xmldoc, sim_tree, liv_tree): "in_end_time", "in_end_time_ns", "out_end_time", "out_end_time_ns"]) xmldoc.childNodes[0].appendChild(search_summary) - process_id_type = type(table.get_table(xmldoc, lsctables.ProcessTable.tableName).next_id) + process_id_type = lsctables.ProcessID runids = set() for i in range(0, sim_tree.GetEntries()) : diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/fix_missing_sngl_inspiral.py b/lalapps/src/inspiral/s5_highmass_upper_limit/fix_missing_sngl_inspiral.py index 86564d88074f45eab06dad487b81e66db9834fa1..8e119d1b1010fdb6ac487479027a5e1c9e9708ca 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/fix_missing_sngl_inspiral.py +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/fix_missing_sngl_inspiral.py @@ -5,7 +5,7 @@ from glue.ligolw import lsctables, utils for filename in (CacheEntry(line).path for line in file(sys.argv[1])): xmldoc = utils.load_filename(filename, gz = (filename or "stdin").endswith(".gz")) try: - lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + lsctables.SnglInspiralTable.get_table(xmldoc) except ValueError: xmldoc.childNodes[-1].appendChild(lsctables.New(lsctables.SnglInspiralTable, columns = ("process_id", "ifo", "search", "channel", "end_time", "end_time_ns", "end_time_gmst", "impulse_time", "impulse_time_ns", "template_duration", "event_duration", "amplitude", "eff_distance", "coa_phase", "mass1", "mass2", "mchirp", "mtotal", "eta", "kappa", "chi", "tau0", "tau2", "tau3", "tau4", "tau5", "ttotal", "psi0", "psi3", "alpha", "alpha1", "alpha2", "alpha3", "alpha4", "alpha5", "alpha6", "beta", "f_final", "snr", "chisq", "chisq_dof", "bank_chisq", "bank_chisq_dof", "cont_chisq", "cont_chisq_dof", "sigmasq", "rsqveto_duration", "Gamma0", "Gamma1", "Gamma2", "Gamma3", "Gamma4", "Gamma5", "Gamma6", "Gamma7", "Gamma8", "Gamma9", "event_id"))) utils.write_filename(filename, xmldoc, gz = (filename or "stdout").endswith(".gz")) diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/hm_upperlimit.py b/lalapps/src/inspiral/s5_highmass_upper_limit/hm_upperlimit.py index 5982c9c8b3745ca5e750968550d34b052876a433..b7928f5acb86e366195fd7128371f8067f61a386 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/hm_upperlimit.py +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/hm_upperlimit.py @@ -60,7 +60,7 @@ class upper_limit(object): # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -245,7 +245,7 @@ class upper_limit(object): connection = sqlite3.connect(working_filename) connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName)._row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection))._row_from_cols for values in connection.cursor().execute(""" SELECT diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/imr_missed_found.py b/lalapps/src/inspiral/s5_highmass_upper_limit/imr_missed_found.py index 6da28c9e9e75590a6782acd0f52d21f9854d5166..6078d6bd09ce7187cc3ce78cc22166cdaf4e1108 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/imr_missed_found.py +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/imr_missed_found.py @@ -52,7 +52,7 @@ class Summary(object): # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -61,11 +61,11 @@ class Summary(object): # FIGURE OUT IF IT IS A BURST OR INSPIRAL RUN try: - self.multi_burst_table = table.get_table(xmldoc, dbtables.lsctables.MultiBurstTable.tableName) + self.multi_burst_table = dbtables.lsctables.MultiBurstTable.get_table(xmldoc) except ValueError: self.multi_burst_table = None try: - self.coinc_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.CoincInspiralTable.tableName) + self.coinc_inspiral_table = dbtables.lsctables.CoincInspiralTable.get_table(xmldoc) except ValueError: self.coinc_inspiral_table = None if self.multi_burst_table and self.coinc_inspiral_table: @@ -147,7 +147,7 @@ class Summary(object): return lsctables.LIGOTimeGPS(geocent_end_time, geocent_end_time_ns) in zero_lag_segments connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols # INSPIRAL if self.coinc_inspiral_table: diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/imr_volume.py b/lalapps/src/inspiral/s5_highmass_upper_limit/imr_volume.py index 0fce3496bab45abd251d02e7096f36765da964e1..8a2fac2eace999df0955fc28834ecdde80a69686 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/imr_volume.py +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/imr_volume.py @@ -132,7 +132,7 @@ def get_injections(injfnames, FAR, zero_lag_segments, verbose = False): connection = sqlite3.connect(working_filename) connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName)._row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection))._row_from_cols for values in connection.cursor().execute(""" SELECT diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/lvstat.py b/lalapps/src/inspiral/s5_highmass_upper_limit/lvstat.py index 8f12a53314dd774319394e5357b064a052673eb9..e295a45346878e984b2b932862410b4058b03a30 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/lvstat.py +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/lvstat.py @@ -66,7 +66,7 @@ def get_injections(injfnames, zero_lag_segments, ifos="H1,H2,L1", FAR=1.0, verbo connection = sqlite3.connect(working_filename) connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName)._row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection))._row_from_cols # FIXME may not be done correctly if injections are done in timeslides # FIXME may not be done correctly if injections aren't logarithmic in d diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/make_adhoc_imr_bank b/lalapps/src/inspiral/s5_highmass_upper_limit/make_adhoc_imr_bank index 9596ace293d1cd969f49ac0b04e09d5ad2c85286..ac02eb30e18d093f24eb6da446a205c6ee56e533 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/make_adhoc_imr_bank +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/make_adhoc_imr_bank @@ -62,9 +62,9 @@ print options options_params=[("--filename","string",filenames),("--output_path","string", options.output_path), ("--max-symmetric-mass-ratio","int",options.max_symmetric_mass_ratio),("--n","int",options.n),("--sort-by","string",options.sort_by)] xmldoc=utils.load_filename(filenames[0], gz=filenames[0].endswith(".gz"), verbose = options.verbose) -sngl_inspiral_table=lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) -process_params_table = lsctables.table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName) -tmpltbank_process_ids = lsctables.table.get_table(xmldoc, lsctables.ProcessTable.tableName).get_ids_by_program("tmpltbank") +sngl_inspiral_table=lsctables.SnglInspiralTable.get_table(xmldoc) +process_params_table = lsctables.ProcessParamsTable.get_table(xmldoc) +tmpltbank_process_ids = lsctables.ProcessTable.get_table(xmldoc).get_ids_by_program("tmpltbank") for row in process_params_table: if row.process_id in tmpltbank_process_ids and row.param=='--approximant': diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/missed_found.py b/lalapps/src/inspiral/s5_highmass_upper_limit/missed_found.py index 6bf644912fec4a5206ee8c40aba61465ea9ae086..72ea78ca5c5b5a75704ed0ddbacd2049845e682d 100644 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/missed_found.py +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/missed_found.py @@ -50,7 +50,7 @@ class Summary(object): # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -59,11 +59,11 @@ class Summary(object): # FIGURE OUT IF IT IS A BURST OR INSPIRAL RUN try: - self.multi_burst_table = table.get_table(xmldoc, dbtables.lsctables.MultiBurstTable.tableName) + self.multi_burst_table = dbtables.lsctables.MultiBurstTable.get_table(xmldoc) except ValueError: self.multi_burst_table = None try: - self.coinc_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.CoincInspiralTable.tableName) + self.coinc_inspiral_table = dbtables.lsctables.CoincInspiralTable.get_table(xmldoc) except ValueError: self.coinc_inspiral_table = None if self.multi_burst_table and self.coinc_inspiral_table: @@ -145,7 +145,7 @@ class Summary(object): return lsctables.LIGOTimeGPS(geocent_end_time, geocent_end_time_ns) in zero_lag_segments connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols # INSPIRAL if self.coinc_inspiral_table: diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/mvsc_get_doubles.py b/lalapps/src/inspiral/s5_highmass_upper_limit/mvsc_get_doubles.py index cfe861828874f4af7755696fc7d2b16d489a953a..2675fe2c07d74d35f8f3c26d6dd09b02bf9326fa 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/mvsc_get_doubles.py +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/mvsc_get_doubles.py @@ -52,7 +52,7 @@ for database in databases: cursor = connection.cursor() # to determine whether or not the database is full of timeslides/zerolag or injections, check if there exists a sim_inspiral table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) is_injections = True except ValueError: is_injections = False @@ -112,7 +112,7 @@ for database in databases: if not is_injections: rings = db_thinca_rings.get_thinca_rings_by_available_instruments(connection) - offset_vectors = dbtables.lsctables.table.get_table(dbtables.get_xml(connection), dbtables.lsctables.TimeSlideTable.tableName).as_dict() + offset_vectors = dbtables.lsctables.TimeSlideTable.get_table(dbtables.get_xml(connection)).as_dict() def calc_delta_t(trigger1_ifo, trigger1_end_time, trigger1_end_time_ns, trigger2_ifo, trigger2_end_time, trigger2_end_time_ns, time_slide_id, rings = rings, offset_vectors = offset_vectors): print >>sys.stderr, "calculating delta_t" diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/prepareBank4IMRSA b/lalapps/src/inspiral/s5_highmass_upper_limit/prepareBank4IMRSA index f7e0928444de648805354dea11d865f28b4c8734..dc15da005b0746e571e34cef28ad5e13e4a54827 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/prepareBank4IMRSA +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/prepareBank4IMRSA @@ -52,9 +52,9 @@ x_vector=numpy.linspace(-0.85, 0.85, options.chi_n) for file in filenames: xmldoc=utils.load_filename(file, gz=file.endswith(".gz"), verbose = options.verbose) - sngl_inspiral_table=lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) - process_params_table = lsctables.table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName) - tmpltbank_process_ids = lsctables.table.get_table(xmldoc, lsctables.ProcessTable.tableName).get_ids_by_program("tmpltbank") + sngl_inspiral_table=lsctables.SnglInspiralTable.get_table(xmldoc) + process_params_table = lsctables.ProcessParamsTable.get_table(xmldoc) + tmpltbank_process_ids = lsctables.ProcessTable.get_table(xmldoc).get_ids_by_program("tmpltbank") for row in process_params_table: if row.process_id in tmpltbank_process_ids and row.param=='--approximant': diff --git a/lalapps/src/inspiral/s5_highmass_upper_limit/ring_post b/lalapps/src/inspiral/s5_highmass_upper_limit/ring_post index ea3095a585f41d5256f8b11c36667de5c1b069a7..3ecb0bbffffebbe6b18616835377a50ace56f74d 100755 --- a/lalapps/src/inspiral/s5_highmass_upper_limit/ring_post +++ b/lalapps/src/inspiral/s5_highmass_upper_limit/ring_post @@ -68,7 +68,7 @@ class Tisi(object): def make_doc(self, options): while self.time_slides: doc = self.new_doc() - timeslidetable = table.get_table(doc, lsctables.TimeSlideTable.tableName) + timeslidetable = lsctables.TimeSlideTable.get_table(doc) process = ligolw_tisi.append_process(doc, **options.__dict__) N = int(round(float(len(self.time_slides)) / len(self.filenames))) while N: diff --git a/lalapps/src/inspiral/simulate_galaxies.py b/lalapps/src/inspiral/simulate_galaxies.py index 1c56be1feab90d07248a6f26f82a45d3bfe18676..c58a7e83ccf2a6b68a8d71c2491964d4b20abef8 100755 --- a/lalapps/src/inspiral/simulate_galaxies.py +++ b/lalapps/src/inspiral/simulate_galaxies.py @@ -114,8 +114,7 @@ bbhinjFile = "HL-INJECTIONS_123-729273613-5094000.xml" doc = utils.load_filename(bbhinjFile) sims = None try: - simInspiralTable = \ - table.get_table(doc, lsctables.SimInspiralTable.tableName) + simInspiralTable = lsctables.SimInspiralTable.get_table(doc) sims = simInspiralTable except: simInspiralTable = None sims.sort(lambda a, b: cmp(a.distance, b.distance)) diff --git a/pylal/bin/cbcBayesBurstPPAnalysis.py b/pylal/bin/cbcBayesBurstPPAnalysis.py index f87865fc33ace40fef4cf75e67f4e3b7f21c5a37..826eb6a4293865491853d5d48a2430e490b5bcf3 100644 --- a/pylal/bin/cbcBayesBurstPPAnalysis.py +++ b/pylal/bin/cbcBayesBurstPPAnalysis.py @@ -238,8 +238,7 @@ if __name__ == '__main__': (options, args) = parser.parse_args() - injs = table.get_table(utils.load_filename(options.injxml,contenthandler=LIGOLWContentHandlerExtractSimBurstTable), - lsctables.SimBurstTable.tableName) + injs = lsctables.SimBurstTable.get_table(utils.load_filename(options.injxml,contenthandler=LIGOLWContentHandlerExtractSimBurstTable)) if options.par == []: parameters = ['frequency', 'quality', 'hrss', 'ra', 'dec', 'psi', 'time', 'alpha','polar_eccentricity'] diff --git a/pylal/bin/cbcBayesBurstPostProc.py b/pylal/bin/cbcBayesBurstPostProc.py index f8ba8b0a8b23cedbacae6a314e9df31144d375bc..0e4ab36ead9b3fbc0a2b6c091698957209a7d688 100755 --- a/pylal/bin/cbcBayesBurstPostProc.py +++ b/pylal/bin/cbcBayesBurstPostProc.py @@ -320,10 +320,10 @@ def cbcBayesBurstPostProc( got_burst_table=1 try: lsctables.use_in(LIGOLWContentHandlerExtractSimBurstTable) - simtable=table.get_table(xmldoc,lsctables.SimBurstTable.tableName) + simtable=lsctables.SimBurstTable.get_table(xmldoc) except ValueError: lsctables.use_in(LIGOLWContentHandlerExtractSimInspiralTable) - simtable=table.get_table(xmldoc,lsctables.SimInspiralTable.tableName) + simtable=lsctables.SimInspiralTable.get_table(xmldoc) got_inspiral_table=1 got_burst_table=0 diff --git a/pylal/bin/cbcBayesPPAnalysis.py b/pylal/bin/cbcBayesPPAnalysis.py index 7e7ee7dc8bf0009634422a01f165281929ef830d..a7fe869b77ddda4ed47a62a0d648fe19f82323b8 100755 --- a/pylal/bin/cbcBayesPPAnalysis.py +++ b/pylal/bin/cbcBayesPPAnalysis.py @@ -241,7 +241,7 @@ if __name__ == '__main__': (options, args) = parser.parse_args() - injs = table.get_table(utils.load_filename(options.injxml,contenthandler=ExtractSimInspiralTableLIGOLWContentHandler),lsctables.SimInspiralTable.tableName) + injs = lsctables.SimInspiralTable.get_table(utils.load_filename(options.injxml,contenthandler=ExtractSimInspiralTableLIGOLWContentHandler)) if options.par == []: parameters = ['m1', 'm2', 'mc', 'eta', 'q', 'theta_jn', 'a1', 'a2', 'tilt1', 'tilt2', 'phi12', 'phi_jl', 'ra', 'dec', 'distance', 'time', 'phi_orb', 'psi'] diff --git a/pylal/bin/cbcBayesPostProc.py b/pylal/bin/cbcBayesPostProc.py index 46f1b2e2d33d075257e73ac1719c53cec2c15ccf..409b2feeda192ca345c8f731b88c7f573616112a 100755 --- a/pylal/bin/cbcBayesPostProc.py +++ b/pylal/bin/cbcBayesPostProc.py @@ -338,7 +338,7 @@ def cbcBayesPostProc( if injfile and eventnum is not None: print 'Looking for event %i in %s\n'%(eventnum,injfile) xmldoc = utils.load_filename(injfile,contenthandler=ExtractSimInspiralTableLIGOLWContentHandler) - siminspiraltable=lsctables.table.get_table(xmldoc,lsctables.SimInspiralTable.tableName) + siminspiraltable=lsctables.SimInspiralTable.get_table(xmldoc) injection=siminspiraltable[eventnum] #injections = SimInspiralUtils.ReadSimInspiralFromFiles([injfile]) #if(len(injections)!=1): raise RuntimeError('Error: something unexpected happened while loading the injection file!\n') diff --git a/pylal/bin/coh_PTF_efficiency b/pylal/bin/coh_PTF_efficiency index 3ca7dbe3684b5d640be6016eff0eb3dfff231fb0..2754203c4a0bf35195460f163f2d03260e08641c 100755 --- a/pylal/bin/coh_PTF_efficiency +++ b/pylal/bin/coh_PTF_efficiency @@ -274,7 +274,7 @@ def main(segdir, outdir, trigFile, foundFile, missedFile,\ # FIXME: This is nasty, we actually read the file twice, can we fix this? xmldoc = utils.load_filename(trigFile,gz=trigFile.endswith("gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - searchSumm = table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName) + searchSumm = lsctables.SearchSummaryTable.get_table(xmldoc) ifos = sorted(map(str,searchSumm[0].get_ifos())) ifoAtt = {'G1':'g', 'H1':'h1', 'H2':'h2', 'L1':'l', 'V1':'v', 'T1':'t'} diff --git a/pylal/bin/coh_PTF_inspiral_horizon b/pylal/bin/coh_PTF_inspiral_horizon index 874c003569b7dff26b4a4dde9a4ec9f355d71c94..03e35f7b682e5c396818ca29e7a6a0579e78f206 100755 --- a/pylal/bin/coh_PTF_inspiral_horizon +++ b/pylal/bin/coh_PTF_inspiral_horizon @@ -101,8 +101,8 @@ else: xmldoc = utils.load_filename( trigFile, gz=trigFile.endswith("gz" ), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) -trigs = table.get_table( xmldoc, lsctables.MultiInspiralTable.tableName ) -searchSumm = table.get_table( xmldoc, lsctables.SearchSummaryTable.tableName ) +trigs = lsctables.MultiInspiralTable.get_table( xmldoc ) +searchSumm = lsctables.SearchSummaryTable.get_table( xmldoc ) ifos = sorted( map( str, searchSumm[0].get_ifos() ) ) ifoAtt = { 'G1':'g', 'H1':'h1', 'H2':'h2', 'L1':'l', 'V1':'v', 'T1':'t' } diff --git a/pylal/bin/coh_PTF_sbv_plotter b/pylal/bin/coh_PTF_sbv_plotter index e25f01bf89c125331d68ed1ba6daecefb15bbabb..3739146339f580d8de579a198487cfa6a0ecf5e7 100755 --- a/pylal/bin/coh_PTF_sbv_plotter +++ b/pylal/bin/coh_PTF_sbv_plotter @@ -174,7 +174,7 @@ def main(trigFile, injFile, tag, outdir, segdir, chisq_index=4.0,\ # load file xmldoc = utils.load_filename(trigFile, gz=trigFile.endswith("gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - searchSumm = table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName) + searchSumm = lsctables.SearchSummaryTable.get_table(xmldoc) # extract IFOS ifos = sorted(map(str, searchSumm[0].get_ifos())) @@ -192,7 +192,7 @@ def main(trigFile, injFile, tag, outdir, segdir, chisq_index=4.0,\ vetoes.coalesce() # load triggers - tmp = table.get_table(xmldoc, lsctables.MultiInspiralTable.tableName) + tmp = lsctables.MultiInspiralTable.get_table(xmldoc) lsctables.MultiInspiralTable.loadcolumns =\ [slot for slot in tmp[0].__slots__ if hasattr(tmp[0], slot)] trigs = lsctables.New(lsctables.MultiInspiralTable,\ @@ -215,7 +215,7 @@ def main(trigFile, injFile, tag, outdir, segdir, chisq_index=4.0,\ if verbose: sys.stdout.write("\nLoading injections...\n") xmldoc = utils.load_filename(injFile, gz=injFile.endswith("gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - tmp = table.get_table(xmldoc, lsctables.MultiInspiralTable.tableName) + tmp = lsctables.MultiInspiralTable.get_table(xmldoc) injs = lsctables.New(lsctables.MultiInspiralTable,\ columns=lsctables.MultiInspiralTable.loadcolumns) injs.extend(t for t in tmp if t.get_end() not in vetoes) diff --git a/pylal/bin/coh_PTF_trig_combiner b/pylal/bin/coh_PTF_trig_combiner index ed56d8fe0f6f8864ce98ee18f8fa454d371ff35c..825f5788b169ef7efb044afc47d3fa3a7221208e 100755 --- a/pylal/bin/coh_PTF_trig_combiner +++ b/pylal/bin/coh_PTF_trig_combiner @@ -232,12 +232,9 @@ def main(cacheFile, ifoTag, userTag, segdir, outdir, grbTag=None, numTrials=6,\ # Also load the basic time slide table timeSlideDoc = utils.load_filename((cache[0]).path, gz=( (cache[0]).path ).endswith(".gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - timeSlideTable = table.get_table(timeSlideDoc, - lsctables.TimeSlideTable.tableName) - segmentTable = table.get_table(timeSlideDoc, - lsctables.SegmentTable.tableName) - timeSlideSegmentMap = table.get_table(timeSlideDoc, - lsctables.TimeSlideSegmentMapTable.tableName) + timeSlideTable = lsctables.TimeSlideTable.get_table(timeSlideDoc) + segmentTable = lsctables.SegmentTable.get_table(timeSlideDoc) + timeSlideSegmentMap = lsctables.TimeSlideSegmentMapTable.get_table(timeSlideDoc) else: trigs['ALL_TIMES'] = lsctables.New(lsctables.MultiInspiralTable,\ columns=lsctables.MultiInspiralTable.loadcolumns) diff --git a/pylal/bin/extractCommand b/pylal/bin/extractCommand index 096332df4f852594ee633199017d06af2f3fa0d6..c35b49f32d8bb9d8a863da714f92a0a424cfd13d 100755 --- a/pylal/bin/extractCommand +++ b/pylal/bin/extractCommand @@ -34,8 +34,8 @@ filename=argument doc = utils.load_filename(filename) # get the tables -procTable=table.get_table(doc, lsctables.ProcessTable.tableName) -procParamsTable=table.get_table(doc, lsctables.ProcessParamsTable.tableName) +procTable=lsctables.ProcessTable.get_table(doc) +procParamsTable=lsctables.ProcessParamsTable.get_table(doc) # extract the executable name executable=procTable[0].domain+'_'+procTable[0].program diff --git a/pylal/bin/imr_compare b/pylal/bin/imr_compare index f0ecb00b724cd082975331404553858f9fbcb7a0..34adab98adef84d383cfbe3fd51a20f98367b7f2 100755 --- a/pylal/bin/imr_compare +++ b/pylal/bin/imr_compare @@ -60,7 +60,7 @@ class Summary(object): # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -69,16 +69,16 @@ class Summary(object): # FIGURE OUT IF IT IS A BURST OR INSPIRAL RUN OR RINGDOWN RUN try: - self.multi_burst_table = table.get_table(xmldoc, dbtables.lsctables.MultiBurstTable.tableName) + self.multi_burst_table = dbtables.lsctables.MultiBurstTable.get_table(xmldoc) except ValueError: self.multi_burst_table = None try: - self.coinc_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.CoincInspiralTable.tableName) + self.coinc_inspiral_table = dbtables.lsctables.CoincInspiralTable.get_table(xmldoc) except ValueError: self.coinc_inspiral_table = None try: - self.coinc_ringdown_table = table.get_table(xmldoc, dbtables.lsctables.CoincRingdownTable.tableName) + self.coinc_ringdown_table = dbtables.lsctables.CoincRingdownTable.get_table(xmldoc) except ValueError: self.coinc_ringdown_table = None @@ -173,8 +173,8 @@ class Summary(object): return lsctables.LIGOTimeGPS(geocent_end_time, geocent_end_time_ns) in zero_lag_segments connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols - sims.extend(lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName)) + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols + sims.extend(lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection))) # INSPIRAL if self.coinc_inspiral_table: for values in connection.cursor().execute(""" diff --git a/pylal/bin/imr_roc b/pylal/bin/imr_roc index aebe3203f73fe0d235fd063fc7b01981b235521a..283ad5c2030cf502efdf9a8b4ef1dc44ddd42944 100755 --- a/pylal/bin/imr_roc +++ b/pylal/bin/imr_roc @@ -76,7 +76,7 @@ class upper_limit(object): sim = False # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -84,15 +84,15 @@ class upper_limit(object): # FIGURE OUT IF IT IS A BURST OR INSPIRAL RUN OR RINGDOWN RUN try: - self.multi_burst_table = table.get_table(xmldoc, dbtables.lsctables.MultiBurstTable.tableName) + self.multi_burst_table = dbtables.lsctables.MultiBurstTable.get_table(xmldoc) except ValueError: self.multi_burst_table = None try: - self.coinc_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.CoincInspiralTable.tableName) + self.coinc_inspiral_table = dbtables.lsctables.CoincInspiralTable.get_table(xmldoc) except ValueError: self.coinc_inspiral_table = None try: - self.coinc_ringdown_table = table.get_table(xmldoc, dbtables.lsctables.CoincRingdownTable.tableName) + self.coinc_ringdown_table = dbtables.lsctables.CoincRingdownTable.get_table(xmldoc) except ValueError: self.coinc_ringdown_table = None @@ -352,7 +352,7 @@ class upper_limit(object): return lsctables.LIGOTimeGPS(geocent_end_time, geocent_end_time_ns) in zero_lag_segments connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols # INSPIRAL if self.coinc_inspiral_table is not None: diff --git a/pylal/bin/lalapps_cbc_compute_rs b/pylal/bin/lalapps_cbc_compute_rs index 7848c2ee7461a76e06c56d5989c1b3b76df23392..1ec277cbf92cd08c760bcb4f55b0ef051ad7f5fb 100644 --- a/pylal/bin/lalapps_cbc_compute_rs +++ b/pylal/bin/lalapps_cbc_compute_rs @@ -340,9 +340,9 @@ class FileStats: def load_file(self): self.xmldoc = utils.load_filename( self.name, gz = self.name.endswith(".gz") ) - self.search_summ_table = table.get_table(self.xmldoc, lsctables.SearchSummaryTable.tableName) + self.search_summ_table = lsctables.SearchSummaryTable.get_table(self.xmldoc) try: - self.sngl_insp_table = table.get_table(self.xmldoc, lsctables.SnglInspiralTable.tableName) + self.sngl_insp_table = lsctables.SnglInspiralTable.get_table(self.xmldoc) except ValueError: self.sngl_insp_table = lsctables.New(lsctables.SnglInspiralTable) diff --git a/pylal/bin/lalapps_cbc_plotroc_ring b/pylal/bin/lalapps_cbc_plotroc_ring index 46df393d94aad4c46b432f3ab6056a2f7e43503a..ffd2dbbcadef644520ef9bb4693e699935e8bd7b 100755 --- a/pylal/bin/lalapps_cbc_plotroc_ring +++ b/pylal/bin/lalapps_cbc_plotroc_ring @@ -143,9 +143,9 @@ class CoincDatabase(object): # find the tables self.sngl_table = sqlutils.validate_option( options.sngl_table ) self.sim_table = sqlutils.validate_option( options.sim_table ) - self.coinc_def_table = table.get_table(xmldoc, dbtables.lsctables.CoincDefTable.tableName) - self.coinc_table = table.get_table(xmldoc, dbtables.lsctables.CoincTable.tableName) - self.time_slide_table = table.get_table(xmldoc, dbtables.lsctables.TimeSlideTable.tableName) + self.coinc_def_table = dbtables.lsctables.CoincDefTable.get_table(xmldoc) + self.coinc_table = dbtables.lsctables.CoincTable.get_table(xmldoc) + self.time_slide_table = dbtables.lsctables.TimeSlideTable.get_table(xmldoc) self.coinc_table = sqlutils.validate_option( options.coinc_table ) diff --git a/pylal/bin/lalapps_cbc_print_rs b/pylal/bin/lalapps_cbc_print_rs index c6fb8e11bd350d37ada7d55ae9b342afae74e73f..86a741341eca0975b8c8d3fb6040bf49baf80435 100755 --- a/pylal/bin/lalapps_cbc_print_rs +++ b/pylal/bin/lalapps_cbc_print_rs @@ -244,11 +244,11 @@ if opts.merge_with_loudest_events: # get the segments corresponding to the loudest events end times letable = table.get_table(letable_doc, "loudest_events:table") - sngl_insp_table = table.get_table(fullxml_doc, lsctables.SnglInspiralTable.tableName) - coinc_map_table = table.get_table(fullxml_doc, lsctables.CoincMapTable.tableName) - exp_summ_table = table.get_table(fullxml_doc, lsctables.ExperimentSummaryTable.tableName) - exp_map_table = table.get_table(fullxml_doc, lsctables.ExperimentMapTable.tableName) - offset_vectors = table.get_table(fullxml_doc, lsctables.TimeSlideTable.tableName).as_dict() + sngl_insp_table = lsctables.SnglInspiralTable.get_table(fullxml_doc) + coinc_map_table = lsctables.CoincMapTable.get_table(fullxml_doc) + exp_summ_table = lsctables.ExperimentSummaryTable.get_table(fullxml_doc) + exp_map_table = lsctables.ExperimentMapTable.get_table(fullxml_doc) + offset_vectors = lsctables.TimeSlideTable.get_table(fullxml_doc).as_dict() # create a segmentlist out of the segments in the rank_table segdict = dict([ [(row.file_type, row.ifo, segments.segment(row.out_start_time, (row.out_start_time+row.segment_duration))), row] for row in seg_table ]) diff --git a/pylal/bin/lalapps_followup_pipe b/pylal/bin/lalapps_followup_pipe index 4628bc6b6fa0b7b8057b85d94aa43a4a67b37806..97cf660c7b3c309f0180868145e9ad8e4f7ea580 100644 --- a/pylal/bin/lalapps_followup_pipe +++ b/pylal/bin/lalapps_followup_pipe @@ -127,11 +127,11 @@ class DB_summary(object): # find the tables try: - self.sngl_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SnglInspiralTable.tableName) + self.sngl_inspiral_table = dbtables.lsctables.SnglInspiralTable.get_table(xmldoc) except ValueError: self.sngl_inspiral_table = None try: - self.sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + self.sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) # write out the injection file to use in later inspiral jobs newxmldoc = ligolw.Document() newxmldoc.appendChild(ligolw.LIGO_LW()) @@ -142,19 +142,19 @@ class DB_summary(object): except ValueError: self.sim_inspiral_table = None try: - self.coinc_def_table = table.get_table(xmldoc, dbtables.lsctables.CoincDefTable.tableName) - self.coinc_table = table.get_table(xmldoc, dbtables.lsctables.CoincTable.tableName) - self.time_slide_table = table.get_table(xmldoc, dbtables.lsctables.TimeSlideTable.tableName) + self.coinc_def_table = dbtables.lsctables.CoincDefTable.get_table(xmldoc) + self.coinc_table = dbtables.lsctables.CoincTable.get_table(xmldoc) + self.time_slide_table = dbtables.lsctables.TimeSlideTable.get_table(xmldoc) except ValueError: self.coinc_def_table = None self.coinc_table = None self.time_slide_table = None try: - self.coinc_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.CoincInspiralTable.tableName) + self.coinc_inspiral_table = dbtables.lsctables.CoincInspiralTable.get_table(xmldoc) except ValueError: self.coinc_inspiral_table = None try: - self.experiment_summary_table = table.get_table(xmldoc, dbtables.lsctables.ExperimentSummaryTable.tableName) + self.experiment_summary_table = dbtables.lsctables.ExperimentSummaryTable.get_table(xmldoc) except ValueError: self.experiment_summary_table = None diff --git a/pylal/bin/ligolw_cbc_align_total_spin b/pylal/bin/ligolw_cbc_align_total_spin index 75dc8a48396cd67fd01e51dded2502a237c21d42..f9851ff21771c8bceab4da30f13ac03681ff7f89 100644 --- a/pylal/bin/ligolw_cbc_align_total_spin +++ b/pylal/bin/ligolw_cbc_align_total_spin @@ -166,7 +166,7 @@ site_location_list = [\ ("g", inject.cached_detector["GEO_600"]), ("t", inject.cached_detector["TAMA_300"]), ("v", inject.cached_detector["VIRGO"])] -for sim in table.get_table(siminsp_doc, lsctables.SimInspiralTable.tableName): +for sim in lsctables.SimInspiralTable.get_table(siminsp_doc): # rotate s1, s2 = get_spins(sim) newIota, news1, news2 = alignTotalSpin(sim.inclination, s1, s2, diff --git a/pylal/bin/ligolw_cbc_compute_durations b/pylal/bin/ligolw_cbc_compute_durations index 8e623e6ebfeb071ec499604dea586cdc5a150cb1..b68238f0c62a455f4027f0e2e0975fd2d2b4c6e8 100644 --- a/pylal/bin/ligolw_cbc_compute_durations +++ b/pylal/bin/ligolw_cbc_compute_durations @@ -173,7 +173,7 @@ proc_id = process.register_to_xmldoc(xmldoc, __prog__, options.__dict__, version # # turn the time slide table into a dictionary -time_slide_dict = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName).as_dict() +time_slide_dict = lsctables.TimeSlideTable.get_table(xmldoc).as_dict() zero_lag_dict = dict([dict_entry for dict_entry in time_slide_dict.items() if not any( dict_entry[1].values() )]) del time_slide_dict[ zero_lag_dict.keys()[0] ] diff --git a/pylal/bin/ligolw_cbc_expected_snrs b/pylal/bin/ligolw_cbc_expected_snrs index 74947bebdb12069f98f0ead85bfd59c2287ad653..a425c779331fae907769214ea1d526a8261d6a68 100755 --- a/pylal/bin/ligolw_cbc_expected_snrs +++ b/pylal/bin/ligolw_cbc_expected_snrs @@ -63,9 +63,8 @@ else: output = open(opts.output, 'w') # Read siminspiral table -siminspiral = lsctables.table.get_table(utils.load_filename(input_filename, - gz = (input_filename and os.path.splitext(input_filename)[1] == '.gz'), - ), lsctables.SimInspiralTable.tableName) +# FIXME: broken, needs content handler +siminspiral = lsctables.SimInspiralTable.get_table(utils.load_filename(input_filename)) # Choose detector detector = lalsimulation.XLALDetectorPrefixToLALDetector(opts.instrument) diff --git a/pylal/bin/ligolw_cbc_hardware_inj_page b/pylal/bin/ligolw_cbc_hardware_inj_page index c500b8eba632e8dcfe1a2089822027c7178c433e..a26617c1632fb3aa545f892ce634f1f09c0aa378 100644 --- a/pylal/bin/ligolw_cbc_hardware_inj_page +++ b/pylal/bin/ligolw_cbc_hardware_inj_page @@ -83,7 +83,7 @@ def get_expected_snr(filenames,ifo,time): from glue.ligolw import table xmldoc=SearchSummaryUtils.ReadTablesFromFiles(xml_files,[lsctables.SummValueTable]) try: - sum_tabs=table.get_table(xmldoc,lsctables.SummValueTable.tableName) + sum_tabs=lsctables.SummValueTable.get_table(xmldoc) except: sum_tabs=None if sum_tabs==None: diff --git a/pylal/bin/ligolw_cbc_jitter_skyloc b/pylal/bin/ligolw_cbc_jitter_skyloc index 0f21ab47d865b7b191cdd16a3b8221a1e5e80498..dc5fe4f6d2c213f93e383e2aee35ede89c0e7359 100755 --- a/pylal/bin/ligolw_cbc_jitter_skyloc +++ b/pylal/bin/ligolw_cbc_jitter_skyloc @@ -131,7 +131,7 @@ site_location_list = [\ ("t", "T1"), ("v", "V1") ] -for sim in table.get_table(siminsp_doc, lsctables.SimInspiralTable.tableName): +for sim in lsctables.SimInspiralTable.get_table(siminsp_doc): # The Fisher distribution is the appropriate generalization of a # Gaussian on a sphere. diff --git a/pylal/bin/ligolw_cbc_sngls_fars b/pylal/bin/ligolw_cbc_sngls_fars index fb2791c69114b5774abbc858c971eb3de54aa209..52d72c8911fb07a488422e181d97fd463df62f47 100755 --- a/pylal/bin/ligolw_cbc_sngls_fars +++ b/pylal/bin/ligolw_cbc_sngls_fars @@ -368,7 +368,7 @@ def extract_ifos(filename): elif 'xml' in filename: xmldoc = utils.load_filename(filename, gz=filename.endswith(".gz"), verbose = options.verbose) - process_table = lsctables.table.get_table(xmldoc, lsctables.ProcessTable.tableName) + process_table = lsctables.ProcessTable.get_table(xmldoc) ifos = set(row.ifos for row in process_table) else: print >>sys.stderr, 'cannot analyse file %s, unknown type'%(filename,) @@ -408,7 +408,7 @@ def extract_bkg(likelihood_bins, filename): dbtables.discard_connection_filename(filename, working_filename, verbose = options.verbose) elif 'xml' in filename: xmldoc = utils.load_filename(filename, gz=filename.endswith(".gz"), verbose = options.verbose) - sngl_inspiral_table = lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + sngl_inspiral_table = lsctables.SnglInspiralTable.get_table(xmldoc) # FIXME: look up how to get columns from a sngl_inspiral row [likelihood_bins.add_bkg_sngl([row.get_attribute(col) for col in likelihood_bins.list_idx_sngls]) for row in sngl_inspiral_table] else: @@ -440,7 +440,7 @@ def compute_likelihoods(likelihood_bins, filename): dbtables.discard_connection_filename(filename, working_filename, verbose = options.verbose) elif 'xml' in filename: xmldoc = utils.load_filename(filename, gz=filename.endswith(".gz"), verbose = options.verbose) - sngl_inspiral_table = lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + sngl_inspiral_table = lsctables.SnglInspiralTable.get_table(xmldoc) # FIXME: look up how to get columns from a sngl_inspiral row [likelihood_bins.sngl_likelihood([row.get_attribute(col) for col in likelihood_bins.list_idx_sngls]) for row in sngl_inspiral_table] else: diff --git a/pylal/bin/ligolw_fix_ids b/pylal/bin/ligolw_fix_ids index 9952cc380af2d33303e156424f2bb6aa50a1c76e..0d338bbbd7040a312c0815e5f0d4c15017a787a2 100755 --- a/pylal/bin/ligolw_fix_ids +++ b/pylal/bin/ligolw_fix_ids @@ -127,7 +127,7 @@ for n, filename in enumerate(filenames): # a unique id. This is purely a temporary fix to deal with files # that already exist. New files should not have this problem. - snglinsp_tbl = lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + snglinsp_tbl = lsctables.SnglInspiralTable.get_table(xmldoc) snglinsp_tbl.set_next_id(lsctables.SnglInspiralID(0)) for row in snglinsp_tbl: row.event_id = snglinsp_tbl.get_next_id() diff --git a/pylal/bin/ligolw_fr_to_science b/pylal/bin/ligolw_fr_to_science index 0524f80e2b57044c28cdf7150ea30d60c7819b31..67d49e779f84bf18d8f188a3f04eac0e50a930a5 100755 --- a/pylal/bin/ligolw_fr_to_science +++ b/pylal/bin/ligolw_fr_to_science @@ -141,7 +141,7 @@ segmentdb_utils.add_to_segment(outdoc,proc_id,gam_def_id,badgamma_segments) segmentdb_utils.add_to_segment(outdoc,proc_id,lig_def_id,light_segments) # write the xml file to disk -proctable = table.get_table(outdoc, lsctables.ProcessTable.tableName) +proctable = lsctables.ProcessTable.get_table(outdoc) proctable[0].end_time = gpstime.GpsSecondsFromPyUTC(time.time()) outname = '-'.join([options.ifo[0],options.type + '_SEGMENTS_V' + str(options.segment_version),str(frame_intervals[0][0]),str(frame_intervals[-1][1]-frame_intervals[0][0])]) + '.xml' ligolw_utils.write_filename(outdoc,outname) diff --git a/pylal/bin/ligolw_rinca b/pylal/bin/ligolw_rinca index 4d8955bb55abf63af42f57a16b4f33f25ec7ef0a..b1711b2a3b5ef3452ed7b9a7cafe29ec5f55bd70 100755 --- a/pylal/bin/ligolw_rinca +++ b/pylal/bin/ligolw_rinca @@ -198,7 +198,7 @@ for n, filename in enumerate(filenames): # IDs. # - tbl = lsctables.table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName) + tbl = lsctables.SnglRingdownTable.get_table(xmldoc) tbl.set_next_id(lsctables.SnglRingdownID(0)) for row in tbl: row.event_id = tbl.get_next_id() diff --git a/pylal/bin/ligolw_rinca_to_coinc b/pylal/bin/ligolw_rinca_to_coinc index ee2ee31c3e0a92860100cfdf713f3d687b8cabe8..0bc3e2a50e98f6cf98c96fc2a52f3d230aa864b4 100755 --- a/pylal/bin/ligolw_rinca_to_coinc +++ b/pylal/bin/ligolw_rinca_to_coinc @@ -244,8 +244,8 @@ def add_metadata(xmldoc, metadata_cache, verbose = False): # set() to uniquify the list. # - process_ids = table.get_table(xmldoc, lsctables.ProcessTable.tableName).get_ids_by_program("rinca") - urls = sorted(set(metadata_cache[row.string] for row in table.get_table(xmldoc, lsctables.SearchSummVarsTable.tableName) if row.process_id in process_ids and row.name == "input_file")) + process_ids = lsctables.ProcessTable.get_table(xmldoc).get_ids_by_program("rinca") + urls = sorted(set(metadata_cache[row.string] for row in lsctables.SearchSummVarsTable.get_table(xmldoc) if row.process_id in process_ids and row.name == "input_file")) # # insert the metadata from the URLs into xmldoc, remapping IDs to @@ -261,7 +261,7 @@ def add_metadata(xmldoc, metadata_cache, verbose = False): # try: - table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName) + lsctables.SnglRingdownTable.get_table(xmldoc) except ValueError: # no ringdown table --> no-op if verbose: @@ -274,10 +274,10 @@ def add_metadata(xmldoc, metadata_cache, verbose = False): if verbose: print >>sys.stderr, "re-linking sngl_ringdown rows to process rows ..." - process_ids = table.get_table(xmldoc, lsctables.ProcessTable.tableName).get_ids_by_program("lalapps_ring") + process_ids = lsctables.ProcessTable.get_table(xmldoc).get_ids_by_program("lalapps_ring") segs = {} ids = {} - for row in table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName): + for row in lsctables.SearchSummaryTable.get_table(xmldoc): if row.process_id in process_ids: segs.setdefault(row.ifos, segments.segmentlist()).append(row.get_out()) ids.setdefault(row.ifos, []).append(row.process_id) @@ -287,7 +287,7 @@ def add_metadata(xmldoc, metadata_cache, verbose = False): # lalapps_ring job # - for row in table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName): + for row in lsctables.SnglRingdownTable.get_table(xmldoc): row.process_id = ids[row.ifo][segs[row.ifo].find(row.get_start())] # @@ -436,7 +436,7 @@ def fix_ifos_columns(xmldoc, verbose = False): def get_rinca_process_ids(xmldoc): - return table.get_table(xmldoc, lsctables.ProcessTable.tableName).get_ids_by_program("rinca") + return lsctables.ProcessTable.get_table(xmldoc).get_ids_by_program("rinca") def get_search_summary_instruments(xmldoc, rinca_process_ids): @@ -444,7 +444,7 @@ def get_search_summary_instruments(xmldoc, rinca_process_ids): Extract the list of analyzed instruments from the rinca entries in the search summary table. """ - search_summary_instruments = set(frozenset(row.get_ifos()) for row in table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName) if row.process_id in rinca_process_ids) + search_summary_instruments = set(frozenset(row.get_ifos()) for row in lsctables.SearchSummaryTable.get_table(xmldoc) if row.process_id in rinca_process_ids) if len(search_summary_instruments) < 1: raise ValueError, "cannot find entries for rinca jobs in search_summary table" if len(search_summary_instruments) > 1: @@ -465,7 +465,7 @@ def populate_rinca_time_slide_table(xmldoc, process, instruments = None, verbose # try: - time_slide_table = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName) + time_slide_table = lsctables.TimeSlideTable.get_table(xmldoc) except ValueError: time_slide_table = lsctables.New(lsctables.TimeSlideTable) xmldoc.childNodes[0].appendChild(time_slide_table) @@ -494,7 +494,7 @@ def populate_rinca_time_slide_table(xmldoc, process, instruments = None, verbose # rinca_process_ids = get_rinca_process_ids(xmldoc) - slides_process_ids = rinca_process_ids & set(row.process_id for row in table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName) if row.param == u"--num-slides") + slides_process_ids = rinca_process_ids & set(row.process_id for row in lsctables.ProcessParamsTable.get_table(xmldoc) if row.param == u"--num-slides") if len(rinca_process_ids - slides_process_ids) > 1: raise ValueError, "document contains more than 1 zero-lag rinca job" @@ -547,7 +547,7 @@ def populate_rinca_time_slide_table(xmldoc, process, instruments = None, verbose offset_vector = {} slide_option_pattern = re.compile("--(?P<ifo>[a-zA-Z][0-9])-slide") - for row in table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName): + for row in lsctables.ProcessParamsTable.get_table(xmldoc): if row.process_id in slides_process_ids: if row.param == u"--num-slides": num_slides = row.pyvalue @@ -621,7 +621,7 @@ def depopulate_time_slide_table(xmldoc, verbose = False): # find the time_slide table # - time_slide_table = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName) + time_slide_table = lsctables.TimeSlideTable.get_table(xmldoc) length_before = len(set(time_slide_table.getColumnByName("time_slide_id"))) @@ -707,7 +707,7 @@ def populate_experiment_table(xmldoc, search_group, search, lars_id, instruments # find the experiment table or create one if needed try: - expr_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) + expr_table = lsctables.ExperimentTable.get_table(xmldoc) except ValueError: expr_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.ExperimentTable)) @@ -749,7 +749,7 @@ def populate_experiment_summ_table( xmldoc, experiment_id, time_slide_dict, veto # find the experiment_summary table or create one if needed try: - expr_summ_table = table.get_table(xmldoc, lsctables.ExperimentSummaryTable.tableName) + expr_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) except ValueError: expr_summ_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.ExperimentSummaryTable)) @@ -784,7 +784,7 @@ def generate_experiment_tables(xmldoc, search_group, search, lars_id, veto_def_n experiment_ids = populate_experiment_table(xmldoc, search_group, search, lars_id, instruments, expr_start_time, expr_end_time, comments = comments, add_inst_subsets = True, verbose = verbose) # Get the time_slide table as dict - time_slide_dict = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName).as_dict() + time_slide_dict = lsctables.TimeSlideTable.get_table(xmldoc).as_dict() # Populate the experiment_summary table for instruments in experiment_ids: @@ -824,7 +824,7 @@ def depopulate_experiment_tables(xmldoc, verbose = False): # try: - experiment_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) + experiment_table = lsctables.ExperimentTable.get_table(xmldoc) except ValueError: # no table --> no-op if verbose: @@ -832,7 +832,7 @@ def depopulate_experiment_tables(xmldoc, verbose = False): return try: - experiment_summ_table = table.get_table(xmldoc, lsctables.ExperimentSummaryTable.tableName) + experiment_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) except ValueError: # no table --> no-op if verbose: @@ -965,7 +965,7 @@ def populate_coinc_event_sngls(xmldoc, process, effective_snr_factor = 250.0, ch # try: - coinc_event_table = table.get_table(xmldoc, lsctables.CoincTable.tableName) + coinc_event_table = lsctables.CoincTable.get_table(xmldoc) except ValueError: coinc_event_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.CoincTable)) @@ -981,7 +981,7 @@ def populate_coinc_event_sngls(xmldoc, process, effective_snr_factor = 250.0, ch # try: - coinc_event_map_table = table.get_table(xmldoc, lsctables.CoincMapTable.tableName) + coinc_event_map_table = lsctables.CoincMapTable.get_table(xmldoc) except ValueError: coinc_event_map_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.CoincMapTable)) @@ -990,7 +990,7 @@ def populate_coinc_event_sngls(xmldoc, process, effective_snr_factor = 250.0, ch # try: - coinc_ringdown_table = table.get_table(xmldoc, lsctables.CoincRingdownTable.tableName) + coinc_ringdown_table = lsctables.CoincRingdownTable.get_table(xmldoc) except ValueError: coinc_ringdown_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.CoincRingdownTable)) @@ -999,7 +999,7 @@ def populate_coinc_event_sngls(xmldoc, process, effective_snr_factor = 250.0, ch # try: - sngl_ringdown_table = table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName) + sngl_ringdown_table = lsctables.SnglRingdownTable.get_table(xmldoc) except ValueError: # no sngl_ringdown table --> no-op if verbose: @@ -1011,7 +1011,7 @@ def populate_coinc_event_sngls(xmldoc, process, effective_snr_factor = 250.0, ch # offset vectors # - time_slide_table = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName) + time_slide_table = lsctables.TimeSlideTable.get_table(xmldoc) time_slides = time_slide_table.as_dict() # @@ -1157,7 +1157,7 @@ def depopulate_sngl_ringdown(xmldoc, verbose = False): # try: - sngl_ringdown_table = table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName) + sngl_ringdown_table = lsctables.SnglRingdownTable.get_table(xmldoc) except ValueError: # no sngl_ringdown table --> no-op if verbose: @@ -1216,7 +1216,7 @@ def populate_experiment_map(xmldoc, search_group, search, lars_id, veto_def_name print >> sys.stderr, "Mapping coinc events to experiment_summary table..." try: - expr_map_table = table.get_table(xmldoc, lsctables.ExperimentMapTable.tableName) + expr_map_table = lsctables.ExperimentMapTable.get_table(xmldoc) except ValueError: expr_map_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.ExperimentMapTable)) @@ -1224,31 +1224,31 @@ def populate_experiment_map(xmldoc, search_group, search, lars_id, veto_def_name # find the coinc_event table # - coinc_event_table = table.get_table(xmldoc, lsctables.CoincTable.tableName) + coinc_event_table = lsctables.CoincTable.get_table(xmldoc) # # Index the coinc_ringdown table as a dictionary # - coinc_index = dict((row.coinc_event_id, row) for row in table.get_table(xmldoc, lsctables.CoincRingdownTable.tableName)) + coinc_index = dict((row.coinc_event_id, row) for row in lsctables.CoincRingdownTable.get_table(xmldoc)) # # Get the time_slide_table as dict # - time_slide_dict = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName).as_dict() + time_slide_dict = lsctables.TimeSlideTable.get_table(xmldoc).as_dict() # # find the experiment table # - expr_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) + expr_table = lsctables.ExperimentTable.get_table(xmldoc) # # find the experiment_summary table # - expr_summ_table = table.get_table(xmldoc, lsctables.ExperimentSummaryTable.tableName) + expr_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) # # Get the on_instruments from the search summary table @@ -1356,19 +1356,19 @@ def apply_vetoes(xmldoc, veto_segments, process, verbose = False): # try: - sngl_ringdown_table = table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName) + sngl_ringdown_table = lsctables.SnglRingdownTable.get_table(xmldoc) except ValueError: # no sngl_ringdown table --> no-op if verbose: print >>sys.stderr, "\tcannot find sngl_ringdown table" return - coinc_table = table.get_table(xmldoc, lsctables.CoincTable.tableName) - coinc_map_table = table.get_table(xmldoc, lsctables.CoincMapTable.tableName) - coinc_ringdown_table = table.get_table(xmldoc, lsctables.CoincRingdownTable.tableName) - time_slide_table = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName) - expr_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) - expr_summ_table = table.get_table(xmldoc, lsctables.ExperimentSummaryTable.tableName) - expr_map_table = table.get_table(xmldoc, lsctables.ExperimentMapTable.tableName) + coinc_table = lsctables.CoincTable.get_table(xmldoc) + coinc_map_table = lsctables.CoincMapTable.get_table(xmldoc) + coinc_ringdown_table = lsctables.CoincRingdownTable.get_table(xmldoc) + time_slide_table = lsctables.TimeSlideTable.get_table(xmldoc) + expr_table = lsctables.ExperimentTable.get_table(xmldoc) + expr_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) + expr_map_table = lsctables.ExperimentMapTable.get_table(xmldoc) # # turn the time slide table into a dictionary diff --git a/pylal/bin/ligolw_split_inspiral b/pylal/bin/ligolw_split_inspiral index ebae1c0a12e80dbc18c129edb4c60ec247b779f2..ec7a779b89c6c5f4218754e1851f9d67d65c8816 100755 --- a/pylal/bin/ligolw_split_inspiral +++ b/pylal/bin/ligolw_split_inspiral @@ -125,7 +125,7 @@ lsctables.table.RowBuilder = lsctables.table.InterningRowBuilder # get desired template parameters tmplt_xmldoc = utils.load_filename(opts.tmplt_file, verbose = opts.verbose) -tmplt_tbl = table.get_table(tmplt_xmldoc, lsctables.SnglInspiralTable.tableName) +tmplt_tbl = lsctables.SnglInspiralTable.get_table(tmplt_xmldoc) if opts.tmplt_num >= len(tmplt_tbl): raise ValueError, "The given template number: %d is too large for this bank" % opts.tmplt_num @@ -163,7 +163,7 @@ for n, file in enumerate(inspiral_cache): ligolw_add.merge_compatible_tables(xmldoc) # Select desired triggers - sngl_insp_tbl = table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + sngl_insp_tbl = lsctables.SnglInspiralTable.get_table(xmldoc) max_idx = len(sngl_insp_tbl) - 1 for idx, row in enumerate( reversed(sngl_insp_tbl) ): # if template params don't match desired ones, remove @@ -176,7 +176,7 @@ lsctables.ProcessTable.next_id = lsctables.ProcessID(0) ligolw_add.reassign_ids(xmldoc, verbose = opts.verbose) # Reassign event_ids -sngl_insp_tbl = lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) +sngl_insp_tbl = lsctables.SnglInspiralTable.get_table(xmldoc) sngl_insp_tbl.set_next_id(lsctables.SnglInspiralID(0)) for row in sngl_insp_tbl: row.event_id = sngl_insp_tbl.get_next_id() diff --git a/pylal/bin/minifollowups b/pylal/bin/minifollowups index 20ff703f26b23b0a66c150256e4fa750d83ff2b6..488cc27c3fc24234c68b693ae172063e24643667 100755 --- a/pylal/bin/minifollowups +++ b/pylal/bin/minifollowups @@ -181,13 +181,13 @@ def get_column_list(tableName, with_sngl = False): def loudest_events(xmldoc, opts, summTable, followup): - coincT = table.get_table(xmldoc, lsctables.CoincInspiralTable.tableName) - coincMap = table.get_table(xmldoc, lsctables.CoincMapTable.tableName) - sngls = table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + coincT = lsctables.CoincInspiralTable.get_table(xmldoc) + coincMap = lsctables.CoincMapTable.get_table(xmldoc) + sngls = lsctables.SnglInspiralTable.get_table(xmldoc) coincTable = organize_coincs(coincT, sngls, coincMap) - coincEvent = table.get_table(xmldoc, lsctables.CoincTable.tableName) - timeSlide = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName) + coincEvent = lsctables.CoincTable.get_table(xmldoc) + timeSlide = lsctables.TimeSlideTable.get_table(xmldoc) coincTable = organize_slides(coincTable, coincEvent, timeSlide) page = [] @@ -248,10 +248,10 @@ def missed_injections(opts, summTable, followup): def found_injections(xmldoc, opts, summTable, followup): - sims = table.get_table(xmldoc,lsctables.SimInspiralTable.tableName) - coincT = table.get_table(xmldoc, lsctables.CoincInspiralTable.tableName) - coincMap = table.get_table(xmldoc, lsctables.CoincMapTable.tableName) - sngls = table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + sims = lsctables.SimInspiralTable.get_table(xmldoc) + coincT = lsctables.CoincInspiralTable.get_table(xmldoc) + coincMap = lsctables.CoincMapTable.get_table(xmldoc) + sngls = lsctables.SnglInspiralTable.get_table(xmldoc) simTable = organize_found_injs(summTable,sims,coincT,coincMap,sngls) page = [] diff --git a/pylal/bin/mvsc_get_doubles b/pylal/bin/mvsc_get_doubles index 96b3fdba31430ea480ebab347455dc14fd434ed8..a528c7bc604323cdaf347b3c6dfca93bf72aa90d 100755 --- a/pylal/bin/mvsc_get_doubles +++ b/pylal/bin/mvsc_get_doubles @@ -78,10 +78,10 @@ for database in databases: dbtables.DBTable_set_connection(connection) xmldoc = dbtables.get_xml(connection) cursor = connection.cursor() - num_sngl_cols = len(table.get_table(xmldoc, dbtables.lsctables.SnglInspiralTable.tableName).dbcolumnnames) + num_sngl_cols = len(dbtables.lsctables.SnglInspiralTable.get_table(xmldoc).dbcolumnnames) rings = db_thinca_rings.get_thinca_rings_by_available_instruments(connection) - offset_vectors = dbtables.lsctables.table.get_table(dbtables.get_xml(connection), dbtables.lsctables.TimeSlideTable.tableName).as_dict() - sngl_inspiral_row_from_cols = table.get_table(xmldoc, dbtables.lsctables.SnglInspiralTable.tableName).row_from_cols + offset_vectors = dbtables.lsctables.TimeSlideTable.get_table(dbtables.get_xml(connection)).as_dict() + sngl_inspiral_row_from_cols = dbtables.lsctables.SnglInspiralTable.get_table(xmldoc).row_from_cols def calc_effective_snr(snr, chisq, chisq_dof, fac=opts.factor): return snr/ (1 + snr**2/fac)**(0.25) / (chisq/(2*chisq_dof - 2) )**(0.25) @@ -127,7 +127,7 @@ for database in databases: # in S6, the timeslides, zerolag, and injections are all stored in the same sqlite database, thus this database must include a sim inspiral table # if you provide a database that does not include injections, the code will still run as long as one of the databases you provide includes injections try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) is_injections = True except ValueError: is_injections = False diff --git a/pylal/bin/mvsc_get_doubles_ringdown b/pylal/bin/mvsc_get_doubles_ringdown index 01604b32411ff1d2b5bbfddeca6db1dcc326ccb5..6e3a533d1dc343095ad158dc86b4dae64ee74921 100755 --- a/pylal/bin/mvsc_get_doubles_ringdown +++ b/pylal/bin/mvsc_get_doubles_ringdown @@ -89,10 +89,10 @@ for database in databases: dbtables.DBTable_set_connection(connection) xmldoc = dbtables.get_xml(connection) cursor = connection.cursor() - num_sngl_cols = len(table.get_table(xmldoc, dbtables.lsctables.SnglRingdownTable.tableName).dbcolumnnames) + num_sngl_cols = len(dbtables.lsctables.SnglRingdownTable.get_table(xmldoc).dbcolumnnames) rings = db_rinca_rings.get_rinca_rings_by_available_instruments(connection) - offset_vectors = dbtables.lsctables.table.get_table(dbtables.get_xml(connection), dbtables.lsctables.TimeSlideTable.tableName).as_dict() - sngl_ringdown_row_from_cols = table.get_table(xmldoc, dbtables.lsctables.SnglRingdownTable.tableName).row_from_cols + offset_vectors = dbtables.lsctables.TimeSlideTable.table.get_table(dbtables.get_xml(connection)).as_dict() + sngl_ringdown_row_from_cols = dbtables.lsctables.SnglRingdownTable.get_table(xmldoc).row_from_cols def gQQ(Qa,Qb): Q = (Qa+Qb)/2. @@ -178,7 +178,7 @@ for database in databases: # in S6, the timeslides, zerolag, and injections are all stored in the same sqlite database, thus this database must include a sim inspiral table # if you provide a database that does not include injections, the code will still run as long as one of the databases you provide includes injections try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) is_injections = True except ValueError: is_injections = False diff --git a/pylal/bin/mvsc_get_doubles_snglstage b/pylal/bin/mvsc_get_doubles_snglstage index 0217b75e6f401c786ae483cee68d788e56777cbb..177ccf2f2a933162018b4b5d50afbd59c835d449 100755 --- a/pylal/bin/mvsc_get_doubles_snglstage +++ b/pylal/bin/mvsc_get_doubles_snglstage @@ -77,10 +77,10 @@ for database in databases: connection = sqlite3.connect(working_filename) xmldoc = dbtables.get_xml(connection) cursor = connection.cursor() - num_sngl_cols = len(table.get_table(xmldoc, dbtables.lsctables.SnglInspiralTable.tableName).dbcolumnnames) + num_sngl_cols = len(dbtables.lsctables.SnglInspiralTable.get_table(xmldoc).dbcolumnnames) rings = db_thinca_rings.get_thinca_rings_by_available_instruments(connection) - offset_vectors = dbtables.lsctables.table.get_table(dbtables.get_xml(connection), dbtables.lsctables.TimeSlideTable.tableName).as_dict() - sngl_inspiral_row_from_cols = table.get_table(xmldoc, dbtables.lsctables.SnglInspiralTable.tableName).row_from_cols + offset_vectors = dbtables.lsctables.TimeSlideTable.get_table(dbtables.get_xml(connection)).as_dict() + sngl_inspiral_row_from_cols = dbtables.lsctables.SnglInspiralTable.get_table(xmldoc).row_from_cols def calc_effective_snr(snr, chisq, chisq_dof, fac=opts.factor): print >>sys.stderr, "Calculating effective SNR" return snr/ (1 + snr**2/fac)**(0.25) / (chisq/(2*chisq_dof - 2) )**(0.25) @@ -129,7 +129,7 @@ for database in databases: # in S6, the timeslides, zerolag, and injections are all stored in the same sqlite database, thus this database must include a sim inspiral table # if you provide a database that does not include injections, the code will still run as long as one of the databases you provide includes injections try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) is_injections = True except ValueError: is_injections = False diff --git a/pylal/bin/plot_skypoints.py b/pylal/bin/plot_skypoints.py index d0d41958a13b5eae01db2a46d69032b42c9e9ef3..07684e9d7c51fc59e99dad80ae1cf2c1759380bc 100644 --- a/pylal/bin/plot_skypoints.py +++ b/pylal/bin/plot_skypoints.py @@ -58,17 +58,17 @@ else: for file in files: xmldoc =utils.load_filename(file) try: - sltab = table.get_table(xmldoc,skylocutils.SkyLocInjTable.tableName) + sltab = skylocutils.SkyLocInjTable.get_table(xmldoc) if sltab[0].grid: print "injection" inj = True else: print "no injection" - sltab = table.get_table(xmldoc,skylocutils.SkyLocTable.tableName) + sltab = skylocutils.SkyLocTable.get_table(xmldoc) inj = False except: print "no injection" - sltab = table.get_table(xmldoc,skylocutils.SkyLocTable.tableName) + sltab = skylocutils.SkyLocTable.get_table(xmldoc) inj = False print "Plotting "+file diff --git a/pylal/bin/plotchiatimeseries b/pylal/bin/plotchiatimeseries index f36570fc9f447d04dc0c7e2be52936af191ee25a..56cdc8b82bde5306330cd2e7eb1c309d462b905f 100755 --- a/pylal/bin/plotchiatimeseries +++ b/pylal/bin/plotchiatimeseries @@ -683,8 +683,8 @@ extension = opts.chiaXmlFile.split('.')[-1] if extension == 'gz': gz = True else: gz = False doc = utils.load_filename(opts.chiaXmlFile,verbose=False, gz=gz, xmldoc=None, contenthandler=None) -proc = table.get_table(doc, lsctables.ProcessParamsTable.tableName) -multiInspiralTable = table.getTablesByName(doc,lsctables.MultiInspiralTable.tableName) +proc = lsctables.ProcessParamsTable.get_table(doc) +multiInspiralTable = lsctables.MultiInspiralTable.getTablesByName(doc) if len(multiInspiralTable) == 0: print >> sys.stdout, "document does not contain any multi_inspiral table, which means no trigger found" sys.exit(0) diff --git a/pylal/bin/plotgrbl b/pylal/bin/plotgrbl index dc8d7477acbb0ad164ade02c325b3542b4542ac0..08854746116ef880c4961fdef7da441932dc6653 100644 --- a/pylal/bin/plotgrbl +++ b/pylal/bin/plotgrbl @@ -364,8 +364,7 @@ try: except ligolw.ElementError: onsource_doc = SnglInspiralUtils.ReadSnglInspiralFromFiles(\ [relic_onsource_xml], old_document=True) -onsource_trigs = table.get_table(onsource_doc, - lsctables.SnglInspiralTable.tableName) +onsource_trigs = lsctables.SnglInspiralTable.get_table(onsource_doc) onsource_coincs = CoincInspiralUtils.coincInspiralTable(onsource_trigs, coinc_stat) if len(onsource_coincs) > len(mc_ifo_cats): diff --git a/pylal/bin/plotnumgalaxies b/pylal/bin/plotnumgalaxies index 78578c2411cc4ece6de53a883604b2c9ed21c0f6..1eed5b0bf9604b0f8ff257d5808f502160fc15f4 100644 --- a/pylal/bin/plotnumgalaxies +++ b/pylal/bin/plotnumgalaxies @@ -215,8 +215,7 @@ def readFiles(fileGlob,statistic=None,dcCalErrorVal=None): doc = utils.load_filename(thisFile, gz = (thisFile[-3:] == '.gz') ) # extract the sim inspiral table try: - simInspiralTable = \ - table.get_table(doc, lsctables.SimInspiralTable.tableName) + simInspiralTable = lsctables.SimInspiralTable.get_table(doc) if dcCalErrorVal != None: dc_calibration_correction(simInspiralTable,dcCalErrorVal) if sims: sims.extend(simInspiralTable) @@ -224,8 +223,7 @@ def readFiles(fileGlob,statistic=None,dcCalErrorVal=None): except: simInspiralTable = None # extract the sngl inspiral table, construct coincs - try: snglInspiralTable = \ - table.get_table(doc, lsctables.SnglInspiralTable.tableName) + try: snglInspiralTable = lsctables.SnglInspiralTable.get_table(doc) except: snglInspiralTable = None if snglInspiralTable: coincInspiralTable = \ @@ -237,7 +235,7 @@ def readFiles(fileGlob,statistic=None,dcCalErrorVal=None): max_dist = None try: - ppTable = table.get_table(doc, lsctables.ProcessParamsTable.tableName) + ppTable = lsctables.ProcessParamsTable.get_table(doc) for row in ppTable: if row.param=="--max-distance": max_dist = float(row.value) diff --git a/pylal/bin/plotnumtemplates b/pylal/bin/plotnumtemplates index 2735a1adf026fbe4e7f45e59780c20572862df6a..e960a6c310138a2520130953ca564bc909296498 100755 --- a/pylal/bin/plotnumtemplates +++ b/pylal/bin/plotnumtemplates @@ -124,13 +124,11 @@ def readFiles(fList): isSearchSummOrProcess)).parse(fileobj) # read in ifo from process, as not stored in SearchSumm - process_table = ligolw_table.get_table(doc, - lsctables.ProcessTable.tableName) + process_table = lsctables.ProcessTable.get_table(doc) ifo = process_table.getColumnByName('ifos')[0] # read in SearchSummary - searchSummTable = ligolw_table.get_table(doc, - lsctables.SearchSummaryTable.tableName) + searchSummTable = lsctables.SearchSummaryTable.get_table(doc) if ifo in output: output[ifo].extend(searchSummTable) else: diff --git a/pylal/bin/plotsnrchisq_pipe b/pylal/bin/plotsnrchisq_pipe index 2b9a14aac6cc2bf7eeac37dad81930f5dd57c426..3cf2628f30e5521cd6436dac7bd5490d87157e10 100644 --- a/pylal/bin/plotsnrchisq_pipe +++ b/pylal/bin/plotsnrchisq_pipe @@ -478,7 +478,7 @@ if not opts.inspiral_xml_file: opts = InspiralUtils.initialise(opts, __prog__, git_version.verbose_msg) doc = utils.load_filename(opts.inspiral_xml_file) -proc = table.get_table(doc, lsctables.ProcessParamsTable.tableName) +proc = lsctables.ProcessParamsTable.get_table(doc) plotsnrchisq(opts,args,str(opts.gps),opts.frame_file,opts.output_path,proc,opts.user_tag) diff --git a/pylal/bin/post_process_pipe b/pylal/bin/post_process_pipe index 5c8c8e8d5d679771f6de8fc93b58f15867a68388..2d6a93085a671eb56cd4f3d889d61028bab0e18c 100644 --- a/pylal/bin/post_process_pipe +++ b/pylal/bin/post_process_pipe @@ -317,7 +317,7 @@ from glue.ligolw import lsctables, utils for filename in (CacheEntry(line).path for line in file(sys.argv[1])): xmldoc = utils.load_filename(filename, gz = (filename or "stdin").endswith(".gz")) try: - lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + lsctables.SnglInspiralTable.get_table(xmldoc) except: xmldoc.childNodes[-1].appendChild(lsctables.New(lsctables.SnglInspiralTable, columns = ("process_id", "ifo", "search", "channel", "end_time", "end_time_ns", "end_time_gmst", "impulse_time", "impulse_time_ns", "template_duration", "event_duration", "amplitude", "eff_distance", "coa_phase", "mass1", "mass2", "mchirp", "mtotal", "eta", "kappa", "chi", "tau0", "tau2", "tau3", "tau4", "tau5", "ttotal", "psi0", "psi3", "alpha", "alpha1", "alpha2", "alpha3", "alpha4", "alpha5", "alpha6", "beta", "f_final", "snr", "chisq", "chisq_dof", "bank_chisq", "bank_chisq_dof", "cont_chisq", "cont_chisq_dof", "sigmasq", "rsqveto_duration", "Gamma0", "Gamma1", "Gamma2", "Gamma3", "Gamma4", "Gamma5", "Gamma6", "Gamma7", "Gamma8", "Gamma9", "event_id"))) utils.write_filename(xmldoc, filename, gz = (filename or "stdout").endswith(".gz")) diff --git a/pylal/bin/pylal_aligned_bank_cat b/pylal/bin/pylal_aligned_bank_cat index 6120dbea05859e1037977e0ba783e0d452db2f71..3dc6b64d731176717149ee73a19584767d47b410 100755 --- a/pylal/bin/pylal_aligned_bank_cat +++ b/pylal/bin/pylal_aligned_bank_cat @@ -94,6 +94,6 @@ for values in params: sngl_inspiral_table.append(tmplt) # write the xml doc to disk -proctable = table.get_table(outdoc, lsctables.ProcessTable.tableName) +proctable = lsctables.ProcessTable.get_table(outdoc) ligolw_utils.write_filename(outdoc, options.output_file) diff --git a/pylal/bin/pylal_coh_PTF_cluster b/pylal/bin/pylal_coh_PTF_cluster index 059196e2cc54cea6b44866c469ca9626a720901c..a3dc4ab41e89ea23424d19accf3ed0bdb24c96be 100755 --- a/pylal/bin/pylal_coh_PTF_cluster +++ b/pylal/bin/pylal_coh_PTF_cluster @@ -160,8 +160,7 @@ if __name__=='__main__': N = len(trig_cache) print_verbose("Loading triggers from %d files... " % N) ligolw_add.ligolw_add(outxml, trig_cache.pfnlist()) - time_slide_table = table.get_table(outxml, - lsctables.TimeSlideTable.tableName) + time_slide_table = lsctables.TimeSlideTable.get_table(outxml) table.reset_next_ids([type(time_slide_table)]) time_slide_mapping = ligolw_tisi.time_slides_vacuum( time_slide_table.as_dict()) @@ -172,14 +171,10 @@ if __name__=='__main__': print_verbose("Done.\n") # extract the tables - process_table = table.get_table(outxml, - lsctables.ProcessTable.tableName) - search_summary_table = table.get_table(outxml, - lsctables.SearchSummaryTable.tableName) - multi_inspiral_table = table.get_table( - outxml, lsctables.MultiInspiralTable.tableName) - time_slide_table = table.get_table(outxml, - lsctables.TimeSlideTable.tableName) + process_table = lsctables.ProcessTable.get_table(outxml) + search_summary_table = lsctables.SearchSummaryTable.get_table(outxml) + multi_inspiral_table = lsctables.MultiInspiralTable.get_table(outxml) + time_slide_table = lsctables.TimeSlideTable.get_table(outxml) slides = time_slide_table.as_dict() # uniquify the search summary @@ -261,8 +256,7 @@ if __name__=='__main__': # append our process if not opts.preserve_processes: - process_params = table.get_table(outxml, - lsctables.ProcessParamsTable.tableName) + process_params = lsctables.ProcessParamsTable.get_table(outxml) outxml.childNodes[-1].removeChild(process_table) outxml.childNodes[-1].removeChild(process_params) process = ligolw_process.append_process(outxml, program=__file__, @@ -293,8 +287,7 @@ if __name__=='__main__': # uniquify the simulations try: - sim_inspiral_table = table.get_table( - outxml, lsctables.SimInspiralTable.tableName) + sim_inspiral_table = lsctables.SimInspiralTable.get_table(outxml) except ValueError: pass else: @@ -333,8 +326,7 @@ if __name__=='__main__': outxml.childNodes[-1].appendChild(cluster_table) table.reset_next_ids(lsctables.TableByName.values()) table.reassign_ids(outxml) - segment_def_table = table.get_table(outxml, - lsctables.SegmentDefTable.tableName) + segment_def_table = lsctables.SegmentDefTable.get_table(outxml) for time_slide_id,vector in time_slide_table.as_dict().iteritems(): comment = ",".join([str(vector[ifo]) for ifo in set(vector.keys())]) for i,row in enumerate(segment_def_table): diff --git a/pylal/bin/pylal_coh_PTF_dqv b/pylal/bin/pylal_coh_PTF_dqv index abdc2617c1f80715319305addb5b961aca10efdb..faa53a4a152d2148e6b178a755c43d90577a90d2 100755 --- a/pylal/bin/pylal_coh_PTF_dqv +++ b/pylal/bin/pylal_coh_PTF_dqv @@ -145,37 +145,33 @@ if __name__ == "__main__": xmldoc = ligolw_utils.load_filename(xmlfile, gz=xmlfile.endswith(".gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) # read SearchSummaryTable - search_summ_table = table.get_table(xmldoc, - lsctables.SearchSummaryTable.tableName) + search_summ_table = lsctables.SearchSummaryTable.get_table(xmldoc) ifos = search_summ_table[-1].get_ifos() if not ifos: - process_table = table.get_table(xmldoc, - lsctables.ProcessTable.tableName) + process_table = lsctables.ProcessTable.get_table(xmldoc) ifos = process_table[0].get_ifos() process.set_ifos(ifos) outxml.childNodes[-1].appendChild(search_summ_table) # read Experiment and ExperimentSummary tables - expr_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) - expr_summ_table = table.get_table( - xmldoc, lsctables.ExperimentSummaryTable.tableName) + expr_table = lsctables.ExperimentTable.get_table(xmldoc) + expr_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) # read MultiInspiralTable - mi_table = table.get_table(xmldoc, lsctables.MultiInspiralTable.tableName) + mi_table = lsctables.MultiInspiralTable.get_table(xmldoc) nevents = len(mi_table) print_verbose("MultiInspiralTable read, %d events found.\n" % nevents) # read SimInspiralTable (if it has one) try: - sim_table = table.get_table(xmldoc, - lsctables.SimInspiralTable.tableName) + sim_table = lsctables.SimInspiralTable.get_table(xmldoc) except ValueError: sim_table = None else: print_verbose("SimInspiralTable read.\n") # read TimeSlideTable - slide_table = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName) + slide_table = lsctables.TimeSlideTable.get_table(xmldoc) slides = slide_table.as_dict() outxml.childNodes[-1].appendChild(slide_table) print_verbose("TimeSlideTable read and copied.\n") @@ -184,9 +180,8 @@ if __name__ == "__main__": veto_segments = SegmentListDict((ifo, SegmentList()) for ifo in ifos) for fp in segment_files: xmldoc = ligolw_utils.load_filename(fp, gz=fp.endswith(".gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - seg_def_table = table.get_table(xmldoc, - lsctables.SegmentDefTable.tableName) - seg_table = table.get_table(xmldoc, lsctables.SegmentTable.tableName) + seg_def_table = lsctables.SegmentDefTable.get_table(xmldoc) + seg_table = lsctables.SegmentTable.get_table(xmldoc) ifo_index = dict((int(row.segment_def_id), row.get_ifos()) for row in seg_def_table) for ifo in ifo_index: diff --git a/pylal/bin/pylal_coh_PTF_plot_results b/pylal/bin/pylal_coh_PTF_plot_results index 1c39dd9b7af11f366e13c8ae864a12199f89c2b8..62feeb14b87201827e266d3baa9a7e0c006ace26 100755 --- a/pylal/bin/pylal_coh_PTF_plot_results +++ b/pylal/bin/pylal_coh_PTF_plot_results @@ -120,8 +120,7 @@ def read_ligolw(lalcache): """ xmldoc = ligolw.Document() ligolw_add.ligolw_add(xmldoc, lalcache.pfnlist()) - time_slide_table = table.get_table(xmldoc, - lsctables.TimeSlideTable.tableName) + time_slide_table = lsctables.TimeSlideTable.get_table(xmldoc) time_slide_mapping = ligolw_tisi.time_slides_vacuum( time_slide_table.as_dict()) iterutils.inplace_filter(lambda row: row.time_slide_id not in @@ -141,10 +140,10 @@ def read_found_missed(xmldoc, loudest_by="snr"): of multiple MultiInspiral events mapped to one SimInspiral """ # get coinc_table - coinc_table = table.get_table(xmldoc, lsctables.CoincTable.tableName) - coinc_map_table = table.get_table(xmldoc, lsctables.CoincMapTable.tableName) - all_sims = table.get_table(xmldoc, lsctables.SimInspiralTable.tableName) - all_multis = table.get_table(xmldoc, lsctables.MultiInspiralTable.tableName) + coinc_table = lsctables.CoincTable.get_table(xmldoc) + coinc_map_table = lsctables.CoincMapTable.get_table(xmldoc) + all_sims = lsctables.SimInspiralTable.get_table(xmldoc) + all_multis = lsctables.MultiInspiralTable.get_table(xmldoc) found_sims = table.new_from_template(all_sims) found_multis = table.new_from_template(all_multis) missed_sims = table.new_from_template(all_sims) @@ -507,10 +506,8 @@ if __name__ == "__main__": if background: print_verbose("Reading background events:\n", profile=False) xmldoc = read_ligolw(bg_cache) - time_slide_table = table.get_table(xmldoc, - lsctables.TimeSlideTable.tableName) - bg_mi_table = table.get_table( - xmldoc, lsctables.MultiInspiralTable.tableName) + time_slide_table = lsctables.TimeSlideTable.get_table(xmldoc) + bg_mi_table = lsctables.MultiInspiralTable.get_table(xmldoc) slide_dict = time_slide_table.as_dict() num_slides = len(slide_dict) print_verbose("%d time slides identified.\n" % num_slides) @@ -519,8 +516,7 @@ if __name__ == "__main__": if foreground: print_verbose("Reading foreground events:\n", profile=False) xmldoc = read_ligolw(fg_cache) - fg_mi_table = table.get_table( - xmldoc, lsctables.MultiInspiralTable.tableName) + fg_mi_table = lsctables.MultiInspiralTable.get_table(xmldoc) else: fg_mi_table = None if simulations: diff --git a/pylal/bin/pylal_coh_PTF_sbv b/pylal/bin/pylal_coh_PTF_sbv index d1761f01cc963db588a1aef2689bdfd0c5f005b4..ae3d37c2da01c5a88d06cd30ff6ed6e90389a90a 100755 --- a/pylal/bin/pylal_coh_PTF_sbv +++ b/pylal/bin/pylal_coh_PTF_sbv @@ -169,19 +169,17 @@ if __name__ == "__main__": xmldoc = ligolw_utils.load_filename(xmlfile, gz=xmlfile.endswith(".gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) # read ProcesTable - process_table = table.get_table(xmldoc, lsctables.ProcessTable.tableName) + process_table = lsctables.ProcessTable.get_table(xmldoc) ifos = process_table[-1].get_ifos() # read SearchSummaryTable - search_sum_table = table.get_table(xmldoc, - lsctables.SearchSummaryTable.tableName) + search_sum_table = lsctables.SearchSummaryTable.get_table(xmldoc) inseg = search_sum_table[0].get_in() outseg = search_sum_table[0].get_out() # read SimInspiralTable try: - sim_table = table.get_table(xmldoc, - lsctables.SimInspiralTable.tableName) + sim_table = lsctables.SimInspiralTable.get_table(xmldoc) except ValueError: pass else: @@ -189,19 +187,18 @@ if __name__ == "__main__": print_verbose("SimInspiralTable read and copied.\n") # read TimeSlideTable - slide_table = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName) + slide_table = lsctables.TimeSlideTable.get_table(xmldoc) slides = slide_table.as_dict() outxml.childNodes[-1].appendChild(slide_table) print_verbose("TimeSlideTable read and copied.\n") # read MultiInspiralTable - mi_table = table.get_table(xmldoc, lsctables.MultiInspiralTable.tableName) + mi_table = lsctables.MultiInspiralTable.get_table(xmldoc) print_verbose("MultiInspiralTable read, %d events found.\n" % len(mi_table)) # read experiment tables - expr_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) - expr_summ_table = table.get_table( - xmldoc, lsctables.ExperimentSummaryTable.tableName) + expr_table = lsctables.ExperimentTable.get_table(xmldoc) + expr_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) # apply vetoes separately for each experiment pass_mi_table = table.new_from_template(mi_table) diff --git a/pylal/bin/pylal_exttrig_dataquery b/pylal/bin/pylal_exttrig_dataquery index 2710c795b2e144075d4e482396426466d631c51a..63c051b0588a2111f114ed74c88435db3f5f0899 100755 --- a/pylal/bin/pylal_exttrig_dataquery +++ b/pylal/bin/pylal_exttrig_dataquery @@ -70,8 +70,8 @@ def plot_segments_around(gpstime, cat, plotrange, grbtag, useold = False, verbos # load the content of the veto-file xmldoc = utils.load_filename(vetofile, gz = False) - segments = table.get_table(xmldoc, lsctables.SegmentTable.tableName) - segdefs = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) + segments = lsctables.SegmentTable.get_table(xmldoc) + segdefs = lsctables.SegmentDefTable.get_table(xmldoc) # create a mapping between the segments and their definitions defdict = {} @@ -195,8 +195,7 @@ if opts.grb_file: # open the file and get the SnglInspiral table xmldoc = utils.load_filename(opts.grb_file, gz=opts.grb_file.endswith(".gz")) - ext_table = table.get_table(xmldoc, - lsctables.ExtTriggersTable.tableName) + ext_table = lsctables.ExtTriggersTable.get_table(xmldoc) # extract the required information grb_name = os.path.basename(opts.grb_file)[3:-4] diff --git a/pylal/bin/pylal_exttrig_llpage b/pylal/bin/pylal_exttrig_llpage index bcc08677ffead526348d3f151f89242076b75887..394789e60aab5d7d845b77dbbe5180aa099394d2 100755 --- a/pylal/bin/pylal_exttrig_llpage +++ b/pylal/bin/pylal_exttrig_llpage @@ -979,8 +979,7 @@ onsource_doc = SnglInspiralUtils.ReadSnglInspiralFromFiles(\ # Neeed to work around a bug introduced much earlier: # If no trigger, then no table try: - onsource_trigs = table.get_table(onsource_doc, - lsctables.SnglInspiralTable.tableName) + onsource_trigs = lsctables.SnglInspiralTable.get_table(onsource_doc) except AttributeError: onsource_trigs = [] onsource_coincs = CoincInspiralUtils.coincInspiralTable(onsource_trigs, diff --git a/pylal/bin/pylal_exttrig_llsummary b/pylal/bin/pylal_exttrig_llsummary index c2e106968c2b639e42bbf0014459abb841afea12..06f05bda06da914f91e19d41271ea11655c4dbd0 100755 --- a/pylal/bin/pylal_exttrig_llsummary +++ b/pylal/bin/pylal_exttrig_llsummary @@ -509,8 +509,7 @@ onsource_doc = SnglInspiralUtils.ReadSnglInspiralFromFiles(\ # Neeed to work around a bug introduced much earlier: # If no trigger, then no table try: - onsource_trigs = table.get_table(onsource_doc, - lsctables.SnglInspiralTable.tableName) + onsource_trigs = lsctables.SnglInspiralTable.get_table(onsource_doc) except AttributeError: onsource_trigs = [] onsource_coincs = CoincInspiralUtils.coincInspiralTable(onsource_trigs, diff --git a/pylal/bin/pylal_followup_missed b/pylal/bin/pylal_followup_missed index 1ea72a44b91b0d8424b6ab267c2907ca483aa5ed..60aa24d8a8738d6e9d83477edbe7b618b61be86b 100755 --- a/pylal/bin/pylal_followup_missed +++ b/pylal/bin/pylal_followup_missed @@ -332,7 +332,7 @@ if verbose: coireFile = coireVetoMissedCache.pfnlist()[0] doc = utils.load_filename( coireFile, gz=(coireFile).endswith(".gz") ) try: - processParams = table.get_table(doc, lsctables.ProcessParamsTable.tableName) + processParams = lsctables.ProcessParamsTable.get_table(doc) except: print >>sys.stderr, "Error while reading process_params table from file ", coireFils print >>sys.stderr, "Probably files does not exist" diff --git a/pylal/bin/pylal_grbtimeslide_stats b/pylal/bin/pylal_grbtimeslide_stats index f6d064c12b50d65ad1bb2415b351b6ff376aab7f..fb625b20b908ac298601c566041aa21815408546 100755 --- a/pylal/bin/pylal_grbtimeslide_stats +++ b/pylal/bin/pylal_grbtimeslide_stats @@ -275,7 +275,7 @@ ifo_list = set(opts.ifos[2*i:2*i+2].lower() for i in range(len(opts.ifos)/2)) #get slide amounts shift_unit_vector = dict((ifo, 0) for ifo in ifo_list) # default to 0 -for row in table.get_table(offsource_doc, lsctables.ProcessParamsTable.tableName): +for row in lsctables.ProcessParamsTable.get_table(offsource_doc): for ifo in ifo_list: if row.param == "--%s-slide" % ifo: shift_unit_vector[ifo] = int(float(row.value)) @@ -319,7 +319,7 @@ mc_bins = rate.IrregularBins(opts.mc_boundaries) ############################################################################## # read triggers, veto them, and reconstruct coincidences -triggers = table.get_table(offsource_doc, lsctables.SnglInspiralTable.tableName) +triggers = lsctables.SnglInspiralTable.get_table(offsource_doc) stat = CoincInspiralUtils.coincStatistic(opts.coinc_statistic) coincTable = CoincInspiralUtils.coincInspiralTable(triggers, stat) diff --git a/pylal/bin/pylal_plot_segments b/pylal/bin/pylal_plot_segments index bd2314beedad0865e81e5c59589fc9bb78aec088..80a6e1612b33e8f7584cd1e9a930841096301f65 100644 --- a/pylal/bin/pylal_plot_segments +++ b/pylal/bin/pylal_plot_segments @@ -123,7 +123,7 @@ if __name__ == "__main__": for fp in segfiles: if xml.search(fp): xmldoc = ligolw_utils.load_filename(fp, gz=fp.endswith(".gz")) - seg_table = ligolw_table.get_table(xmldoc, SegmentTable.tableName) + seg_table = SegmentTable.get_table(xmldoc) try: seg_table.getColumnByName("start_time_ns") except KeyError: @@ -135,8 +135,7 @@ if __name__ == "__main__": for row in seg_table: segments["_"].append(row.get()) else: - seg_def_table = ligolw_table.get_table(xmldoc, - SegmentDefTable.tableName) + seg_def_table = SegmentDefTable.get_table(xmldoc) flags = dict() for row in seg_def_table: ifo = "".join(sorted(row.get_ifos())) diff --git a/pylal/bin/pylal_relic b/pylal/bin/pylal_relic index 5f1e3fd1b6c75d33a342e6ec8588d1e009c9427f..948b0a832357be46c5ad8530f3e021041be415ad 100755 --- a/pylal/bin/pylal_relic +++ b/pylal/bin/pylal_relic @@ -103,8 +103,7 @@ def keep_only_loudest_events_by_cat(xmldoc, coincstat, mc_bins, mc_ifo_cats, kee """ # read unclustered on-source coincs try: - onsource_trigs = table.get_table(xmldoc, - lsctables.SnglInspiralTable.tableName) + onsource_trigs = lsctables.SnglInspiralTable.get_table(xmldoc) except ValueError: onsource_trigs = lsctables.New(lsctables.SnglInspiralTable) xmldoc.childNodes[0].appendChild(onsource_trigs) @@ -140,8 +139,7 @@ def get_loudest_stats_by_trial_slide_cat(onoff_doc, coinc_stat, (mchirp_ind, IFO) combos. """ # read unclustered background coincs - tables = table.getTablesByName(onoff_doc, - lsctables.SnglInspiralTable.tableName) + tables = lsctables.SnglInspiralTable.getTablesByName(onoff_doc) if len(tables) == 1: onoff_trigs = tables[0] elif len(tables) == 0: @@ -170,7 +168,7 @@ def get_loudest_stats_by_inj_cat(inj_doc, coinc_doc, coinc_stat, trial_bins, Categories object to bin up the (mchirp_ind, IFO) combos. """ # get injection info - sims = table.get_table(inj_doc, lsctables.SimInspiralTable.tableName) + sims = lsctables.SimInspiralTable.get_table(inj_doc) sim_trials = [trial_bins[s.geocent_end_time] for s in sims] # sanity check: no two injections went into the same trial @@ -178,8 +176,7 @@ def get_loudest_stats_by_inj_cat(inj_doc, coinc_doc, coinc_stat, trial_bins, # get coincs try: - inj_trigs = table.get_table(coinc_doc, - lsctables.SnglInspiralTable.tableName) + inj_trigs = lsctables.SnglInspiralTable.get_table(coinc_doc) except ValueError: print "WARNING: coinc_doc contains no triggers." inj_trigs = lsctables.New(lsctables.SnglInspiralTable) @@ -368,7 +365,7 @@ num_trials_buffers_onsource = abs(buffer_segs) // trial_len # get slide amounts in seconds shift_unit_vector = dict((ifo, 0) for ifo in ifo_list) # default to 0 -for row in table.get_table(onoff_doc, lsctables.ProcessParamsTable.tableName): +for row in lsctables.ProcessParamsTable.get_table(onoff_doc): for ifo in ifo_list: if row.param == "--%s-slide" % ifo: shift_unit_vector[ifo] = int(float(row.value)) @@ -452,7 +449,7 @@ if opts.write_onsource: # remove non-zero lag coincs # FIXME: fix this code when we get new-style coincs - onoff_triggers = table.get_table(onoff_doc, lsctables.SnglInspiralTable.tableName) + onoff_triggers = lsctables.SnglInspiralTable.get_table(onoff_doc) iterutils.inplace_filter(lambda c: c.get_id_parts()[1] == 0, onoff_triggers) # filter the document to contain only the loudest event in each MC bin diff --git a/pylal/bin/pylal_summary_page b/pylal/bin/pylal_summary_page index 9e8fc2fc311f4941b54ed202040ba50f0f180ef8..ceff1a9b4ef35440a16b66c8fe701a3c29826aac 100755 --- a/pylal/bin/pylal_summary_page +++ b/pylal/bin/pylal_summary_page @@ -2060,7 +2060,7 @@ def archive_triggers(outdir, start, end, param_dict, clustered=False): G_TRIGGERS[etg][channel].iteritems()) for i,(seg,trig_table) in enumerate(global_triggers): try: - event_table = table.get_table(xmldoc, trig_table.tableName) + event_table = trig_table.get_table(xmldoc) except ValueError: event_table = table.new_from_template(trig_table) xmldoc.childNodes[-1].appendChild(event_table) @@ -2391,12 +2391,10 @@ def load_archive_segments(cp, flag, seglist, mode=0, verbose=False): with open(fp, "r") as f: xmldoc, digest = ligolw_utils.load_fileobj( f, gz=fp.endswith(".gz")) - seg_def_table = table.get_table( - xmldoc, lsctables.SegmentDefTable.tableName) + seg_def_table = lsctables.SegmentDefTable.get_table(xmldoc) seg_def_ids = [row.segment_def_id for row in seg_def_table if row.name == name and row.version == version] - seg_sum_table = table.get_table( - xmldoc, lsctables.SegmentSumTable.tableName) + seg_sum_table = lsctables.SegmentSumTable.get_table(xmldoc) seg_sum_list = SegmentList() for row in seg_sum_table: if row.segment_def_id in seg_def_ids: @@ -2405,8 +2403,7 @@ def load_archive_segments(cp, flag, seglist, mode=0, verbose=False): else: seg = Segment(row.start_time, row.end_time) seg_sum_list.append(seg) - seg_table = table.get_table(xmldoc, - lsctables.SegmentTable.tableName) + seg_table = lsctables.SegmentTable.get_table(xmldoc) seg_list = SegmentList() for row in seg_table: if row.segment_def_id in seg_def_ids: @@ -2504,8 +2501,7 @@ def load_archive_triggers(cp, ifo, channel, etg, segment_list, mode=0, f, gz=fp.endswith(".gz")) # load segment table try: - seg_table = table.get_table( - xmldoc, lsctables.SegmentTable.tableName) + seg_table = lsctables.SegmentTable.get_table(xmldoc) except: seg_table = [] # load trigger table @@ -2513,15 +2509,12 @@ def load_archive_triggers(cp, ifo, channel, etg, segment_list, mode=0, "gstlal_excesspower"]: events = lsctables.New(lsctables.SnglBurstTable, columns=columns) - events.extend(table.get_table( - xmldoc, - lsctables.SnglBurstTable.tableName)) + events.extend(lsctables.SnglBurstTable.get_table(xmldoc)) elif re.search("(inspiral|ihope)", etg, re.I): events = lsctables.New(lsctables.SnglInspiralTable, columns=columns) - events.extend(table.get_table( - xmldoc, - lsctables.SnglInspiralTable.tableName)) + events.extend(lsctables.SnglInspiralTable.get_table( + xmldoc)) # map triggers to segments for row in seg_table: segment_events = lsctables.New(type(events), diff --git a/pylal/bin/ring_post b/pylal/bin/ring_post index 2bd519dcba8047ddedbf507f9d82c9f899059a73..f2a6bc85d001debb2e00e64d6151d776c077c0d8 100755 --- a/pylal/bin/ring_post +++ b/pylal/bin/ring_post @@ -78,7 +78,7 @@ class Tisi(object): def make_doc(self, options): while self.time_slides: doc = self.new_doc() - timeslidetable = table.get_table(doc, lsctables.TimeSlideTable.tableName) + timeslidetable = lsctables.TimeSlideTable.get_table(doc) process = ligolw_tisi.append_process(doc, **options.__dict__) N = int(round(float(len(self.time_slides)) / len(self.filenames))) while N: diff --git a/pylal/bin/search_volume b/pylal/bin/search_volume index d9b6de3d61dcabe8513f3c677578729d44883e0f..067a52ae977a3d0e5b921f5a42b5f7dfe73131a7 100755 --- a/pylal/bin/search_volume +++ b/pylal/bin/search_volume @@ -60,7 +60,7 @@ class upper_limit(object): # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -245,7 +245,7 @@ class upper_limit(object): connection = sqlite3.connect(working_filename) connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols for values in connection.cursor().execute(""" SELECT diff --git a/pylal/bin/search_volume_by_m1_m2 b/pylal/bin/search_volume_by_m1_m2 index 5cdf01fc342c5c0d571f9dc2a7e6d36a11688f5c..0d14b9b28785097ad5d0f975dc5aa0776ddf5ed5 100755 --- a/pylal/bin/search_volume_by_m1_m2 +++ b/pylal/bin/search_volume_by_m1_m2 @@ -70,7 +70,7 @@ class upper_limit(object): sim = False # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -78,15 +78,15 @@ class upper_limit(object): # FIGURE OUT IF IT IS A BURST OR INSPIRAL RUN OR RINGDOWN RUN try: - self.multi_burst_table = table.get_table(xmldoc, dbtables.lsctables.MultiBurstTable.tableName) + self.multi_burst_table = dbtables.lsctables.MultiBurstTable.get_table(xmldoc) except ValueError: self.multi_burst_table = None try: - self.coinc_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.CoincInspiralTable.tableName) + self.coinc_inspiral_table = dbtables.lsctables.CoincInspiralTable.get_table(xmldoc) except ValueError: self.coinc_inspiral_table = None try: - self.coinc_ringdown_table = table.get_table(xmldoc, dbtables.lsctables.CoincRingdownTable.tableName) + self.coinc_ringdown_table = dbtables.lsctables.CoincRingdownTable.get_table(xmldoc) except ValueError: self.coinc_ringdown_table = None @@ -357,7 +357,7 @@ class upper_limit(object): return lsctables.LIGOTimeGPS(geocent_end_time, geocent_end_time_ns) in zero_lag_segments connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols # INSPIRAL if self.coinc_inspiral_table is not None: diff --git a/pylal/bin/search_volume_by_m_chi b/pylal/bin/search_volume_by_m_chi index f3426708ac4d13ff91a6217ceeb90bd60c75729d..1fb4d781cde6530358cc8f6131249bf421167f6e 100644 --- a/pylal/bin/search_volume_by_m_chi +++ b/pylal/bin/search_volume_by_m_chi @@ -73,7 +73,7 @@ class upper_limit(object): sim = False # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -81,15 +81,15 @@ class upper_limit(object): # FIGURE OUT IF IT IS A BURST OR INSPIRAL RUN OR RINGDOWN RUN try: - self.multi_burst_table = table.get_table(xmldoc, dbtables.lsctables.MultiBurstTable.tableName) + self.multi_burst_table = dbtables.lsctables.MultiBurstTable.get_table(xmldoc) except ValueError: self.multi_burst_table = None try: - self.coinc_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.CoincInspiralTable.tableName) + self.coinc_inspiral_table = dbtables.lsctables.CoincInspiralTable.get_table(xmldoc) except ValueError: self.coinc_inspiral_table = None try: - self.coinc_ringdown_table = table.get_table(xmldoc, dbtables.lsctables.CoincRingdownTable.tableName) + self.coinc_ringdown_table = dbtables.lsctables.CoincRingdownTable.get_table(xmldoc) except ValueError: self.coinc_ringdown_table = None @@ -364,7 +364,7 @@ class upper_limit(object): return lsctables.LIGOTimeGPS(geocent_end_time, geocent_end_time_ns) in zero_lag_segments connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols # INSPIRAL if self.coinc_inspiral_table is not None: diff --git a/pylal/bin/search_volume_by_s1z_s2z b/pylal/bin/search_volume_by_s1z_s2z index 99d6847829f703f06f1dee91eaaa7ccca37e658d..f1ac63c410d9e1178fd2f9cf140952671599a148 100755 --- a/pylal/bin/search_volume_by_s1z_s2z +++ b/pylal/bin/search_volume_by_s1z_s2z @@ -70,7 +70,7 @@ class upper_limit(object): sim = False # look for a sim table try: - sim_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.SimInspiralTable.tableName) + sim_inspiral_table = dbtables.lsctables.SimInspiralTable.get_table(xmldoc) self.inj_fnames.append(f) sim = True except ValueError: @@ -78,15 +78,15 @@ class upper_limit(object): # FIGURE OUT IF IT IS A BURST OR INSPIRAL RUN OR RINGDOWN RUN try: - self.multi_burst_table = table.get_table(xmldoc, dbtables.lsctables.MultiBurstTable.tableName) + self.multi_burst_table = dbtables.lsctables.MultiBurstTable.get_table(xmldoc) except ValueError: self.multi_burst_table = None try: - self.coinc_inspiral_table = table.get_table(xmldoc, dbtables.lsctables.CoincInspiralTable.tableName) + self.coinc_inspiral_table = dbtables.lsctables.CoincInspiralTable.get_table(xmldoc) except ValueError: self.coinc_inspiral_table = None try: - self.coinc_ringdown_table = table.get_table(xmldoc, dbtables.lsctables.CoincRingdownTable.tableName) + self.coinc_ringdown_table = dbtables.lsctables.CoincRingdownTable.get_table(xmldoc) except ValueError: self.coinc_ringdown_table = None @@ -382,7 +382,7 @@ class upper_limit(object): return lsctables.LIGOTimeGPS(geocent_end_time, geocent_end_time_ns) in zero_lag_segments connection.create_function("injection_was_made", 2, injection_was_made) - make_sim_inspiral = lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols + make_sim_inspiral = lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols # INSPIRAL if self.coinc_inspiral_table: diff --git a/pylal/pylal/CoincInspiralUtils.py b/pylal/pylal/CoincInspiralUtils.py index bc00071c734a8b4833161229daac5fa5c41476e3..258239adf36427989b2762373aca8fd7823a05d5 100644 --- a/pylal/pylal/CoincInspiralUtils.py +++ b/pylal/pylal/CoincInspiralUtils.py @@ -93,15 +93,13 @@ def readCoincInspiralFromFiles(fileList,statistic=None): doc = utils.load_filename(thisFile, gz = (thisFile or "stdin").endswith(".gz"), contenthandler=ExtractCoincInspiralTableLIGOLWContentHandler) # extract the sim inspiral table try: - simInspiralTable = \ - table.get_table(doc, lsctables.SimInspiralTable.tableName) + simInspiralTable = lsctables.SimInspiralTable.get_table(doc) if sims: sims.extend(simInspiralTable) else: sims = simInspiralTable except: simInspiralTable = None # extract the sngl inspiral table, construct coincs - try: snglInspiralTable = \ - table.get_table(doc, lsctables.SnglInspiralTable.tableName) + try: snglInspiralTable = lsctables.SnglInspiralTable.get_table(doc) except: snglInspiralTable = None if snglInspiralTable: coincFromFile = coincInspiralTable(snglInspiralTable,statistic) diff --git a/pylal/pylal/InspiralUtils.py b/pylal/pylal/InspiralUtils.py index 1f71dab34cb6da07c42b88f2ce8da7ffb7d5cd8a..a1744ce61cfdbbdace14c9c2c56553f95baa2a2a 100644 --- a/pylal/pylal/InspiralUtils.py +++ b/pylal/pylal/InspiralUtils.py @@ -828,7 +828,7 @@ def readHorizonDistanceFromSummValueTable(fList, verbose=False, contenthandler=S doc = utils.load_filename(thisFile, contenthandler = contenthandler) try: - summ_value_table = table.get_table(doc, lsctables.SummValueTable.tableName) + summ_value_table = lsctables.SummValueTable.get_table(doc) except ValueError: print "ValueError in readHorizonDistanceFromSummValueTable while reading summvalue table from file ", thisFile return output,massOutput diff --git a/pylal/pylal/MultiInspiralUtils.py b/pylal/pylal/MultiInspiralUtils.py index c617c8f6575346793012156ccbcf6829407b39ab..237fe814b88cb38d3e108913f9693106b8719844 100644 --- a/pylal/pylal/MultiInspiralUtils.py +++ b/pylal/pylal/MultiInspiralUtils.py @@ -56,8 +56,7 @@ def ReadMultiInspiralFromFiles(fileList): gz=(thisFile or "stdin").endswith(".gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) # extract the multi inspiral table try: - multiInspiralTable = table.get_table(doc, - lsctables.MultiInspiralTable.tableName) + multiInspiralTable = lsctables.MultiInspiralTable.get_table(doc) if multis: multis.extend(multiInspiralTable) else: multis = multiInspiralTable except: multiInspiralTable = None @@ -80,8 +79,7 @@ def ReadMultiInspiralTimeSlidesFromFiles(fileList,generate_output_tables=False): doc = utils.load_filename(thisFile, gz=(thisFile or "stdin").endswith(".gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) # Extract the time slide table - timeSlideTable = table.get_table(doc, - lsctables.TimeSlideTable.tableName) + timeSlideTable = lsctables.TimeSlideTable.get_table(doc) slideMapping = {} currSlides = {} # NOTE: I think some of this is duplicated in the glue definition of the @@ -106,14 +104,12 @@ def ReadMultiInspiralTimeSlidesFromFiles(fileList,generate_output_tables=False): # Get the mapping table segmentMap = {} - timeSlideMapTable = table.get_table(doc, - lsctables.TimeSlideSegmentMapTable.tableName) + timeSlideMapTable = lsctables.TimeSlideSegmentMapTable.get_table(doc) for entry in timeSlideMapTable: segmentMap[int(entry.segment_def_id)] = int(entry.time_slide_id) # Extract the segment table - segmentTable = table.get_table(doc, - lsctables.SegmentTable.tableName) + segmentTable = lsctables.SegmentTable.get_table(doc) for entry in segmentTable: currSlidId = segmentMap[int(entry.segment_def_id)] currSeg = entry.get() @@ -124,8 +120,7 @@ def ReadMultiInspiralTimeSlidesFromFiles(fileList,generate_output_tables=False): # extract the multi inspiral table try: - multiInspiralTable = table.get_table(doc, - lsctables.MultiInspiralTable.tableName) + multiInspiralTable = lsctables.MultiInspiralTable.get_table(doc) # Remap the time slide IDs for multi in multiInspiralTable: newID = slideMapping[int(multi.time_slide_id)] diff --git a/pylal/pylal/SimInspiralUtils.py b/pylal/pylal/SimInspiralUtils.py index 1ad76ad819a240a701d9f966fc5c5a67767a5f2a..c3905bbaf069c349c6ce8e32c4f17d3292a88779 100644 --- a/pylal/pylal/SimInspiralUtils.py +++ b/pylal/pylal/SimInspiralUtils.py @@ -62,8 +62,7 @@ def ReadSimInspiralFromFiles(fileList, verbose=False): for thisFile in fileList: doc = utils.load_filename(thisFile, gz=(thisFile or "stdin").endswith(".gz"), verbose=verbose, contenthandler=ExtractSimInspiralTableLIGOLWContentHandler) # extract the sim inspiral table - try: simInspiralTable = \ - table.get_table(doc, lsctables.SimInspiralTable.tableName) + try: simInspiralTable = lsctables.SimInspiralTable.get_table(doc) except: simInspiralTable = None if simInspiralTriggers and simInspiralTable: simInspiralTriggers.extend(simInspiralTable) diff --git a/pylal/pylal/SnglInspiralUtils.py b/pylal/pylal/SnglInspiralUtils.py index 40ffcdfba5382b59ea08def6713d6a629cd39ab6..530c3379d8ad5d8e7409a029af24c5ef56ca6112 100644 --- a/pylal/pylal/SnglInspiralUtils.py +++ b/pylal/pylal/SnglInspiralUtils.py @@ -100,7 +100,7 @@ def ReadSnglInspiralFromFiles(fileList, verbose=False, filterFunc=None): if verbose: print str(i+1)+"/"+str(len(fileList))+": " xmldoc = utils.load_filename(file, verbose=verbose, contenthandler=ExtractSnglInspiralTableLIGOLWContentHandler) try: - sngl_table = table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + sngl_table = lsctables.SnglInspiralTable.get_table(xmldoc) if filterFunc is not None: iterutils.inplace_filter(filterFunc, sngl_table) except ValueError: #some xml files have no sngl table, that's OK @@ -159,14 +159,14 @@ def ReadSnglInspiralsForPipelineStage(xmldoc, slideDict, stage): @param stage: the name of the stage (INSPIRAL_FIRST, THINCA_0_CAT_2, etc) """ - sngls_tbl = table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + sngls_tbl = lsctables.SnglInspiralTable.get_table(xmldoc) if 'THINCA' in stage and slideDict: # get the time-slides as a dictionary - time_slide_tbl = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName) + time_slide_tbl = lsctables.TimeSlideTable.get_table(xmldoc) time_slide_dict = time_slide_tbl.as_dict() - coinc_event_tbl = table.get_table(xmldoc, lsctables.CoincTable.tableName) - coinc_map_tbl = table.get_table(xmldoc, lsctables.CoincMapTable.tableName) + coinc_event_tbl = lsctables.CoincTable.get_table(xmldoc) + coinc_map_tbl = lsctables.CoincMapTable.get_table(xmldoc) # get the time_slide_ids that have time_slide_ids = set() diff --git a/pylal/pylal/bayespputils.py b/pylal/pylal/bayespputils.py index 77a62521f5132b1de40ce950ddee0fddd9ddc8f1..933138fb816d511b91086c5aa9f10840f36f91b9 100644 --- a/pylal/pylal/bayespputils.py +++ b/pylal/pylal/bayespputils.py @@ -7136,7 +7136,7 @@ def plot_burst_waveform(pos=None,simburst=None,event=0,path=None,ifos=['H1','L1' skip=0 try: xmldoc = utils.load_filename(simburst,contenthandler=LIGOLWContentHandlerExtractSimBurstTable) - tbl = lsctables.table.get_table(xmldoc, lsctables.SimBurstTable.tableName) + tbl = lsctables.SimBurstTable.get_table(xmldoc) if event>0: tbl=tbl[event] else: diff --git a/pylal/pylal/cbc_table_utils.py b/pylal/pylal/cbc_table_utils.py index 1734f7d37e939a2fa8a421a4026967a646693cd0..702fd6f0222f3063298c80826e7b90cbd2c321e2 100644 --- a/pylal/pylal/cbc_table_utils.py +++ b/pylal/pylal/cbc_table_utils.py @@ -68,10 +68,10 @@ def depopulate_sngl_inspiral(xmldoc, verbose = False): tables and determine the difference, such that the newlist contains only non-coinc single-ifo triggers. Then it remove these non-coinc triggers from the sngl_inspiral table. """ - sngls_tbl = lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + sngls_tbl = lsctables.SnglInspiralTable.table.get_table(xmldoc) sngls_tbl_eid = sngls_tbl.getColumnByName("event_id") - coinc_map_tbl = lsctables.table.get_table(xmldoc, lsctables.CoincMapTable.tableName) + coinc_map_tbl = lsctables.CoincMapTable.get_table(xmldoc) if len(coinc_map_tbl) == 0: if verbose: @@ -103,8 +103,8 @@ def depopulate_sngl_inspiral(xmldoc, verbose = False): def remove_process_rows(xmldoc, process_ids, verbose = False): - proc_tbl = table.get_table(xmldoc, lsctables.ProcessTable.tableName) - proc_param_tbl = table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName) + proc_tbl = lsctables.ProcessTable.get_table(xmldoc) + proc_param_tbl = lsctables.ProcessParamsTable.get_table(xmldoc) # Remove rows in process table whose process_id are found in sd_pids len_p_tbl = len(proc_tbl) @@ -131,9 +131,9 @@ def drop_segment_tables(xmldoc, verbose = False): xmldoc. In addition, remove the rows in the process & process_params tables that have process_ids found in the segment_definer table. """ - seg_tbl = table.get_table(xmldoc, lsctables.SegmentTable.tableName) - seg_sum_tbl = table.get_table(xmldoc, lsctables.SegmentSumTable.tableName) - seg_def_tbl = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) + seg_tbl = lsctables.SegmentTable.get_table(xmldoc) + seg_sum_tbl = lsctables.SegmentSumTable.get_table(xmldoc) + seg_def_tbl = lsctables.SegmentDefTable.get_table(xmldoc) # determine the unique process_ids for the segment tables sd_pids = set(seg_def_tbl.getColumnByName("process_id")) @@ -158,7 +158,7 @@ def drop_vetodef_table(xmldoc, verbose = False): process & process_params tables that have process_ids found in the veto_definer table. """ - veto_def_tbl = table.get_table(xmldoc, lsctables.VetoDefTable.tableName) + veto_def_tbl = lsctables.VetoDefTable.get_table(xmldoc) # determine the unique process_ids for the segment tables vd_pids = set(veto_def_tbl.getColumnByName("process_id")) @@ -197,7 +197,7 @@ def depopulate_experiment_tables(xmldoc, verbose = False): # try: - experiment_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) + experiment_table = lsctables.ExperimentTable.get_table(xmldoc) except ValueError: # no table --> no-op if verbose: @@ -205,7 +205,7 @@ def depopulate_experiment_tables(xmldoc, verbose = False): return try: - experiment_summ_table = table.get_table(xmldoc, lsctables.ExperimentSummaryTable.tableName) + experiment_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) except ValueError: # no table --> no-op if verbose: @@ -259,7 +259,7 @@ def get_experiment_times(xmldoc): the experiment times. This presumes that the vetoes file has been added to the file being analyzed. """ - segment_summary_tbl = lsctables.table.get_table(xmldoc, lsctables.SegmentSumTable.tableName) + segment_summary_tbl = lsctables.SegmentSumTable.get_table(xmldoc) expr_start_time = min(segment_summary_tbl.getColumnByName("start_time")) expr_end_time = max(segment_summary_tbl.getColumnByName("end_time")) @@ -298,7 +298,7 @@ def populate_experiment_table( # find the experiment table or create one if needed try: - expr_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) + expr_table = lsctables.ExperimentTable.get_table(xmldoc) except ValueError: expr_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.ExperimentTable)) @@ -336,7 +336,7 @@ def get_experiment_type(xmldoc, time_slide_dict): one entry, then the triggers are from a slide run. """ # get the param column of the process_params table - process_params_tbl = lsctables.table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName) + process_params_tbl = lsctables.ProcessParamsTable.get_table(xmldoc) pp_value = set(process_params_tbl.getColumnByName("value")) pp_param = set(process_params_tbl.getColumnByName("param")) @@ -382,7 +382,7 @@ def populate_experiment_summ_table( # find the experiment_summary table or create one if needed try: - expr_summ_table = table.get_table(xmldoc, lsctables.ExperimentSummaryTable.tableName) + expr_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) except ValueError: expr_summ_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.ExperimentSummaryTable)) @@ -406,7 +406,7 @@ def populate_experiment_summ_table( break def get_on_instruments(xmldoc, trigger_program): - process_tbl = table.get_table(xmldoc, lsctables.ProcessTable.tableName) + process_tbl = lsctables.ProcessTable.get_table(xmldoc) instruments = set([]) for row in process_tbl: if row.program == trigger_program: @@ -430,12 +430,12 @@ def generate_experiment_tables(xmldoc, **cmdline_opts): # find the experiment & experiment_summary table or create one if needed try: - table.get_table(xmldoc, lsctables.ExperimentSummaryTable.tableName) + lsctables.ExperimentSummaryTable.get_table(xmldoc) except ValueError: xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.ExperimentSummaryTable)) try: - table.get_table(xmldoc, lsctables.ExperimentTable.tableName) + lsctables.ExperimentTable.get_table(xmldoc) except ValueError: xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.ExperimentTable)) @@ -452,7 +452,7 @@ def generate_experiment_tables(xmldoc, **cmdline_opts): ) # Get the time_slide table as dict - time_slide_dict = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName).as_dict() + time_slide_dict = lsctables.TimeSlideTable.get_table(xmldoc).as_dict() # Populate the experiment_summary table for instruments in experiment_ids: @@ -475,7 +475,7 @@ def populate_experiment_map(xmldoc, veto_def_name, verbose = False): print >> sys.stderr, "\tMapping coinc events to experiment_summary table..." try: - expr_map_table = table.get_table(xmldoc, lsctables.ExperimentMapTable.tableName) + expr_map_table = lsctables.ExperimentMapTable.get_table(xmldoc) except ValueError: expr_map_table = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.ExperimentMapTable)) @@ -483,26 +483,26 @@ def populate_experiment_map(xmldoc, veto_def_name, verbose = False): # find the coinc_event table # - coinc_event_table = table.get_table(xmldoc, lsctables.CoincTable.tableName) + coinc_event_table = lsctables.CoincTable.get_table(xmldoc) # # Index the coinc_inspiral table as a dictionary # - coinc_index = dict((row.coinc_event_id, row) for row in table.get_table(xmldoc, lsctables.CoincInspiralTable.tableName)) + coinc_index = dict((row.coinc_event_id, row) for row in lsctables.CoincInspiralTable.get_table(xmldoc)) # # Get the time_slide_table as dict # - time_slide_dict = table.get_table(xmldoc, lsctables.TimeSlideTable.tableName).as_dict() + time_slide_dict = lsctables.TimeSlideTable.get_table(xmldoc).as_dict() # # find the experiment & experiment summary tables # - expr_table = table.get_table(xmldoc, lsctables.ExperimentTable.tableName) - expr_summ_table = table.get_table(xmldoc, lsctables.ExperimentSummaryTable.tableName) + expr_table = lsctables.ExperimentTable.get_table(xmldoc) + expr_summ_table = lsctables.ExperimentSummaryTable.get_table(xmldoc) # # determine what experiment datatypes are in this file diff --git a/pylal/pylal/db_rinca_rings.py b/pylal/pylal/db_rinca_rings.py index 31e869025ef69064e2eb704d5ca9d21a6b60cc52..297f2c251c020899fa2023365ea391a0c2b51674 100644 --- a/pylal/pylal/db_rinca_rings.py +++ b/pylal/pylal/db_rinca_rings.py @@ -61,7 +61,7 @@ def get_rinca_rings_by_available_instruments(connection, program_name = "rinca") xmldoc = dbtables.get_xml(connection) seglists = segments.segmentlistdict() - for row in map(dbtables.table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName).row_from_cols, connection.cursor().execute(""" + for row in map(lsctables.SearchSummaryTable.get_table(xmldoc).row_from_cols, connection.cursor().execute(""" SELECT search_summary.* FROM @@ -146,7 +146,7 @@ def get_background_offset_vectors(connection): mapping instrument name to offset. """ xmldoc = dbtables.get_xml(connection) - offset_vectors = [offsetvector for offsetvector in dbtables.table.get_table(xmldoc, lsctables.TimeSlideTable.tableName).as_dict().values() if any(offsetvector.values())] + offset_vectors = [offsetvector for offsetvector in lsctables.TimeSlideTable.get_table(xmldoc).as_dict().values() if any(offsetvector.values())] xmldoc.unlink() return offset_vectors diff --git a/pylal/pylal/db_thinca_rings.py b/pylal/pylal/db_thinca_rings.py index f28ec4d5a00df3b1db4fc47f3d30e54c0daa3d62..62b380ecb80e64ce8189d8398e76bb67a180023b 100644 --- a/pylal/pylal/db_thinca_rings.py +++ b/pylal/pylal/db_thinca_rings.py @@ -61,7 +61,7 @@ def get_thinca_rings_by_available_instruments(connection, program_name = "thinca xmldoc = dbtables.get_xml(connection) seglists = segments.segmentlistdict() - for row in map(dbtables.table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName).row_from_cols, connection.cursor().execute(""" + for row in map(lsctables.SearchSummaryTable.get_table(xmldoc).row_from_cols, connection.cursor().execute(""" SELECT search_summary.* FROM @@ -146,7 +146,7 @@ def get_background_offset_vectors(connection): mapping instrument name to offset. """ xmldoc = dbtables.get_xml(connection) - offset_vectors = [offsetvector for offsetvector in dbtables.table.get_table(xmldoc, lsctables.TimeSlideTable.tableName).as_dict().values() if any(offsetvector.values())] + offset_vectors = [offsetvector for offsetvector in lsctables.TimeSlideTable.get_table(xmldoc).as_dict().values() if any(offsetvector.values())] xmldoc.unlink() return offset_vectors diff --git a/pylal/pylal/dq/dqSegmentUtils.py b/pylal/pylal/dq/dqSegmentUtils.py index 2db1f1fefa712669e2d0b50df4689136f2bfe351..e0f358d1182e20d27b17d992dad692b4d46e9e25 100755 --- a/pylal/pylal/dq/dqSegmentUtils.py +++ b/pylal/pylal/dq/dqSegmentUtils.py @@ -79,8 +79,8 @@ def fromsegmentxml(file, dict=False, id=None): # load xmldocument and SegmentDefTable and SegmentTables xmldoc, digest = utils.load_fileobj(file, gz=file.name.endswith(".gz"), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - seg_def_table = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) - seg_table = table.get_table(xmldoc, lsctables.SegmentTable.tableName) + seg_def_table = lsctables.SegmentDefTable.get_table(xmldoc) + seg_table = lsctables.SegmentTable.get_table(xmldoc) if dict: segs = segments.segmentlistdict() @@ -345,7 +345,7 @@ def dump_flags(ifos=None, segment_url=None, match=None, unmatch=None,\ reply = StringIO(myClient.query(squery)) xmldoc, digest = utils.load_fileobj(reply) - seg_def_table = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) + seg_def_table = lsctables.SegmentDefTable.get_table(xmldoc) # sort table by ifo, name and version seg_def_table.sort(key=lambda flag: (flag.ifos[0], flag.name, \ diff --git a/pylal/pylal/exttrig_dataquery.py b/pylal/pylal/exttrig_dataquery.py index d7a5c8c891c1f914e2740c3b836157ad2e4d64b0..d3418f5326fb6ce0a2b555a16b5340070e1bd416 100755 --- a/pylal/pylal/exttrig_dataquery.py +++ b/pylal/pylal/exttrig_dataquery.py @@ -314,8 +314,8 @@ def exttrig_dataquery(grb_name, grb_time, grb_ra, grb_dec, offset, config_file, # load the content of the veto-file xmldoc = utils.load_filename(xmlsegfile, gz = False, contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - segs = table.get_table(xmldoc, lsctables.SegmentTable.tableName) - segdefs = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) + segs = lsctables.SegmentTable.get_table(xmldoc) + segdefs = lsctables.SegmentDefTable.get_table(xmldoc) # create a mapping between the segments and their definitions defdict = {} @@ -578,8 +578,8 @@ def exttrig_dataquery(grb_name, grb_time, grb_ra, grb_dec, offset, config_file, for ifo in ifolist: vetofile = "%s-VETOTIME_CAT%s_grb%s.xml" % (ifo, cat, grb_name) xmldoc = utils.load_filename(vetofile, gz = False, contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - segs = table.get_table(xmldoc, lsctables.SegmentTable.tableName) - segdefs = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) + segs = lsctables.SegmentTable.get_table(xmldoc) + segdefs = lsctables.SegmentDefTable.get_table(xmldoc) vetodict[ifo] = segments.segmentlist(segments.segment(s.start_time, s.end_time) for s in segs) if vetodict: @@ -595,7 +595,7 @@ if __name__ == "__main__": # get time, RA, DEC and name of GRB; get offset to search from GRB time if opts.grb_file: xmldoc = utils.load_filename(opts.grb_file, gz=opts.grb_file.endswith('.gz'), contenthandler = lsctables.use_in(ligolw.LIGOLWContentHandler)) - ext_table = table.get_table(xmldoc,lsctables.ExtTriggersTable.tableName) + ext_table = lsctables.ExtTriggersTable.get_table(xmldoc) grb_time = ext_table[0].start_time grb_name = os.path.basename(opts.grb_file)[3:-4] grb_ra = ext_table[0].event_ra diff --git a/pylal/pylal/followup_missed.py b/pylal/pylal/followup_missed.py index 3427abd0bd9795c8aa430cd33a68be0980b020d6..c9a0eedf55f36c4803d6a3d283cff4c0febc7467 100755 --- a/pylal/pylal/followup_missed.py +++ b/pylal/pylal/followup_missed.py @@ -145,8 +145,7 @@ class FollowupMissed: coire_file = self.cache.sieve(description = "FOUND").checkfilesexist()[0].pfnlist()[0] try: doc = SearchSummaryUtils.ReadTablesFromFiles([coire_file],[ lsctables.ProcessParamsTable]) - process_params = table.get_table(doc, lsctables.ProcessParamsTable.\ - tableName) + process_params = lsctables.ProcessParamsTable.get_table(doc) except IOError: sys.stderr.write("ERROR (IOError) while reading process_params table from file %s. "\ "Does this file exist and does it contain a search_summary table?\n" %(coire_file)) diff --git a/pylal/pylal/followup_trigger.py b/pylal/pylal/followup_trigger.py index 85bd77d6a088e78d5bd198b32fb107eafd4627a7..36a298bbb85add31960a3a16a7c94df3c75c28b2 100755 --- a/pylal/pylal/followup_trigger.py +++ b/pylal/pylal/followup_trigger.py @@ -269,10 +269,8 @@ class FollowupTrigger: # read in the 'converted' injection doc = ligolw_add.ligolw_add(ligolw.Document(), [file2]) - inj_sned = lsctables.table.getTablesByName(doc, lsctables.SimInspiralTable.tableName) - # return a single SimInspiral table - return inj_sned[0] + return = lsctables.SimInspiralTable.get_table(doc) # ----------------------------------------------------- def setTag(self, tag): @@ -313,8 +311,7 @@ class FollowupTrigger: try: doc = SearchSummaryUtils.ReadTablesFromFiles([coire_file],\ [lsctables.ProcessParamsTable]) - process_params = table.get_table(doc, lsctables.ProcessParamsTable.\ - tableName) + process_params = lsctables.ProcessParamsTable.get_table(doc) except IOError: sys.stderr.write("ERROR (IOError) while reading process_params table from"\ " file %s. Does this file exist and does it contain"\ @@ -615,8 +612,7 @@ class FollowupTrigger: xmldoc = utils.load_filename(file, verbose=self.verbose, contenthandler=ContentHandler) try: - sngl_table = table.get_table(xmldoc, - lsctables.SnglInspiralTable.tableName) + sngl_table = lsctables.SnglInspiralTable.get_table(xmldoc) except ValueError: # Some files have no sngl table. That's okay xmldoc.unlink() # Free memory continue diff --git a/pylal/pylal/fu_utils.py b/pylal/pylal/fu_utils.py index 3f462db80933d9f68e04d8fd988127b03f29e261..3f88effd4a3a7dda817abd55af6be8cb18af5b76 100644 --- a/pylal/pylal/fu_utils.py +++ b/pylal/pylal/fu_utils.py @@ -307,9 +307,9 @@ class getCache(UserDict): elif opts.create_localcopy: path = self.doFileCopyAndEventIdConvert(cp,[path])[0] doc = utils.load_filename(path) - proc = table.get_table(doc, lsctables.ProcessParamsTable.tableName) + proc = lsctables.ProcessParamsTable.get_table(doc) if getInsp: - insp = table.get_table(doc, lsctables.SnglInspiralTable.tableName) + insp = lsctables.SnglInspiralTable.get_table(doc) for row in proc: if str(row.param).find("--ifo-tag") >= 0: ifoTag = row.value @@ -345,7 +345,7 @@ class getCache(UserDict): # if time[ifo] is not defined (happens for a double coinc in triple # times) then use the end_time in the first ifo of the coinc time_ifo = time[ifo_in_coinc[0]] - search = table.get_table(doc, lsctables.SearchSummaryTable.tableName) + search = lsctables.SearchSummaryTable.get_table(doc) for row in search: out_start_time = float(row.out_start_time) out_start_time_ns = float(row.out_start_time_ns)/1000000000 @@ -839,15 +839,13 @@ def readFiles(fileGlob,statistic=None,excludedTags=None): doc = utils.load_filename(thisFile) # extract the sim inspiral table try: - simInspiralTable = \ - table.get_table(doc, lsctables.SimInspiralTable.tableName) + simInspiralTable = lsctables.SimInspiralTable.get_table(doc) if sims: sims.extend(simInspiralTable) else: sims = simInspiralTable except: simInspiralTable = None # extract the sngl inspiral table, construct coincs - try: snglInspiralTable = \ - table.get_table(doc, lsctables.SnglInspiralTable.tableName) + try: snglInspiralTable = lsctables.SnglInspiralTable.get_table(doc) except: snglInspiralTable = None searchSumTable = None @@ -857,7 +855,7 @@ def readFiles(fileGlob,statistic=None,excludedTags=None): if simInspiralTable: coincInspiralTable.add_sim_inspirals(simInspiralTable) # extract the search_summary table only if a sngl inspiral table is found - searchSumTable = table.get_table(doc,lsctables.SearchSummaryTable.tableName) + searchSumTable = lsctables.SearchSummaryTable.get_table(doc) if coincs: coincs.extend(coincInspiralTable) search.extend(searchSumTable) diff --git a/pylal/pylal/gatherloudtrigs.py b/pylal/pylal/gatherloudtrigs.py index bd061c74a203f1e4b3ec4e29831dca829d342f47..f88bcd4728caffd7bda569246d4332e439775ca6 100644 --- a/pylal/pylal/gatherloudtrigs.py +++ b/pylal/pylal/gatherloudtrigs.py @@ -26,7 +26,7 @@ def get_segments_from_xml(filename): seg_xml = utils.load_filename(filename, contenthandler=DefaultContentHandler) # get the segment table - seg_table = table.get_table(seg_xml, lsctables.SegmentTable.tableName) + seg_table = lsctables.SegmentTable.get_table(seg_xml) # loop over segments table to get all the segments segs = segments.segmentlist() @@ -44,9 +44,9 @@ def get_loud_trigs(fList, veto_file, new_snr_cut): searched_segs = segments.segmentlist() for fname in fList: xmldoc = utils.load_filename(fname, gz=True, contenthandler=DefaultContentHandler) - tbl = lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName) + tbl = lsctables.SnglInspiralTable.get_table(xmldoc) trigs.extend([tbl[i] for i in (tbl.get_new_snr() > new_snr_cut).nonzero()[0]]) - search_summary = lsctables.table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName) + search_summary = lsctables.SearchSummaryTable.get_table(xmldoc) searched_segs += search_summary.get_outlist() if isinstance(veto_file, list): diff --git a/pylal/pylal/grbsummary.py b/pylal/pylal/grbsummary.py index e5ddd16dfe4307ce7fd6dd147853cdacaebb7eee..885724c70509fec2b91de8e25ed46433d47b5cc1 100644 --- a/pylal/pylal/grbsummary.py +++ b/pylal/pylal/grbsummary.py @@ -270,13 +270,7 @@ def get_mean_mchirp(coinc): def load_external_triggers(filename): doc = ligolw_add.ligolw_add(ligolw.Document(), [filename]) - ext_trigger_tables = lsctables.table.getTablesByName(doc, lsctables.ExtTriggersTable.tableName) - if ext_trigger_tables is None: - print >>sys.stderr, "No tables named external_trigger:table found in " + filename - else: - assert len(ext_trigger_tables) == 1 # ligolw_add should merge them - ext_triggers = ext_trigger_tables[0] - return ext_triggers + return lsctables.ExtTriggersTable.get_table(doc) def write_rows(rows, table_type, filename): """ @@ -333,13 +327,10 @@ def get_num_slides(xmldoc): Return the value of --num-slides found in the process_params table of xmldoc. If no such entry is found, return 0. """ - tbl_name = lsctables.ProcessParamsTable.tableName - # don't be too picky what program had --num-slides - for tbl in table.getTablesByName(xmldoc, tbl_name): - for row in tbl: - if row.param == "--num-slides": - return int(row.value) + for row in lsctables.ProcessParamsTable.get_table(xmldoc): + if row.param == "--num-slides": + return int(row.value) return 0 ##################################################################################### #timeslides functions# diff --git a/pylal/pylal/imr_utils.py b/pylal/pylal/imr_utils.py index a4d3e1fc6c5d0ee05dd71fc52c6c8c1626efd9d3..d59927258203fa2457c3dae3e272a96f3d69a462 100644 --- a/pylal/pylal/imr_utils.py +++ b/pylal/pylal/imr_utils.py @@ -42,7 +42,7 @@ def make_sim_inspiral_row_from_columns_in_db(connection): get the unique mapping of a sim inspiral row from columns in this database """ - return lsctables.table.get_table(dbtables.get_xml(connection), lsctables.SimInspiralTable.tableName).row_from_cols + return lsctables.SimInspiralTable.get_table(dbtables.get_xml(connection)).row_from_cols def time_within_segments(geocent_end_time, geocent_end_time_ns, zero_lag_segments = None): diff --git a/pylal/pylal/ligolw_cbc_compute_durations.py b/pylal/pylal/ligolw_cbc_compute_durations.py index 770319aafa9ea43f92532fadc65776728c7335a7..78b8f577b67cdb58ea193bef955f131c13c08d9a 100644 --- a/pylal/pylal/ligolw_cbc_compute_durations.py +++ b/pylal/pylal/ligolw_cbc_compute_durations.py @@ -59,7 +59,7 @@ def get_single_ifo_segments(connection, program_name = "inspiral", usertag = Non seglist_dict = segments.segmentlistdict() # extract segments indexed by available instrument for row in map( - dbtables.table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName).row_from_cols, + lsctables.SearchSummaryTable.get_table(xmldoc).row_from_cols, connection.cursor().execute(""" SELECT search_summary.* FROM search_summary @@ -119,7 +119,7 @@ def get_veto_segments(xmldoc, verbose): veto_segments = {} # get the set of unique veto_definer names in this xmldoc - veto_def_names = set( table.get_table(xmldoc, lsctables.SegmentDefTable.tableName).getColumnByName('name') ) + veto_def_names = set( lsctables.SegmentDefTable.get_table(xmldoc).getColumnByName('name') ) for name in veto_def_names: if verbose: diff --git a/pylal/pylal/ligolw_cwb_to_coinc.py b/pylal/pylal/ligolw_cwb_to_coinc.py index b6de0ab3e23e16fc070998d431368b47f5ff92d6..205a6798613ce6506795332cec09cd9b167e636b 100644 --- a/pylal/pylal/ligolw_cwb_to_coinc.py +++ b/pylal/pylal/ligolw_cwb_to_coinc.py @@ -189,7 +189,7 @@ class CWB2Coinc(object): else : self.do_process_table_from_segment(xmldoc, sim_tree, jobsegment) - process_index = dict((int(row.process_id), row) for row in table.get_table(xmldoc, lsctables.ProcessTable.tableName)) + process_index = dict((int(row.process_id), row) for row in lsctables.ProcessTable.get_table(xmldoc)) if self.verbose: print " done." @@ -375,7 +375,7 @@ class CWB2Coinc(object): """ try: - process_table = table.get_table(xmldoc, lsctables.ProcessTable.tableName) + process_table = lsctables.ProcessTable.get_table(xmldoc) except ValueError: process_table = lsctables.New(lsctables.ProcessTable, ["process_id", "ifos", "comment", "program", "start_time", "jobid", @@ -435,7 +435,7 @@ class CWB2Coinc(object): """ try: - process_table = table.get_table(xmldoc, lsctables.ProcessTable.tableName) + process_table = lsctables.ProcessTable.get_table(xmldoc) except ValueError: process_table = lsctables.New(lsctables.ProcessTable, ["process_id", "ifos", "comment", "program", "start_time", "jobid", @@ -517,7 +517,7 @@ class CWB2Coinc(object): """ try: - search_summary = table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName) + search_summary = lsctables.SearchSummaryTable.get_table(xmldoc) except ValueError: search_summary = lsctables.New(lsctables.SearchSummaryTable, ["process_id", "nevents", "ifos", "comment", "in_start_time", @@ -525,7 +525,7 @@ class CWB2Coinc(object): "in_end_time", "in_end_time_ns", "out_end_time", "out_end_time_ns"]) xmldoc.childNodes[0].appendChild(search_summary) - process_id_type = type(table.get_table(xmldoc, lsctables.ProcessTable.tableName).next_id) + process_id_type = type(lsctables.ProcessTable.get_table(xmldoc).next_id) sim_tree.GetEntry(0) @@ -568,7 +568,7 @@ class CWB2Coinc(object): """ try: - search_summary = table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName) + search_summary = lsctables.SearchSummaryTable.get_table(xmldoc) except ValueError: search_summary = lsctables.New(lsctables.SearchSummaryTable, ["process_id", "nevents", "ifos", "comment", "in_start_time", @@ -576,7 +576,7 @@ class CWB2Coinc(object): "in_end_time", "in_end_time_ns", "out_end_time", "out_end_time_ns"]) xmldoc.childNodes[0].appendChild(search_summary) - process_id_type = type(table.get_table(xmldoc, lsctables.ProcessTable.tableName).next_id) + process_id_type = type(lsctables.ProcessTable.get_table(xmldoc).next_id) runid = dict() itr = 0 @@ -656,7 +656,7 @@ class CWB2Coinc(object): """ try: - search_summary = table.get_table(xmldoc, lsctables.SearchSummaryTable.tableName) + search_summary = lsctables.SearchSummaryTable.get_table(xmldoc) except ValueError: search_summary = lsctables.New(lsctables.SearchSummaryTable, ["process_id", "nevents", "ifos", "comment", "in_start_time", @@ -664,7 +664,7 @@ class CWB2Coinc(object): "in_end_time", "in_end_time_ns", "out_end_time", "out_end_time_ns"]) xmldoc.childNodes[0].appendChild(search_summary) - process_id_type = type(table.get_table(xmldoc, lsctables.ProcessTable.tableName).next_id) + process_id_type = type(lsctables.ProcessTable.get_table(xmldoc).next_id) runids = set() entries = sim_tree.GetEntries() diff --git a/pylal/pylal/ligolw_miinjfind.py b/pylal/pylal/ligolw_miinjfind.py index 973b7670971599a31705efd4d7621b61efbb9dfd..80dc5dbcbae752310254372cccaa70d9d53a2a4f 100644 --- a/pylal/pylal/ligolw_miinjfind.py +++ b/pylal/pylal/ligolw_miinjfind.py @@ -99,12 +99,10 @@ class DocContents(object): # locate the multi_inspiral and sim_inspiral tables # - self.multiinspiraltable = table.get_table( - xmldoc, - lsctables.MultiInspiralTable.tableName) - self.siminspiraltable = table.get_table( - xmldoc, - lsctables.SimInspiralTable.tableName) + self.multiinspiraltable = lsctables.MultiInspiralTable.get_table( + xmldoc) + self.siminspiraltable = lsctables.SimInspiralTable.get_table( + xmldoc) # # get out segment lists for programs that generated @@ -112,8 +110,7 @@ class DocContents(object): # construction) # - search_summary = table.get_table( - xmldoc, lsctables.SearchSummaryTable.tableName) + search_summary = lsctables.SearchSummaryTable.get_table(xmldoc) pids = set(self.multiinspiraltable.getColumnByName("process_id")) seglists = search_summary.get_out_segmentlistdict(pids)\ .coalesce() @@ -150,8 +147,7 @@ class DocContents(object): # try: - self.coinctable = table.get_table(xmldoc, - lsctables.CoincTable.tableName) + self.coinctable = lsctables.CoincTable.get_table(xmldoc) except ValueError: self.coinctable = lsctables.New(lsctables.CoincTable) xmldoc.childNodes[0].appendChild(self.coinctable) @@ -162,9 +158,7 @@ class DocContents(object): # try: - self.coincmaptable = table.get_table( - xmldoc, - lsctables.CoincMapTable.tableName) + self.coincmaptable = lsctables.CoincMapTable.get_table(xmldoc) except ValueError: self.coincmaptable = lsctables.New(lsctables.CoincMapTable) xmldoc.childNodes[0].appendChild(self.coincmaptable) diff --git a/pylal/pylal/ligolw_rinca.py b/pylal/pylal/ligolw_rinca.py index 6fb1a05651d1120a8cd7c65dc137d600fbd698ea..59f292d0ef07a6202c6f818a0e2e9117a926d8be 100644 --- a/pylal/pylal/ligolw_rinca.py +++ b/pylal/pylal/ligolw_rinca.py @@ -159,7 +159,7 @@ class RingdownCoincTables(snglcoinc.CoincTables): # try: - self.coinc_ringdown_table = lsctables.table.get_table(xmldoc, lsctables.CoincRingdownTable.tableName) + self.coinc_ringdown_table = lsctables.CoincRingdownTable.table.get_table(xmldoc) except ValueError: self.coinc_ringdown_table = lsctables.New(lsctables.CoincRingdownTable) xmldoc.childNodes[0].appendChild(self.coinc_ringdown_table) @@ -396,7 +396,7 @@ def ligolw_rinca( print >>sys.stderr, "indexing ..." coinc_tables = CoincTables(xmldoc, vetoes = veto_segments) coinc_def_id = llwapp.get_coinc_def_id(xmldoc, coinc_definer_row.search, coinc_definer_row.search_coinc_type, create_new = True, description = coinc_definer_row.description) - sngl_index = dict((row.event_id, row) for row in lsctables.table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName)) + sngl_index = dict((row.event_id, row) for row in lsctables.SnglRingdownTable.get_table(xmldoc)) # # build the event list accessors, populated with events from those @@ -413,7 +413,7 @@ def ligolw_rinca( # set the \Delta t parameter on all the event lists # - max_dt = ringdown_max_dt(lsctables.table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName), thresholds) + max_dt = ringdown_max_dt(lsctables.SnglRingdownTable.get_table(xmldoc), thresholds) if verbose: print >>sys.stderr, "event bisection search window will be %.16g s" % max_dt for eventlist in eventlists.values(): diff --git a/pylal/pylal/ligolw_sicluster.py b/pylal/pylal/ligolw_sicluster.py index e60ba075b662b3436280fa63851507eaa796286a..2f310fea26d9c63605684b5360688d29e4c5cfd3 100644 --- a/pylal/pylal/ligolw_sicluster.py +++ b/pylal/pylal/ligolw_sicluster.py @@ -44,14 +44,12 @@ __author__ = "Duncan Brown <dbrown@ligo.caltech.edu>" # def get_tables(doc): - snglinspiraltable = table.get_table( - doc, lsctables.SnglInspiralTable.tableName) + snglinspiraltable = lsctables.SnglInspiralTable.get_table(doc) input_times = None output_times = None try: - searchsummtable = table.get_table( - doc, lsctables.SearchSummaryTable.tableName) + searchsummtable = lsctables.SearchSummaryTable.get_table(doc) input_times = searchsummtable.get_inlist().extent() output_times = searchsummtable.get_outlist().extent() except ValueError: diff --git a/pylal/pylal/pylal_exttrig_llutils.py b/pylal/pylal/pylal_exttrig_llutils.py index db2564425cd09d9d3086e6edd0b078135ab77e79..433bd80a0ea8b97a8c9d5731e9bd854c6ac1198d 100755 --- a/pylal/pylal/pylal_exttrig_llutils.py +++ b/pylal/pylal/pylal_exttrig_llutils.py @@ -501,8 +501,8 @@ def get_veto_overlaps(segment, xmlsegfile): # load the content of the veto-file xmldoc = utils.load_filename(xmlsegfile, gz = False) - segs = table.get_table(xmldoc, lsctables.SegmentTable.tableName) - segdefs = table.get_table(xmldoc, lsctables.SegmentDefTable.tableName) + segs = lsctables.SegmentTable.get_table(xmldoc) + segdefs = lsctables.SegmentDefTable.get_table(xmldoc) # create a mapping between the segments and their definitions defdict = {} diff --git a/pylal/pylal/skylocutils.py b/pylal/pylal/skylocutils.py index 6b2d86cb194be28548a6fdef50e1f45b4a29b946..1dc5050d9b9e3992d4dedcb343a3cec9d302c5b3 100644 --- a/pylal/pylal/skylocutils.py +++ b/pylal/pylal/skylocutils.py @@ -548,7 +548,7 @@ class Coincidences(list): for file in files: coinc = CoincData() xmldoc = utils.load_filename(file, contenthandler=ligolw.LIGOLWContentHandler) - sngltab = tab.get_table(xmldoc,lsctables.SnglInspiralTable.tableName) + sngltab = lsctables.SnglInspiralTable.get_table(xmldoc) coinc.set_snr(dict((row.ifo, row.snr) for row in sngltab)) coinc.set_gps(dict((row.ifo, lal.LIGOTimeGPS(row.get_end())) for row in sngltab)) #FIXME: this is put in place to deal with eff_distance = 0 @@ -562,7 +562,7 @@ class Coincidences(list): # coinc.set_effDs(dict((row.ifo,row.eff_distance) for row in sngltab)) coinc.set_masses(dict((row.ifo, row.mass1) for row in sngltab), \ dict((row.ifo, row.mass2) for row in sngltab)) - ctab = tab.get_table(xmldoc,lsctables.CoincInspiralTable.tableName) + ctab = lsctables.CoincInspiralTable.get_table(xmldoc) #FIXME: ignoring H2 for now, but should be dealt in a better way allifos = list(ctab[0].get_ifos()) try: @@ -574,7 +574,7 @@ class Coincidences(list): coinc.set_FAR(ctab[0].false_alarm_rate) try: - simtab = tab.get_table(xmldoc,lsctables.SimInspiralTable.tableName) + simtab = lsctables.SimInspiralTable.get_table(xmldoc) row = siminsptab[0] effDs_inj = {} for ifo in coinc.ifo_list: