Package pylal :: Module KW_veto_utils
[hide private]
[frames] | no frames]

Module KW_veto_utils

source code

Tomoki Isogai (isogait@carleton.edu)

Utility functions for KW_veto codes

Functions [hide private]
 
get_connection_filename(filename, tmp_path=None, replace_file=False, verbose=False)
copied from glue.ligolw.dbtables by Kipp Cannon I can't directly import from glue because dbtables collides with other tables
source code
 
save_db(cursor, table_name, filename, working_filename, order_by=None, verbose=True)
Originally written by Nickolas Fotopoulos, modified.
source code
 
load_db(dbFile, tmp_path, verbose)
Connect to database.
source code
 
get_candidate(cursor, critical_usedPer)
This function returns a tuple: (threshold, used percentage, # of coincident KW triggers above the threshold, # of total KW triggers above the threshold, # of vetoed GW triggers, veto efficiency, dead time, dead time percentage, (used percentage) / (random used percentage), (veto efficiency) / (dead time percentage)) that corresponds to threshold to be used for veto.
source code
 
rename(src)
If src alaready exists, this function rename it so that new file/directory...
source code
 
load_segs_db(cur, tableName)
Load segments in glue.segments.segmentlist format FIXME: possibly SQL Injection attack
source code
 
write_segs_db(cur, seg_list, tableName)
Write glue.segments.segmentlist format segments into database.
source code
 
write_segs(segs, file_name)
Take glue.segments.segmentlist and write in a ascii file in a form compatible to the segment database.
source code
 
read_segfile(segfile)
Read segments in segwizard form with sanity check and return glue.segments.segmentlist
source code
 
read_segfile_xml(segfile, verbose)
Read segment file in ligolw xml type and return in glue.segments.segmentlist format.
source code
 
find_version_xml(segfile, seg, verbose)
Find out the version of the flag for the given seg.
source code
 
get_segment(eventTime, pos_window, neg_window)
Given the time of trigger, this aplies +/- window and round to integers in a way it broadens the window
source code
 
get_result_files(result_dir, verbose)
Make a list of the result files from KW_veto_calc and check sanity.
source code
 
get_files_from_globs(globs)
Get individual file names from names with globs.
source code
Function Details [hide private]

get_connection_filename(filename, tmp_path=None, replace_file=False, verbose=False)

source code 

copied from glue.ligolw.dbtables by Kipp Cannon I can't directly import from glue because dbtables collides with other tables

Utility code for moving database files to a (presumably local) working location for improved performance and reduced fileserver load.

save_db(cursor, table_name, filename, working_filename, order_by=None, verbose=True)

source code 

Originally written by Nickolas Fotopoulos, modified.
Convert a dictionary to SQLite database for later use and also save to
specified format file.
Supported file extensions are:
* .pickle - Python pickle file (dictionary serialized unchanged)
* .pickle.gz - gzipped pickle (dictionary serialized unchanged)
* .mat - Matlab v4 file (dictionary keys become variable names; requires
         Scipy)
* .txt - ASCII text 
* .txt.gz - gzipped ASCII text
* .bd - sqlite database

FIXME: add xml

load_db(dbFile, tmp_path, verbose)

source code 

Connect to database. Also, return a dictionary having variables from KW_veto_calc in a form: {variable name: variable value}

get_candidate(cursor, critical_usedPer)

source code 

This function returns a tuple: (threshold, used percentage, # of coincident KW triggers above the threshold, # of total KW triggers above the threshold, # of vetoed GW triggers, veto efficiency, dead time, dead time percentage, (used percentage) / (random used percentage), (veto efficiency) / (dead time percentage)) that corresponds to threshold to be used for veto. This returns just None for non candidate channel.

rename(src)

source code 

If src alaready exists, this function rename it so that new file/directory
 won't overwite

write_segs_db(cur, seg_list, tableName)

source code 

Write glue.segments.segmentlist format segments into database. FIXME: possibly SQL Injection attack

get_files_from_globs(globs)

source code 

Get individual file names from names with globs. Input could be a mixture of glob and ',' seperated file list, something like '../segs/*,H1_segs.txt' also there might be white space between file names