def _read_omicron_trigs(omicron_files, span):
    trigs1 = SnglBurstTable.read(omicron_files[0], format='ligolw')
    trigs = table.new_from_template(trigs1)
    for omicron_file in omicron_files:
        trigs2 = table.new_from_template(trigs1)
        trigs2 = SnglBurstTable.read(omicron_file, format='ligolw')
        trigs.extend(filter(lambda row: row.get_peak() in span, trigs2))
    times = []

    print('%d found' % len(trigs))
    times = trigs.get_peak()
    s = times.size
    return trigs, times, s
示例#2
0
def plot_triggers(params,channel,segment):
    """plot omicron triggers for given channel and segment.

    @param params
        seismon params dictionary
    @param channel
        seismon channel structure
    @param segment
        [start,end] gps
    """

    gpsStart = segment[0]
    gpsEnd = segment[1]

    omicronDirectory = os.path.join(params["path"],"omicron")
    omicronPath = os.path.join(omicronDirectory,channel.station)
    omicronXMLs = glob.glob(os.path.join(omicronPath,"*.xml"))

    table = []
    for ii in range(len(omicronXMLs)):
        tabletmp = SnglBurstTable.read(omicronXMLs[0])
        for jj in range(len(tabletmp)):
            table.append(tabletmp[jj])
    if table == []:
       return
   
    peak_times = gwpy.plotter.table.get_table_column(table, "peak_time")
    central_freqs = gwpy.plotter.table.get_table_column(table, "central_freq")
    snrs = gwpy.plotter.table.get_table_column(table, "snr")

    textLocation = params["path"] + "/" + channel.station_underscore
    seismon.utils.mkdir(textLocation)

    f = open(os.path.join(textLocation,"triggers.txt"),"w")
    for peak_time,central_freq,snr in zip(peak_times,central_freqs,snrs):
        f.write("%.1f %e %e\n"%(peak_time,central_freq,snr))
    f.close()

    if params["doPlots"]:

        plotLocation = params["path"] + "/" + channel.station_underscore
        seismon.utils.mkdir(plotLocation)

        if params["doEarthquakesAnalysis"]:
            pngFile = os.path.join(plotLocation,"omicron-%d-%d.png"%(gpsStart,gpsEnd))
        else:
            pngFile = os.path.join(plotLocation,"omicron.png")

        epoch = gwpy.time.Time(gpsStart, format='gps')
       
        #plot = gwpy.plotter.EventTablePlot(table, 'time', 'central_freq', 'snr', figsize=[14,8],epoch=gpsStart,size_by_log='snr', size_range=[6, 20],edgecolor='none')
        plot = table.plot('time', 'central_freq', color='snr', edgecolor='none', epoch=gpsStart)
        plot.add_colorbar(log=True, clim=[6, 20],label='Signal-to-noise ratio (SNR)')
        plot.xlim = [gpsStart, gpsEnd]
        plot.ylabel = 'Frequency [Hz]'
        plot.ylim = [params["fmin"],params["fmax"]]
        plot.axes[0].set_yscale("log")
        plot.save(pngFile)
        plot.close()
示例#3
0
def plot_triggers(filename='excesspower.xml.gz'):
    events = SnglBurstTable.read(filename)
    #plot = events.plot('time', 'central_freq', "duration", "bandwidth", color='snr')
    plot = events.plot('time', 'central_freq', color='snr', edgecolor='none')
    #plot.set_xlim(time_start,time_end)
    #plot.set_ylim(band, sample_rate/2.)
    plot.set_ylabel('Frequency [Hz]')
    plot.set_yscale('log')
    #plot.set_title('GNOME '+station+' station event triggers')
    plot.add_colorbar(cmap='copper_r', label='Tile Energy')
    pyplot.savefig("triggers.png", dpi=300)
