Skip to content

Commit

Permalink
Merge 8e8bca1 into 28ecfef
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharth101 committed Mar 28, 2019
2 parents 28ecfef + 8e8bca1 commit 73f3afd
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions bin/gwdetchar-scattering
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import gwtrigfind

from gwpy.plot import Plot
from gwpy.plot.tex import label_to_latex
from gwpy.table import EventTable
from gwpy.table import (Table, EventTable)
from gwpy.table.filters import in_segmentlist
from gwpy.segments import (DataQualityFlag, DataQualityDict,
Segment, SegmentList)
Expand Down Expand Up @@ -164,7 +164,7 @@ if args.gpsstart >= 1230336018: # Jan 1 2019
read_kw = {
"columns": names,
"selection": [
"frequency < {}".format(args.frequency_threshold * 2),
"{0} < frequency < {1}".format(10, args.frequency_threshold * 4),
("time", in_segmentlist, statea),
],
"format": "hdf5",
Expand All @@ -183,7 +183,7 @@ else:
read_kw = {
"columns": names,
"selection": [
"peak_frequency < {}".format(args.frequency_threshold * 2),
"{0} < peak_frequency < {1}".format(10, args.frequency_threshold * 4),
('peak', in_segmentlist, statea),
],
"format": 'ligolw',
Expand Down Expand Up @@ -263,6 +263,7 @@ for i, seg in enumerate(statea):
obs=args.ifo[0], verbose=msg, nproc=args.nproc).resample(128))

scatter_segments = DataQualityDict()
actives = SegmentList()

for i, channel in enumerate(sorted(alldata[0].keys())):
logger.info("-- Processing %s" % channel)
Expand Down Expand Up @@ -347,6 +348,9 @@ for i, channel in enumerate(sorted(alldata[0].keys())):
else:
effdt = efficiencypc/deadtimepc
logger.info("Efficiency/Deadtime: %.2f" % effdt)

if abs(scatter_segments[channel].active):
actives.extend(scatter_segments[channel].active)

# finalize plot
logger.debug("Plotting")
Expand Down Expand Up @@ -472,8 +476,8 @@ for i, channel in enumerate(sorted(alldata[0].keys())):
page.tr.close()
page.tr()
page.th('Efficiency<br><small>(SNR&ge;8 and '
'f<sub>peak</sub>&lt;%.2f Hz)</small>'
% (2 * args.frequency_threshold))
'%.2f Hz</sub>&ltf<sub>peak</sub>&lt;%.2f Hz)</small>'
% (10, 4 * args.frequency_threshold))
page.td('%d/%d events' % (efficiency, len(highsnrtrigs)))
page.td('%.2f%%' % efficiencypc)
page.tr.close()
Expand All @@ -497,6 +501,15 @@ for i, channel in enumerate(sorted(alldata[0].keys())):
# close panel group
page.div.close()

# write a csv file.
logger.debug('Writing a summary CSV record')

actives = actives.coalesce() # merge contigous segments
gps = [x for x in highsnrtrigs[names[0]] for y in actives if x in y]
segs = [tuple(y) for x in highsnrtrigs[names[0]] for y in actives if x in y]
data = Table([gps, segs], names=['trigger_time', 'segment'])
data.write('summary.csv', overwrite=True, fast_writer=False)

# -- finalize -----------------------------------------------------------------

# write segments
Expand Down

0 comments on commit 73f3afd

Please sign in to comment.