コード例 #1
0
ファイル: idq_gdb_utils.py プロジェクト: gabewilliam/lalsuite
def get_glitch_times(glitch_xmlfiles):
    """
    Returns list of (gps,gps_ns) tuples for all events contained in the glitch_xmlfiles.
    """
    # load files in database
    connection, cursor = idq_tables_dbutils.load_xml_files_into_database(
        glitch_xmlfiles)

    # get table names from the database
    tablenames = dbtables.get_table_names(connection)
    if not tablenames:
        print "No tables were found in the database."
        return []

    # check if glitch table is present
    if not idq_tables.IDQGlitchTable.tableName in tablenames:
        print "No glitch table is found in database."
        print "Can not perform requested query."
        return []

    data = cursor.execute("""SELECT gps, gps_ns FROM """ + \
        idq_tables.IDQGlitchTable.tableName).fetchall()
    # close database
    connection.close()
    return data
コード例 #2
0
def get_glitch_ovl_channels(glitch_xmlfiles):
    """
    Gets ovl channels for glitch events from glitch_xmlfiles.
    Returns list of (gps_seconds, gps_nanonsecons, ovl_channel) tuples.
    Each tuple in the list corresponds to a glitch event.
    """
    # load files in database
    connection, cursor = idq_tables_dbutils.load_xml_files_into_database(glitch_xmlfiles)

    # get glitch gps times and ovl channels
    data = idq_tables_dbutils.get_glitch_ovl_data(connection, cursor, \
        ['gps', 'gps_ns'], ['aux_channel'])
    # close database
    connection.close()
    return data
コード例 #3
0
def get_glitch_ovl_snglburst_summary_info(glitch_xmlfiles, glitch_columns, ovl_columns, snglburst_columns):
    """
    Generates summary info table for glitch events stored in glitch_xmlfiles.
    Returns list of (ifo, gps, gps_ns, rank, fap, ovl_channel, trig_type, trig_snr) tuples.
    Each tuple in the list corresponds to a glitch event.
    """
    # load files in database
    connection, cursor = idq_tables_dbutils.load_xml_files_into_database(glitch_xmlfiles)

    # get glitch gps times and ovl channels
    data = idq_tables_dbutils.get_get_glitch_ovl_sngburst_data(\
        connection, cursor, glitch_columns, ovl_columns, snglburst_columns)

    # close database
    connection.close()
    return data
コード例 #4
0
def get_glitch_times(glitch_xmlfiles):
    """
    Returns list of (gps,gps_ns) tuples for all events contained in the glitch_xmlfiles.
    """
    # load files in database
    connection, cursor = idq_tables_dbutils.load_xml_files_into_database(glitch_xmlfiles)

    # get table names from the database
    tablenames = dbtables.get_table_names(connection)
    if not tablenames:
        print "No tables were found in the database."
        return []

    # check if glitch table is present
    if not table.StripTableName(idq_tables.IDQGlitchTable.tableName) in tablenames:
        print "No glitch table is found in database."
        print "Can not perform requested query."
        return []

    data = cursor.execute('''SELECT gps, gps_ns FROM ''' + \
        table.StripTableName(idq_tables.IDQGlitchTable.tableName)).fetchall()
    # close database
    connection.close()
    return data
コード例 #5
0
        gracedb.writeLog(opts.gracedb_id, message="No iDQ glitch tables data from "+opts.classifier+" available for the candidate  at "+opts.ifo)
    print "No glitch files found, exiting."
    sys.exit(0)

if opts.verbose:
    print "Found:"
    for filename in gchxml_filenames:
        print '\t' + filename


# ##############################################################
# ## Load and Merge xml files using in-memory sqlite database
# ##############################################################
# 
# load files into database
connection, cursor = idq_tables_dbutils.load_xml_files_into_database(\
    gchxml_filenames, verbose=opts.verbose)

# #########################################################
# ## remove redundant rows and any events outside of [opts.start, opts.end]
###########################################################

# remove redundant entries from the tables
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)
コード例 #6
0
        gracedb.writeLog(opts.gracedb_id, message="No iDQ glitch tables data from "+opts.classifier+" available for the candidate  at "+opts.ifo)
    print "No glitch files found, exiting."
    sys.exit(0)

if opts.verbose:
    print "Found:"
    for filename in gchxml_filenames:
        print '\t' + filename


# ##############################################################
# ## Load and Merge xml files using in-memory sqlite database
# ##############################################################
# 
# load files into database
connection, cursor = idq_tables_dbutils.load_xml_files_into_database(\
    gchxml_filenames, verbose=opts.verbose)

# #########################################################
# ## remove redundant rows and any events outside of [opts.start, opts.end]
###########################################################

# remove redundant entries from the tables
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)