示例#4
0
def get_all_vco_triggers(ifo,
                         seg,
                         frames=False,
                         fit=True,
                         channel='GDS-CALIB_STRAIN',
                         file=None):
    st = int(seg[0])
    et = int(seg[1])
    st2 = st
    First = 1
    # break into 1000s, run into memory issues otherwise
    amps = []
    while (et > st2):
        dur = min(et - st2, 1000)
        if file:
            vco = TimeSeries.read(file)
            vco = vco + 76e6
        else:
            vco = generate_fast_vco(ifo,
                                    Segment(st2, st2 + dur),
                                    frames=frames,
                                    fit=fit)

        trigs = SnglBurstTable.fetch(
            "%s:%s" % (ifo, channel),
            'omicron',
            st2,
            st2 + dur,
            filt=lambda x: st2 <= x.get_peak() < st2 + dur)
        if First:
            trigs2 = table.new_from_template(trigs)
            First = 0
        trigs2.extend(trigs)
        vtrigs = get_vco_trigs(vco, trigs, channel=channel)
        for vtrig in vtrigs:
            amps.append(vtrig)
        st2 += 1000

    central_freqs = trigs2.get_column('peak_frequency')
    snrs = trigs2.get_column('snr')
    sts = trigs2.get_column('time_peak')

    amps = np.asarray(amps)
    amps = amps[~(np.isnan(amps))]
    central_freqs = central_freqs[~(np.isnan(amps))]
    snrs = snrs[~(np.isnan(amps))]
    return amps, central_freqs, snrs, sts
示例#5
0
def load_omic_trigs(omicroncachefile, segs):
  # Read in the Omicron triggers
  with open(omicroncachefile, 'r') as cachefile:
    cache = Cache.fromfile(cachefile)

  omic_trigs = SnglBurstTable.read(cache, verbose=True, filt=lambda x: x.snr <\
      100 and x.peak_frequency < 100)

  # Check if Omicron triggers have been read in successfully
  if not omic_trigs:
    sys.exit("ERROR: No triggers for Omicron channel: %s" % cachefile.split('.')[0])
  else:
    print "%d Omicron triggers read" % len(omic_trigs)

  #Get the Omicron triggers that lie within the valid segment list
  omic_trigs = omic_trigs.vetoed(segs)
  return omic_trigs
def get_all_vco_triggers(ifo, seg, frames=False, fit=True, channel="GDS-CALIB_STRAIN", file=None):
    st = int(seg[0])
    et = int(seg[1])
    st2 = st
    First = 1
    # break into 1000s, run into memory issues otherwise
    amps = []
    while et > st2:
        dur = min(et - st2, 1000)
        if file:
            vco = TimeSeries.read(file)
            vco = vco + 76e6
        else:
            vco = generate_fast_vco(ifo, Segment(st2, st2 + dur), frames=frames, fit=fit)

        trigs = SnglBurstTable.fetch(
            "%s:%s" % (ifo, channel), "omicron", st2, st2 + dur, filt=lambda x: st2 <= x.get_peak() < st2 + dur
        )
        if First:
            trigs2 = table.new_from_template(trigs)
            First = 0
        trigs2.extend(trigs)
        vtrigs = get_vco_trigs(vco, trigs, channel=channel)
        for vtrig in vtrigs:
            amps.append(vtrig)
        st2 += 1000

    central_freqs = trigs2.get_column("peak_frequency")
    snrs = trigs2.get_column("snr")
    sts = trigs2.get_column("time_peak")

    amps = np.asarray(amps)
    amps = amps[~(np.isnan(amps))]
    central_freqs = central_freqs[~(np.isnan(amps))]
    snrs = snrs[~(np.isnan(amps))]
    return amps, central_freqs, snrs, sts
gravitational waves, but will help tune the algorithm to improve detection of
future, real signals.
"""

from gwpy import version
__author__ = "Duncan Macleod <*****@*****.**>"
__version__ = version.version

from urllib2 import urlopen

from numpy import asarray

from gwpy.table.lsctables import SnglBurstTable

# read triggers
events = SnglBurstTable.read('../gwpy/tests/data/'
                             'H1-LDAS_STRAIN-968654552-10.xml.gz')

# make a plot
plot2 = events.plot('time', 'central_freq', 'duration', 'bandwidth', color='snr', epoch=968654552)
plot2.set_xlim(968654552, 968654552+10)
plot2.set_ylabel('Frequency [Hz]')
plot2.set_yscale('log')
plot2.set_title('LIGO Hanford Observatory event triggers for GW100916')
plot2.add_colorbar(clim=[1, 5], label='Signal-to-noise ratio')

if __name__ == '__main__':
    try:
        outfile = __file__.replace('.py', '.png')
    except NameError:
        pass
    else:
stretch of data.

The data from which these events were generated are a simulation of Gaussian noise
with the Advanced LIGO design spectrum, and so don't actually contain any real
gravitational waves, but will help tune the algorithm to improve detection of
future, real signals.
"""

