Example #1
0
    for s, e in coverage:
        if s < gps:
            if gps - s < minwin:
                minwin = gps - s
        elif e > gps:
            if e - gps < minwin:
                minwin = e - gps
    else:
        print "\t\tminwin = %.3f" % (minwin)

    ### load triggers
    trgdict = event.trigdict()
    for filename in filenames:
        if opts.verbose:
            print "\t\t%s" % (filename)
        trgdict.add(event.loadkwm(filename))
    trgdict.include(
        [[gps - opts.window, gps + opts.window]], tcent=event.col_kw["tcent"]
    )  ### keep only those within big window
    for key, values in trgdict.items():  ### add shifted times so they are measured relative to gps
        trgdict[key] = [trg + [trg[event.col_kw["tcent"]] - gps] for trg in values]
    trgdata[gps] = (minwin, trgdict)

# -----------------------------------

if opts.verbose:
    print "plotting signif scatters for :"

for chanA, chanB in opts.pairs:
    if opts.verbose:
        print "    %s\n    %s" % (chanA, chanB)
	gps_end_time = int(opts.gps_end_time)

# get list of trigger files
if opts.trigger_dir:
	trig_files = idq.get_all_files_in_range(opts.trigger_dir, gps_start_time, gps_end_time, pad=0, suffix='.trg')
else:
	trig_files = glob.glob(opts.trigger_files)

if not trig_files:
	print "Warning: Empty list of trigger files, exiting without doing anything."
	sys.exit(0)

if opts.verbose: 
	print "Loading triggers ..."
# load triggers from files
trigger_dict = event.loadkwm(trig_files) 
if main_channel not in trigger_dict:
    trigger_dict[main_channel] = []

if opts.verbose:
	print "Done."	

if not trigger_dict:
	print "Warning: No triggers in the input files, exiting without doing anything."
	sys.exit(0)

if opts.dq_segments:
	# load dq segments
	(dq_segments, covered_segments) = idq.extract_dq_segments(open(opts.dq_segments, "r"), opts.dq_segments_name)
	# sort and merge segments
	dq_segments = event.fixsegments(dq_segments)
# finding KW.trg files
#
# =================================================

padding = max(float(myconf['padding']),
              float(config.get('build_auxmvc_vectors', 'time-window')))

kwdirname = '%s/%s/' % (config.get('general', 'gdsdir'), kwbasename)
kwfilenames = idq.get_all_files_in_range(kwdirname, opts.gps - padding,
        opts.gps + padding, pad=0, suffix='.trg')

if not len(kwfilenames):
    raise StandardError('no KW files found!')

print 'loading KW triggers:\n', kwfilenames[0]
kwdict = event.loadkwm(kwfilenames[0])
for kwfilename in kwfilenames[1:]:
    print kwfilename
    kwdict = event.loadkwm(kwfilename, trigs_dict=kwdict)

# require GW channel in trigger dict

if gwchannel not in kwdict:
    kwdict[gwchannel] = []

kwdict.resort()

samples = [[opts.gps, 1, 1.0, 0.0, 0.0]]  # fake sample with fields filled in for kw data

# =================================================
#
Example #4
0
            if gps-s < minwin:
                minwin = gps-s
        elif e > gps:
            if e-gps < minwin:
                minwin = e-gps
    if minwin < opts.exclude:
        raise ValueError("minwin < opts.exclude caused by gps : %3f"%(gps))
    else:
        print "\t\tminwin = %.3f"%(minwin)
 
    ### load triggers
    trgdict = event.trigdict()
    for filename in filenames:
        if opts.verbose:
            print "\t\t%s"%(filename)
        trgdict.add( event.loadkwm( filename ) )
    trgdict.include([[gps-opts.window, gps+opts.window]], tcent=event.col_kw['tcent']) ### keep only those within big window
    for key, values in trgdict.items(): ### add shifted times so they are measured relative to gps
        trgdict[key] = [trg+[trg[event.col_kw['tcent']]-gps] for trg in values]
    trgdata[gps] = (minwin, trgdict)

#-----------------------------------

### find all channels and map them to gps times and minwin
absMinWin = opts.window
channels = defaultdict( list ) 
for gps, (minwin, trgdict) in trgdata.items():
    for chan in trgdict.keys():
        channels[chan].append( (gps, minwin) )
    if minwin < absMinWin:
        absMinWin = minwin
Example #5
0
    trig_files = idq.get_all_files_in_range(opts.trigger_dir,
                                            gps_start_time,
                                            gps_end_time,
                                            pad=0,
                                            suffix='.trg')
else:
    trig_files = glob.glob(opts.trigger_files)

if not trig_files:
    print "Warning: Empty list of trigger files, exiting without doing anything."
    sys.exit(0)

if opts.verbose:
    print "Loading triggers ..."
# load triggers from files
trigger_dict = event.loadkwm(trig_files)
if main_channel not in trigger_dict:
    trigger_dict[main_channel] = []

if opts.verbose:
    print "Done."

if not trigger_dict:
    print "Warning: No triggers in the input files, exiting without doing anything."
    sys.exit(0)

if opts.dq_segments:
    # load dq segments
    (dq_segments,
     covered_segments) = idq.extract_dq_segments(open(opts.dq_segments, "r"),
                                                 opts.dq_segments_name)