idq_tables_dbutils.remove_redundant_entries(connection, cursor, verbose = opts.verbose) # form two open segments using start and stop times seglist = segments.segmentlist() seglist.append(segments.segment([-segments.infinity(), lal.LIGOTimeGPS(opts.start)])) seglist.append(segments.segment([lal.LIGOTimeGPS(opts.end), segments.infinity()])) # delete glitch events that fall inside of these segments idq_tables_dbutils.delete_glitch_events_in_segmentlist(connection, cursor, seglist) ############################################################################### # ## save merged xmldoc ############################################################################### merged_xmldoc_filename = '%s/%s_idq_%s_glitch_%s%d-%d.xml' % ( opts.output_dir, opts.ifo, opts.classifier, opts.tag, int(opts.start), int(opts.end - opts.start) ) if opts.verbose: print 'saving ' + merged_xmldoc_filename # exctract data base into xml file and write it to disk ligolw_sqlite.extract(connection, merged_xmldoc_filename , verbose = opts.verbose) # exctract data base into xml file connection.close() if not opts.skip_gracedb_upload: #write log message to gracedb and upload file gracedb.writeLog(opts.gracedb_id, message="iDQ glitch tables " + opts.ifo + ":", filename=merged_xmldoc_filename)
# if options.verbose: print("Executing SQL ...", file=sys.stderr) cursor = connection.cursor() for statement in sql: if options.verbose: print(statement, file=sys.stderr) cursor.execute(statement) connection.commit() cursor.close() if options.verbose: print("... Done.", file=sys.stderr) # # commit changes # if fileformat == "xml": # overwrite XML file with in-ram database' contents ligolw_sqlite.extract(connection, filename, verbose=options.verbose) connection.close() elif fileformat == "sqlite": # return SQLite file to its home connection.close() dbtables.put_connection_filename(filename, working_filename, verbose=options.verbose) else: raise Exception("internal error")
# # apply SQL # if options.verbose: print >>sys.stderr, "Executing SQL ..." cursor = connection.cursor() for statement in sql: if options.verbose: print >>sys.stderr, statement cursor.execute(statement) connection.commit() cursor.close() if options.verbose: print >>sys.stderr, "... Done." # # commit changes # if fileformat == "xml": # overwrite XML file with in-ram database' contents ligolw_sqlite.extract(connection, filename, verbose = options.verbose) connection.close() elif fileformat == "sqlite": # return SQLite file to its home connection.close() dbtables.put_connection_filename(filename, working_filename, verbose = options.verbose) else: raise Exception("internal error")
# form two open segments using start and stop times seglist = segments.segmentlist() seglist.append(segments.segment([-segments.infinity(), lal.LIGOTimeGPS(opts.start)])) seglist.append(segments.segment([lal.LIGOTimeGPS(opts.end), segments.infinity()])) # delete glitch events that fall inside of these segments idq_tables_dbutils.delete_glitch_events_in_segmentlist(connection, cursor, seglist) ############################################################################### # ## save merged xmldoc ############################################################################### #merged_xmldoc_filename = '%s/%s_idq_%s_glitch_%s%d-%d.xml' % ( # opts.output_dir, # opts.ifo, # opts.classifier, # opts.tag, # int(opts.start), # int(opts.end - opts.start) # ) merged_xmldoc_filename = idq.gdb_xml(opts.output_dir, opts.classifier, opts.ifo, opts.tag, int(opts.start), int(opts.end-opts.start)) if opts.verbose: print 'saving ' + merged_xmldoc_filename # exctract data base into xml file and write it to disk ligolw_sqlite.extract(connection, merged_xmldoc_filename , verbose = opts.verbose) # exctract data base into xml file connection.close() if not opts.skip_gracedb_upload: #write log message to gracedb and upload file gracedb.writeLog(opts.gracedb_id, message="iDQ glitch tables " + opts.ifo + ":", filename=merged_xmldoc_filename)