from gwpy import version
__author__ = "Duncan Macleod <*****@*****.**>"
__version__ = version.version

from gwpy.table.lsctables import SnglBurstTable

# read triggers
events = SnglBurstTable.read('../gwpy/tests/data/'
                             'H1-LDAS_STRAIN-968654552-10.xml.gz')

# calculate the event rate
rate = events.event_rate(1, start=968654552, end=968654562)

# make a plot
plot = rate.plot()
plot.set_xlim(968654552, 968654562)
plot.set_ylabel('Event rate [Hz]')
plot.set_title('LIGO Hanford Observatory event rate for GW100916')

if __name__ == '__main__':
    try:
        outfile = __file__.replace('.py', '.png')
    except NameError:
        pass
    trig_template = template_ids[highestSNR]
elif args.ranking_statistic == 'newsnr':
    trig_time = end_times[highestnewSNR]
    trig_template = template_ids[highestnewSNR]

mass1vec = template_file['mass1'][:]
mass2vec = template_file['mass2'][:]
mass1 = mass1vec[trig_template]
mass2 = mass2vec[trig_template]

hoft_chan = str(ifo) + ":GDS-CALIB_STRAIN"
start_time = trig_time - 40
end_time = trig_time + 40

logging.info('Fetching omicron triggers')
omicron_trigs = SnglBurstTable.fetch(hoft_chan, 'omicron', start_time,
                                     end_time)
omicron_times = np.add(omicron_trigs.get_column('peak_time'),
                       omicron_trigs.get_column('peak_time_ns') * 10**-9)
omicron_snr = omicron_trigs.get_column('snr')
omicron_freq = omicron_trigs.get_column('peak_frequency')

from pycbc.workflow.segment import fromsegmentxml
import pycbc.pnutils

f_low = 30
f_high = pycbc.pnutils.f_SchwarzISCO(mass1 + mass2)

inspiral_t, inspiral_f = pycbc.pnutils.get_inspiral_tf(trig_time, mass1, mass2,
                                                       f_low, f_high)

logging.info('Plotting')
示例#10
0
def get_triggers():

    # Obtain segments that are analysis ready
    analysis_ready = DataQualityFlag.query('{0}:DMT-ANALYSIS_READY:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)

    # Display segments for which this flag is true
    print "Segments for which the ANALYSIS READY Flag is active: {0}".format(analysis_ready.active)

    if opts.applyallDQ:
        print("We are finding all previously created DQ cuts")
        # Obtain segments of all DQ cuts if requested DQ list can be found
        # https://code.pycbc.phy.syr.edu/detchar/veto-definitions/blob/master/burst/O1/H1L1-HOFT_C02_O1_BURST.xml
        # First obtain those flags that are for both H1 and L1
        O1_MISSING_HOFT_C02 = DataQualityFlag.query('{0}:DCS-MISSING_{0}_HOFT_C02:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
        O1_ETMY_ESD_DAC_OVERFLOW = DataQualityFlag.query('{0}:DMT-ETMY_ESD_DAC_OVERFLOW:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
        O1_OMC_DCPD_A_SATURATION = DataQualityFlag.query('{0}:DCH-OMC_DCPD_A_SATURATION:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
        O1_OMC_DCPD_ADC_OVERFLOW = DataQualityFlag.query('{0}:DMT-OMC_DCPD_ADC_OVERFLOW:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
        O1_ETMY_SATURATION_SNR200 = DataQualityFlag.query('{0}:DCH-ETMY_SATURATION_SNR200:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
        O1_CW_INJECTION_TRANSITION = DataQualityFlag.query('{0}:DCH-CW_INJECTION_TRANSITION:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
        O1_BAD_KAPPA_BASIC_CUT_HOFT_C02 = DataQualityFlag.query('{0}:DCS-BAD_KAPPA_BASIC_CUT_{0}_HOFT_C02:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
        O1_PARTIAL_FRAME_LOSS_HOFT_C02 = DataQualityFlag.query('{0}:DCS-PARTIAL_FRAME_LOSS_{0}_HOFT_C02:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)

        # Obtain detector specific flags
        if opts.detector == "H1":
            O1_RF45_AM_STABILIZATION = DataQualityFlag.query('{0}:DCH-RF45_AM_STABILIZATION:4'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_ETMY_SATURATION = DataQualityFlag.query('{0}:DCH-ETMY_SATURATION:2'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_BAD_DATA_BEFORE_LOCKLOSS = DataQualityFlag.query('{0}:DCH-BAD_DATA_BEFORE_LOCKLOSS:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_ETMY_VIOLIN_MODE_2NDHARMONIC_RINGING = DataQualityFlag.query('{0}:DCH-ETMY_VIOLIN_MODE_2NDHARMONIC_RINGING:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_RF45_SEVERE_GLITCHING = DataQualityFlag.query('{0}:DCH-RF45_SEVERE_GLITCHING:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_EY_BECKHOFF_CHASSIS_PROBLEM = DataQualityFlag.query('{0}:DCH-EY_BECKHOFF_CHASSIS_PROBLEM:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_ASC_AS_B_RF36_GLITCHING = DataQualityFlag.query('{0}:DCH-ASC_AS_B_RF36_GLITCHING:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_BAD_STRAIN_HOFT_C02 = DataQualityFlag.query('{0}:DCS-BAD_STRAIN_{0}_HOFT_C02:2'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_TOGGLING_BAD_KAPPA_HOFT_C02= DataQualityFlag.query('{0}:DCS-TOGGLING_BAD_KAPPA_{0}_HOFT_C02:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
        else:
            O1_ETMY_SATURATION = DataQualityFlag.query('{0}:DCH-ETMY_SATURATION:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_BAD_DATA_BEFORE_LOCKLOSS = DataQualityFlag.query('{0}:DCH-BAD_DATA_BEFORE_LOCKLOSS:2'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_PCAL_GLITCHES_GT_20P = DataQualityFlag.query('{0}:DCH-PCAL_GLITCHES_GT_20P:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_SUDDEN_PSD_CHANGE = DataQualityFlag.query('{0}:DCH-SUDDEN_PSD_CHANGE:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_BAD_VCO_OFFSET = DataQualityFlag.query('{0}:DCH-BAD_VCO_OFFSET:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)
            O1_SEVERE_60_200_HZ_NOISE = DataQualityFlag.query('{0}:DCH-SEVERE_60_200_HZ_NOISE:1'.format(opts.detector),opts.gpsStart,opts.gpsEnd)

    # Fetch raw omicron triggers and apply filter which is defined in a function above.
    omicrontriggers = SnglBurstTable.fetch(detchannelname,'Omicron',\
    opts.gpsStart,opts.gpsEnd,filt=threshold)

    print "List of available metadata information for a given glitch provided by omicron: {0}".format(omicrontriggers.columnnames)

    print "Number of triggers after SNR and Freq cuts but before ANALYSIS READY flag filtering: {0}".format(len(omicrontriggers))

    # Filter the raw omicron triggers against the ANALYSIS READY flag.
    omicrontriggers = omicrontriggers.vetoed(analysis_ready.active)
    # If requested filter out DQ flags
    if opts.applyallDQ:
        print("We are applying all previously created DQ cuts")
        # Obtain segments of all DQ cuts if requested DQ list can be found
        # https://code.pycbc.phy.syr.edu/detchar/veto-definitions/blob/master/burst/O1/H1L1-HOFT_C02_O1_BURST.xml
        # First obtain those flags that are for both H1 and L1
        omicrontriggers = omicrontriggers.veto(O1_MISSING_HOFT_C02.active)
        omicrontriggers = omicrontriggers.veto(O1_ETMY_ESD_DAC_OVERFLOW.active)
        omicrontriggers = omicrontriggers.veto(O1_OMC_DCPD_A_SATURATION.active)
        omicrontriggers = omicrontriggers.veto(O1_OMC_DCPD_ADC_OVERFLOW.active)
        omicrontriggers = omicrontriggers.veto(O1_ETMY_SATURATION_SNR200.active)
        omicrontriggers = omicrontriggers.veto(O1_CW_INJECTION_TRANSITION.active)
        omicrontriggers = omicrontriggers.veto(O1_BAD_KAPPA_BASIC_CUT_HOFT_C02.active)
        omicrontriggers = omicrontriggers.veto(O1_PARTIAL_FRAME_LOSS_HOFT_C02.active)

        # Obtain detector specific flags
        if opts.detector == "H1":
            omicrontriggers = omicrontriggers.veto(O1_RF45_AM_STABILIZATION.active)
            omicrontriggers = omicrontriggers.veto(O1_ETMY_SATURATION.active)
            omicrontriggers = omicrontriggers.veto(O1_BAD_DATA_BEFORE_LOCKLOSS.active)
            omicrontriggers = omicrontriggers.veto(O1_ETMY_VIOLIN_MODE_2NDHARMONIC_RINGING.active)
            omicrontriggers = omicrontriggers.veto(O1_RF45_SEVERE_GLITCHING.active)
            omicrontriggers = omicrontriggers.veto(O1_EY_BECKHOFF_CHASSIS_PROBLEM.active)
            omicrontriggers = omicrontriggers.veto(O1_ASC_AS_B_RF36_GLITCHING.active)
            omicrontriggers = omicrontriggers.veto(O1_BAD_STRAIN_HOFT_C02.active)
            omicrontriggers = omicrontriggers.veto(O1_TOGGLING_BAD_KAPPA_HOFT_C02.active)
        else:
            omicrontriggers = omicrontriggers.veto(O1_ETMY_SATURATION.active)
            omicrontriggers = omicrontriggers.veto(O1_BAD_DATA_BEFORE_LOCKLOSS.active)
            omicrontriggers = omicrontriggers.veto(O1_PCAL_GLITCHES_GT_20P.active)
            omicrontriggers = omicrontriggers.veto(O1_SUDDEN_PSD_CHANGE.active)
            omicrontriggers = omicrontriggers.veto(O1_BAD_VCO_OFFSET.active)
            omicrontriggers = omicrontriggers.veto(O1_SEVERE_60_200_HZ_NOISE.active)
        


    print "Final trigger length: {0}".format(len(omicrontriggers))

    return omicrontriggers
示例#11
0
ifo = sys.argv[1]
chan = sys.argv[2]
st = int(sys.argv[3])
dur = int(sys.argv[4])
et = st + dur

primary_channel = '%s:%s' % (ifo, chan)
vco_channel = ifo + ":SYS-TIMING_C_FO_A_PORT_11_SLAVE_CFC_FREQUENCY_5"

# VCO is sampled in the middle of the second, reported one second later
conn = datafind.GWDataFindHTTPConnection()
cache = conn.find_frame_urls(ifo[0], '%s_R' % ifo, st, et, urltype='file')
vco = TimeSeries.read(cache, vco_channel, st, et + 2)
vco = vco[8::16].value
vco_major_MHz = int(median(vco) / 1.e6)
vco -= 1e6 * vco_major_MHz
vco_interp = UnivariateSpline(arange(len(vco)) - 0.5, vco)

trigs = SnglBurstTable.fetch(primary_channel,
                             'omicron',
                             st,
                             et,
                             filt=lambda x: st <= x.get_peak() < et)

result = []
for trg in trigs:
    f_vco = vco_interp(float(trg.get_peak()) - st)
    result.append((f_vco, trg.peak_frequency, trg.snr))
save('%s-%s_versus_vco-%u-%u.npy' % (ifo, chan, st, dur), result)
if args.ranking_statistic == 'snr':
    trig_time = window_times[highestSNR]
    trig_template = template_ids[highestSNR]
elif args.ranking_statistic == 'newsnr':
    trig_time = window_times[highestnewSNR]
    trig_template = template_ids[highestnewSNR]

mass1vec = template_file['mass1'][:]
mass2vec = template_file['mass2'][:]
mass1 = mass1vec[trig_template]
mass2 = mass2vec[trig_template]


logging.info('Fetching omicron triggers')
omicron_trigs = SnglBurstTable.fetch(hoft_chan,'omicron',start_time,end_time)
omicron_times = np.add(omicron_trigs.get_column('peak_time'),omicron_trigs.get_column('peak_time_ns')*10**-9)
omicron_snr = omicron_trigs.get_column('snr')
omicron_freq = omicron_trigs.get_column('peak_frequency')

from pycbc.workflow.segment import fromsegmentxml
import pycbc.pnutils

f_low = 30
f_high = pycbc.pnutils.f_SchwarzISCO(mass1+mass2)

inspiral_t, inspiral_f = pycbc.pnutils.get_inspiral_tf(trig_time, mass1, mass2, f_low, f_high)

logging.info('Plotting')

cm = plt.cm.get_cmap('Reds')
示例#13
0
def plot_triggers(params,channel,segment):
    """plot omicron triggers for given channel and segment.

    @param params
        seismon params dictionary
    @param channel
        seismon channel structure
    @param segment
        [start,end] gps
    """

    gpsStart = segment[0]
    gpsEnd = segment[1]

    omicronDirectory = os.path.join(params["path"],"omicron")
    omicronPath = os.path.join(omicronDirectory,channel.station)
    omicronXMLs = glob.glob(os.path.join(omicronPath,"*.xml"))

    table = []
    for ii in xrange(len(omicronXMLs)):
        tabletmp = SnglBurstTable.read(omicronXMLs[0])
        #print tabletmp
        for jj in xrange(len(tabletmp)):
            table.append(tabletmp[jj])
        #print table
        #print stop
    #table = laldetchar.triggers.from_files(omicronXMLs, "omicron")

    if table == []:
       return
   
    peak_times = gwpy.plotter.table.get_table_column(table, "peak_time")
    central_freqs = gwpy.plotter.table.get_table_column(table, "central_freq")
    snrs = gwpy.plotter.table.get_table_column(table, "snr")

    textLocation = params["path"] + "/" + channel.station_underscore
    seismon.utils.mkdir(textLocation)

    f = open(os.path.join(textLocation,"triggers.txt"),"w")
    for peak_time,central_freq,snr in zip(peak_times,central_freqs,snrs):
        f.write("%.1f %e %e\n"%(peak_time,central_freq,snr))
    f.close()

    if params["doPlots"]:

        plotLocation = params["path"] + "/" + channel.station_underscore
        seismon.utils.mkdir(plotLocation)

        if params["doEarthquakesAnalysis"]:
            pngFile = os.path.join(plotLocation,"omicron-%d-%d.png"%(gpsStart,gpsEnd))
        else:
            pngFile = os.path.join(plotLocation,"omicron.png")

        epoch = gwpy.time.Time(gpsStart, format='gps')
       
        #plot = gwpy.plotter.EventTablePlot(table, 'time', 'central_freq', 'snr', figsize=[14,8],epoch=gpsStart,size_by_log='snr', size_range=[6, 20],edgecolor='none')
        plot = table.plot('time', 'central_freq', color='snr', edgecolor='none', epoch=gpsStart)
        plot.add_colorbar(log=True, clim=[6, 20],label='Signal-to-noise ratio (SNR)')
        plot.xlim = [gpsStart, gpsEnd]
        plot.ylabel = 'Frequency [Hz]'
        plot.ylim = [params["fmin"],params["fmax"]]
        plot.axes[0].set_yscale("log")
        plot.save(pngFile)
        plot.close()

        print pngFile
        print peak_times
        print gpsStart, gpsEnd
        print stop
示例#14
0
                                             end=end,
                                             ifo=ifo)
vdf.populate()
print('Read %d flags from veto definer' % len(vdf.keys()))

categories = [1, 2, 3, 4]
vdfCats = dict((c, DataQualityDict()) for c in categories)
for name, flag in vdf.iteritems():
    try:
        vdfCats[flag.category][name] = flag
    except KeyError:
        pass

#generate the triggers needed to run vet
if analysis == 'omicron':
    triggers = SnglBurstTable.fetch('%s:GDS-CALIB_STRAIN' % ifo, 'omicron',
                                    start, end)
else:
    triggers = SnglBurstTable.read(trigPath, ifo=ifo, format='cwb-ascii')

#convert the metrics to a standard notation
newMetric = []
for metric in metrics:
    newMetric.append(get_metric(metric))

order = ['1', '1+4', '1+2+4', '1+2+3+4']
for categories in order:
    category = categories.split('+')
    activeVdf = DataQualityFlag('VDFs')
    for cat in category:
        for flag in vdfCats[int(cat)]:
            activeVdf.known += vdf[flag].known