diff --git a/gstlal-ugly/bin/gstlal_burst_injections_by_rate b/gstlal-ugly/bin/gstlal_burst_injections_by_rate
deleted file mode 100755
index ae29c6cf6fd143b233185521e7c73d312d7d65cd..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_burst_injections_by_rate
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2012 Chris Pankow
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-if [ "$#" != "5" ]; then
-	echo "Usage: gstlal_burst_injections_by_rate GPS_START GPS_END SG_RATE WNB_RATE SC_RATE"
-	exit
-fi
-
-#er1_start=`lalapps_tconvert now`
-#er1_end=`lalapps_tconvert now + 256 seconds`
-er1_start=$1
-er1_end=$2
-
-echo "Period begin/end: $er1_start $er1_end"
-
-sg_rate=$3
-wnb_rate=$4
-sc_rate=$5
-
-echo "SineGaussian rate $sg_rate Hz"
-echo "White Noise Burst rate $wnb_rate Hz"
-echo "String Cusp rate $sc_rate Hz"
-
-wnb_energy_over_r2_max=1e-16
-wnb_energy_over_r2_min=1e-24
-
-sg_freq=(70 235 849 1615 2000 2477 3067)
-sg_q=(3 9 100)
-
-# Burst injections need a zero lag time slide id to work with
-if [ ! -f "HLV_ZERO_LAG.xml" ]; then
-	lalapps_gen_timeslides -i H1=0:0:0 -i L1=0:0:0 -i V1=0:0:0 > HLV_ZERO_LAG.xml
-fi
-
-# sine gaussian
-for sgf in ${sg_freq[@]}; do
-	for sgq in ${sg_q[@]}; do
-		outf=$er1_start-`echo $er1_end - $er1_start | bc`-sg${sgf}q${sgq}-burstinj.xml
-		echo " lalapps_binj  --gps-end-time $er1_end  --gps-start-time $er1_start  --max-hrss 1e-23  --min-hrss 1e-26 --min-frequency $sgf --max-frequency $sgf --population all_sky_sinegaussian --q $sgq --seed $er1_start --time-step `echo 1.0/$sg_rate | bc -l` --jitter 100 --user-tag \"ER1 Burst SG injections\" --time-slide-file HLV_ZERO_LAG.xml --output $outf --seed $(($sgq*$sgf)) "
-
-		lalapps_binj  \
-			--gps-end-time $er1_end  \
-			--gps-start-time $er1_start  \
-			--max-hrss 1e-23  \
-			--min-hrss 1e-26  \
-			--min-frequency $sgf \
-			--max-frequency $sgf \
-			--population all_sky_sinegaussian \
-			--q $sgq \
-			--seed $(($sgq*$sgf)) \
-			--time-step `echo 1.0/$sg_rate | bc -l` \
-			--jitter 100 \
-			--user-tag "ER1 Burst SG injections" \
-			--time-slide-file HLV_ZERO_LAG.xml \
-			--output $outf
-
-	done
-done
-
-# Band limited WNB
-
-#wnbs=( (100 100 0.1) (1000 10 0.1) (1000 1000 0.01) (1000 1000 0.1) )
-
-outf=$er1_start-`echo $er1_end - $er1_start | bc`-wnb100df100t100-burstinj.xml
-
-echo "lalapps_binj  --gps-end-time $er1_end  --gps-start-time $er1_start  --max-e-over-r2 $wnb_energy_over_r2_max  --min-e-over-r2 $wnb_energy_over_r2_min  --min-duration 0.1 --max-duration 0.1 --min-bandwidth 100 --max-bandwidth 100 --min-frequency 100 --max-frequency 100 --population all_sky_btlwnb --jitter 100 --seed 1234 --time-step `echo 1.0/$wnb_rate | bc -l` --user-tag "ER1 Burst WNB injections" --time-slide-file HLV_ZERO_LAG.xml --output $outf"
-
-lalapps_binj  \
-	--gps-end-time $er1_end  \
-	--gps-start-time $er1_start  \
-	--max-e-over-r2 $wnb_energy_over_r2_max  \
-	--min-e-over-r2 $wnb_energy_over_r2_min  \
-	--min-duration 0.1 \
-	--max-duration 0.1 \
-	--min-bandwidth 100 \
-	--max-bandwidth 100 \
-	--min-frequency 100 \
-	--max-frequency 100 \
-	--population all_sky_btlwnb \
-	--seed 1234 \
-	--jitter 100 \
-	--time-step `echo 1.0/$wnb_rate | bc -l` \
-	--user-tag "ER1 Burst WNB injections" \
-	--time-slide-file HLV_ZERO_LAG.xml \
-	--output $outf
-
-outf=$er1_start-`echo $er1_end - $er1_start | bc`-wnb1000df10t100-burstinj.xml
-
-echo "lalapps_binj  --gps-end-time $er1_end  --gps-start-time $er1_start  --max-e-over-r2 $wnb_energy_over_r2_max  --min-e-over-r2 $wnb_energy_over_r2_min  --min-duration 0.1 --max-duration 0.1 --min-bandwidth 10 --max-bandwidth 10 --min-frequency 1000 --max-frequency 1000 --population all_sky_btlwnb --jitter 100 --seed 1243 --time-step `echo 1.0/$wnb_rate | bc -l` --user-tag "ER1 Burst WNB injections" --time-slide-file HLV_ZERO_LAG.xml --output $outf"
-
-lalapps_binj  \
-	--gps-end-time $er1_end  \
-	--gps-start-time $er1_start  \
-	--max-e-over-r2 $wnb_energy_over_r2_max  \
-	--min-e-over-r2 $wnb_energy_over_r2_min  \
-	--min-duration 0.1 \
-	--max-duration 0.1 \
-	--min-bandwidth 10 \
-	--max-bandwidth 10 \
-	--min-frequency 1000 \
-	--max-frequency 1000 \
-	--population all_sky_btlwnb \
-	--seed 1243 \
-	--jitter 100 \
-	--time-step `echo 1.0/$wnb_rate | bc -l` \
-	--user-tag "ER1 Burst WNB injections" \
-	--time-slide-file HLV_ZERO_LAG.xml \
-	--output $outf
-
-outf=$er1_start-`echo $er1_end - $er1_start | bc`-wnb1000df100t10-burstinj.xml
-
-echo "lalapps_binj  --gps-end-time $er1_end  --gps-start-time $er1_start  --max-e-over-r2 $wnb_energy_over_r2_max  --min-e-over-r2 $wnb_energy_over_r2_min  --min-duration 0.01 --max-duration 0.01 --min-bandwidth 100 --max-bandwidth 100 --min-frequency 1000 --max-frequency 1000 --population all_sky_btlwnb --jitter 100 --seed 1423 --time-step `echo 1.0/$wnb_rate | bc -l` --user-tag "ER1 Burst WNB injections" --time-slide-file HLV_ZERO_LAG.xml --output $outf"
-
-lalapps_binj  \
-	--gps-end-time $er1_end  \
-	--gps-start-time $er1_start  \
-	--max-e-over-r2 $wnb_energy_over_r2_max  \
-	--min-e-over-r2 $wnb_energy_over_r2_min  \
-	--min-duration 0.01 \
-	--max-duration 0.01 \
-	--min-bandwidth 100 \
-	--max-bandwidth 100 \
-	--min-frequency 1000 \
-	--max-frequency 1000 \
-	--population all_sky_btlwnb \
-	--jitter 100 \
-	--seed 1423 \
-	--time-step `echo 1.0/$wnb_rate | bc -l` \
-	--user-tag "ER1 Burst WNB injections" \
-	--time-slide-file HLV_ZERO_LAG.xml \
-	--output $outf
-
-outf=$er1_start-`echo $er1_end - $er1_start | bc`-wnb1000df1000t100-burstinj.xml
-
-echo "lalapps_binj  --gps-end-time $er1_end  --gps-start-time $er1_start  --max-e-over-r2 $wnb_energy_over_r2_max  --min-e-over-r2 $wnb_energy_over_r2_min  --min-duration 0.1 --max-duration 0.1 --min-bandwidth 1000 --max-bandwidth 1000 --min-frequency 1000 --max-frequency 1000 --population all_sky_btlwnb --jitter 100 --seed 4123 --time-step `echo 1.0/$wnb_rate | bc -l` --user-tag "ER1 Burst WNB injections" --time-slide-file HLV_ZERO_LAG.xml --output $outf"
-
-lalapps_binj  \
-	--gps-end-time $er1_end  \
-	--gps-start-time $er1_start  \
-	--max-e-over-r2 $wnb_energy_over_r2_max  \
-	--min-e-over-r2 $wnb_energy_over_r2_min  \
-	--min-duration 0.1 \
-	--max-duration 0.1 \
-	--min-bandwidth 1000 \
-	--max-bandwidth 1000 \
-	--min-frequency 1000 \
-	--max-frequency 1000 \
-	--population all_sky_btlwnb \
-	--jitter 100 \
-	--seed 4123 \
-	--time-step `echo 1.0/$wnb_rate | bc -l` \
-	--user-tag "ER1 Burst WNB injections" \
-	--time-slide-file HLV_ZERO_LAG.xml \
-	--output $outf
-
-# String cusp
-
-outf=$er1_start-`echo $er1_end - $er1_start | bc`-stringcusp-burstinj.xml
-
-echo "lalapps_binj  --gps-end-time $er1_end  --gps-start-time $er1_start --min-frequency 149 --max-frequency 150 --population string_cusp --min-amplitude 1e-21 --max-amplitude 1e-21 --jitter 100 --seed 4321 --time-step `echo 1.0/$sc_rate | bc -l` --jitter 100 --user-tag "ER1 Burst string cusp injections" --time-slide-file HLV_ZERO_LAG.xml --output $outf"
-
-lalapps_binj  \
-	--gps-end-time $er1_end  \
-	--gps-start-time $er1_start \
-	--min-frequency 149 \
-	--max-frequency 150 \
-	--population string_cusp \
-	--min-amplitude 1e-21 \
-	--max-amplitude 1e-20 \
-	--jitter 100 \
-	--seed 4321 \
-	--time-step `echo 1.0/$sc_rate | bc -l` \
-	--user-tag "ER1 Burst string cusp injections" \
-	--time-slide-file HLV_ZERO_LAG.xml \
-	--output $outf
-
-#outf=$er1_start-`echo $er1_end - $er1_start | bc`-all-burstinj.xml
-outf=burst_injections.xml
-ligolw_add --ilwdchar-compat -o $outf *-burstinj.xml
-rm *-burstinj.xml
diff --git a/gstlal-ugly/bin/gstlal_burst_injections_by_rate_plot b/gstlal-ugly/bin/gstlal_burst_injections_by_rate_plot
deleted file mode 100755
index af7d9f088d11372d6ed7e939beac9fb78bc53d58..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_burst_injections_by_rate_plot
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012 Chris Pankow
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import sys
-
-import matplotlib
-matplotlib.use( 'Agg' )
-import pylab
-
-import numpy
-import math
-
-from glue.ligolw import utils
-from glue.ligolw import lsctables
-
-xmldoc = utils.load_filename( sys.argv[1] )
-tables = lsctables.getTablesByType( xmldoc, lsctables.SimBurstTable )[0]
-time = [ simburst.time_geocent_gps for simburst in tables ]
-hrss = [ simburst.hrss for simburst in tables ]
-ra = [ simburst.ra for simburst in tables ]
-dec = [ simburst.dec for simburst in tables ]
-psi = [ simburst.psi for simburst in tables ]
-
-p_t = []
-r_t  = []
-ts = numpy.linspace( min(time), max(time), 100 )
-look_back_t = ts[1] - ts[0]
-for t in ts:
-	inj = filter(lambda th: abs(th[0] - t) < look_back_t and th[0] < t, zip( time, hrss ) )
-	ninj = len(inj)
-	power = sum( [ h**2 for t, h in inj if not math.isnan(h) ] )
-	r_t.append( ninj / look_back_t )
-	p_t.append( power )
-
-pylab.figure()
-pylab.grid()
-pylab.xlim( min(time), max(time) )
-pylab.plot( ts, r_t, 'k-' )
-pylab.scatter( ts, r_t, c=numpy.log10(p_t), s=10, label="Total injection hrss (%d s)" % look_back_t )
-
-pylab.legend()
-cb = pylab.colorbar()
-cb.set_label( "$\log_{10}{h_{rss}}$" )
-pylab.xlabel( "GPS Time" )
-pylab.ylabel( "Injection Rate (s)" )
-pylab.title( "Injection statistics" )
-pylab.savefig( "injstat.png" )
-
-pylab.figure()
-pylab.grid()
-pylab.scatter( ra, dec, c=psi, s=10 )
-pylab.xlim( 0, 2*numpy.pi )
-pylab.ylim( -numpy.pi/2, numpy.pi/2 )
-
-cb = pylab.colorbar()
-cb.set_label( "Polarization angle $\psi$" )
-pylab.xlabel( "Right Ascension (RA, rad)" )
-pylab.ylabel( "Declination (dec, rad)" )
-pylab.title( "Sky location and Polarization Angle" )
-pylab.savefig( "skystat.png" )
-
-tables = lsctables.getTablesByType( xmldoc, lsctables.SimBurstTable )
-tables = filter( lambda t: t.waveform == "SineGaussian", tables[0] )
-time = [ simburst.time_geocent_gps for simburst in tables ]
-q  = [ simburst.q for simburst in tables]
-fcent = [ simburst.frequency for simburst in tables ]
-hrss = [ simburst.hrss for simburst in tables ]
-
-markers = ['o', 's', '^', 'V', '*' ]
-inj_types = set( q )
-inj_mark = dict( zip(inj_types, markers) )
-
-# TF plot
-pylab.figure()
-pylab.grid()
-pylab.xlim( min(time), max(time) )
-pylab.ylim( 10, 3000 )
-pylab.semilogy()
-#pylab.scatter( time, flow, c=numpy.log10(hrss), s=4 )
-
-#organize injections
-for itype, m in inj_mark.iteritems():
-
-	inj_time, inj_freq, inj_hrss = [], [], []
-	for t, f, qi, h in zip( time, fcent, q, hrss ):
-		if( qi != itype ): continue
-		inj_time.append( t )
-		inj_freq.append( f )
-		inj_hrss.append( h )
-
-	title = "SG q=%d" % itype
-	pylab.scatter( inj_time, inj_freq, 
-		c=numpy.log10(inj_hrss), edgecolor='none', s=10, marker=m, label=title )
-
-cb = pylab.colorbar()
-cb.set_label( "$\log_{10}{h_{rss}}$" )
-pylab.legend()
-pylab.xlabel( "GPS Time" )
-pylab.ylabel( "Frequency (lower, Hz)" )
-pylab.title( "SG Injections during ER1" )
-
-#for t, b, d, f, h in zip(time, bandwidth, duration, flow, hrss):
-	#pylab.bar( t, b, d, f ) #, color = h, edgecolor = h )
-
-pylab.savefig( "hrss_time_sg.png" )
-
-# TF plot
-pylab.figure()
-pylab.grid()
-pylab.xlim( min(time), max(time) )
-pylab.ylim( min(hrss), max(hrss) )
-pylab.semilogy()
-
-#organize injections
-for itype, m in inj_mark.iteritems():
-
-	inj_time, inj_freq, inj_hrss = [], [], []
-	for t, f, qi, h in zip( time, fcent, q, hrss ):
-		if( qi != itype ): continue
-		inj_time.append( t )
-		inj_freq.append( f )
-		inj_hrss.append( h )
-
-	title = "SG q=%d" % itype
-	pylab.scatter( inj_time, inj_hrss, 
-		c=inj_freq, s=10, edgecolor='none', marker=m, label=title )
-
-cb = pylab.colorbar()
-cb.set_label( "Center Frequency" )
-pylab.legend()
-pylab.xlabel( "GPS Time" )
-pylab.ylabel( "$h_{rss}$" )
-pylab.title( "SineGaussian Injections during ER1" )
-
-pylab.savefig( "hrss_freq_sg.png" )
-
-tables = lsctables.getTablesByType( xmldoc, lsctables.SimBurstTable )
-tables = filter( lambda t: t.waveform == "BTLWNB", tables[0] )
-time = [ simburst.time_geocent_gps for simburst in tables ]
-bandwidth = [ numpy.round(simburst.bandwidth) for simburst in tables ]
-duration  = [ numpy.round(1e3*simburst.duration) for simburst in tables ]
-flow = [ numpy.round(simburst.frequency) for simburst in tables ]
-hrss = [ simburst.hrss for simburst in tables ]
-
-
-markers = ['o', 'v', '^', 's', '*' ]
-inj_types = set( zip(flow,bandwidth,duration) )
-inj_mark = dict( zip(inj_types, markers) )
-
-# TF plot
-pylab.figure()
-pylab.grid()
-pylab.xlim( min(time), max(time) )
-pylab.ylim( 10, 3000 )
-pylab.semilogy()
-#pylab.scatter( time, flow, c=numpy.log10(hrss), s=4 )
-
-#organize injections
-for itype, m in inj_mark.iteritems():
-
-	inj_time, inj_freq, inj_hrss = [], [], []
-	for t, f, b, d, h in zip( time, flow, bandwidth, duration, hrss ):
-		if( (f, b, d) != itype ): continue
-		inj_time.append( t )
-		inj_freq.append( f )
-		inj_hrss.append( h )
-
-	title = "WNB $f_{low}$ %d $\Delta f$ %d, $\Delta t$ %0.2f" % itype 
-	pylab.scatter( inj_time, inj_freq, 
-		edgecolors='none',
-		c=numpy.log10(inj_hrss), s=10, marker=m, label=title )
-
-cb = pylab.colorbar()
-cb.set_label( "$\log_{10}{h_{rss}}$" )
-pylab.legend()
-pylab.xlabel( "GPS Time" )
-pylab.ylabel( "Frequency (lower, Hz)" )
-pylab.title( "WNB Injections during ER1" )
-
-#for t, b, d, f, h in zip(time, bandwidth, duration, flow, hrss):
-	#pylab.bar( t, b, d, f ) #, color = h, edgecolor = h )
-
-pylab.savefig( "hrss_time_wnb.png" )
-
-# TF plot
-pylab.figure()
-pylab.grid()
-pylab.xlim( min(time), max(time) )
-pylab.ylim( min(hrss), max(hrss) )
-pylab.semilogy()
-
-#organize injections
-for itype, m in inj_mark.iteritems():
-
-	inj_time, inj_freq, inj_hrss = [], [], []
-	for t, f, b, d, h in zip( time, flow, bandwidth, duration, hrss ):
-		if( (f, b, d) != itype ): continue
-		inj_time.append( t )
-		inj_freq.append( f )
-		inj_hrss.append( h )
-
-	title = "WNB $f_{low}$ %d $\Delta f$ %d, $\Delta t$ %d (ms)" % itype 
-	pylab.scatter( inj_time, inj_hrss, edgecolors='none', s=10, marker=m, label=title )
-
-#cb = pylab.colorbar()
-#cb.set_label( "Lower Frequency" )
-pylab.legend()
-pylab.xlabel( "GPS Time" )
-pylab.ylabel( "$h_{rss}$" )
-pylab.title( "WNB Injections during ER1" )
-
-#for t, b, d, f, h in zip(time, bandwidth, duration, flow, hrss):
-	#pylab.bar( t, b, d, f ) #, color = h, edgecolor = h )
-
-pylab.savefig( "hrss_freq_wnb.png" )
diff --git a/gstlal-ugly/bin/gstlal_cbc_sensitivity_vs_flow_at_fixed_computational_cost b/gstlal-ugly/bin/gstlal_cbc_sensitivity_vs_flow_at_fixed_computational_cost
deleted file mode 100755
index 526036fd1301fd0479becac6ce12090af79ca8c9..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_cbc_sensitivity_vs_flow_at_fixed_computational_cost
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012  Drew Keppel
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import sys
-import matplotlib
-matplotlib.use("TkAgg")
-goldenratio = 2 / (1 + 5**.5)
-matplotlib.rcParams.update({
-        "font.size": 8.0,
-        "axes.titlesize": 8.0,
-        "axes.labelsize": 8.0,
-        "xtick.labelsize": 8.0,
-        "ytick.labelsize": 8.0,
-        "legend.fontsize": 8.0,
-	"figure.figsize": (3.3,3.3*goldenratio),
-        "figure.dpi": 200,
-	"subplots.left": 0.2, 
-	"subplots.right": 0.75, 
-	"subplots.bottom": 0.15,
-	"subplots.top": 0.75,
-        "savefig.dpi": 200,
-        "text.usetex": True     # render all text with TeX
-})
-from matplotlib import pyplot
-import lal
-from glue.ligolw import utils as ligolw_utils
-import gstlal.coherent_inspiral_metric as metric
-import gstlal.coherent_inspiral_metric_detector_details as detector_details
-import scipy
-import numpy
-from scipy import pi,sin,cos,exp,log
-import math
-from optparse import OptionParser
-
-__author__ = "Drew Keppel <drew.keppel@ligo.org>"
-
-parser = OptionParser(description = __doc__)
-parser.add_option("--flow-min", metavar = "int", type = "int", help="Minimum lower frequency cutoff")
-parser.add_option("--flow-max", metavar = "int", type = "int", help="Maximum lower frequency cutoff")
-parser.add_option("--flow-ref", metavar = "int", type = "int", help="Reference lower frequency cutoff")
-parser.add_option("--mismatch-ref", metavar = "float", type = "float", help="Reference mismatch = 1. - minimal match")
-parser.add_option("--filter-cost", help="Single filter cost. (fixed|cycles)")
-parser.add_option("--output", metavar = "filename", help = "Save the generated figure to file to filename")
-parser.add_option("--psd-file", metavar = "psdfilename", help = "Load the psd from psdfilename")
-parser.add_option("--psd-name", metavar = "psdname", help = "Extract the psd named psdname from psdfilename")
-parser.add_option("--verbose", action = "store_true", help = "Be verbose.")
-options, filenames = parser.parse_args()
-
-if options.filter_cost not in ['fixed', 'cycles']:
-	print >> sys.stderr, "--filter-cost must be one of (fixed|cycles)"
-	sys.exit(1)
-
-# set up the parameters of the signal
-m1 = 1.
-m2 = 1.
-M = m1+m2
-mu = m1*m2/M
-eta = mu/M
-mchirp = M*eta**.6
-
-# set frequency parameters
-flow_bank = options.flow_ref
-fNyq = 2048.
-
-# load and condition psd
-new_psds = lal.series.read_psd_xmldoc(ligolw_utils.load_filename(options.psd_file, verbose=options.verbose, contenthandler=lal.series.PSDContentHandler))
-psd_REAL8FrequencySeries = new_psds[options.psd_name]
-deltaF = psd_REAL8FrequencySeries.deltaF
-f0 = psd_REAL8FrequencySeries.f0
-f = scipy.arange(fNyq/deltaF+1)*deltaF + f0
-psd_REAL8FrequencySeries.data = psd_REAL8FrequencySeries.data[:len(f)]
-PSD = scipy.zeros(2*(fNyq/deltaF), dtype='float')+scipy.inf
-PSD[f0/deltaF:fNyq/deltaF+1] = psd_REAL8FrequencySeries.data
-if -scipy.floor(f0/deltaF) == 0:
-	PSD[fNyq/deltaF+1:] = psd_REAL8FrequencySeries.data[-2:0:-1]
-else:
-	PSD[fNyq/deltaF+1:-scipy.floor(f0/deltaF)] = psd_REAL8FrequencySeries.data[-2:0:-1]
-psd_REAL8FrequencySeries.data = PSD
-f = detector_details.f_for_fft(flow_bank, fNyq, psd_REAL8FrequencySeries.deltaF)
-psd = psd_REAL8FrequencySeries.data
-psd[abs(f) < flow_bank] = scipy.inf
-LHO = detector_details.make_LHO(fLow=flow_bank, fNyq=fNyq)
-LHO.set_psd(f, psd)
-LHO.set_required_moments()
-
-# create the metric for this point of parameter space
-snr2 = LHO.I_n['-7']
-g = metric.single_detector_mass_metric(LHO, mchirp*metric.M_sun, eta)
-rootdetg0 = (scipy.linalg.det(g))**.5
-
-# loop over other flows
-flows = scipy.linspace(options.flow_min, options.flow_max, options.flow_max - options.flow_min + 1)
-rootdetgs = []
-snr2s = []
-for flow in flows:
-	psd = psd_REAL8FrequencySeries.data
-	psd[abs(f) < flow] = scipy.inf
-	LHO.set_psd(f, psd)
-	LHO.set_required_moments()
-	g = metric.single_detector_mass_metric(LHO, mchirp*metric.M_sun, eta)
-	rootdetgs.append((scipy.linalg.det(g))**.5)
-	snr2s.append(LHO.I_n['-7'])
-rootdetgs = scipy.array(rootdetgs)
-snr2s = scipy.array(snr2s)
-
-# cost of a single filter given by number of cycles from flow to fisco
-filter_cost_dict = {}
-filter_cost_dict[10.] = 28459.942721
-filter_cost_dict[11.] = 24292.990888
-filter_cost_dict[12.] = 21023.699209
-filter_cost_dict[13.] = 18405.878657
-filter_cost_dict[14.] = 16274.683630
-filter_cost_dict[15.] = 14511.672718
-filter_cost_dict[16.] = 13037.004411
-filter_cost_dict[17.] = 11787.844083
-filter_cost_dict[18.] = 10720.194326
-filter_cost_dict[19.] = 9798.932266
-filter_cost_dict[20.] = 8998.386507
-filter_cost_dict[21.] = 8297.711844
-filter_cost_dict[22.] = 7680.818917
-filter_cost_dict[23.] = 7133.961077
-filter_cost_dict[24.] = 6646.451169
-filter_cost_dict[25.] = 6210.901952
-filter_cost_dict[26.] = 5818.352048
-filter_cost_dict[27.] = 5464.524287
-filter_cost_dict[28.] = 5144.209545
-filter_cost_dict[29.] = 4852.570085
-filter_cost_dict[30.] = 4586.442188
-filter_cost_dict[31.] = 4342.950681
-filter_cost_dict[32.] = 4119.775802
-filter_cost_dict[33.] = 3914.006141
-filter_cost_dict[34.] = 3724.632136
-filter_cost_dict[35.] = 3549.001642
-filter_cost_dict[36.] = 3386.457720
-filter_cost_dict[37.] = 3235.402843
-filter_cost_dict[38.] = 3094.872198
-filter_cost_dict[39.] = 2963.957300
-filter_cost_dict[40.] = 2841.828222
-
-# choose type of computational cost to use
-if options.filter_cost == 'cycles':
-	filter_cost = []
-	for flow in flows:
-		filter_cost.append(filter_cost_dict[flow])
-	filter_cost = scipy.array(filter_cost)
-	filter_cost /= filter_cost[flows == flow_bank]
-elif options.filter_cost == 'fixed':
-	filter_cost = 1.
-
-# number of dimensions of the parameter space
-d = 2.
-
-# compute mismatch at fixed computational cost
-m_bank = options.mismatch_ref * (filter_cost * rootdetgs / rootdetg0)**(2./d)
-
-# compute recovered snr from bank
-rho_bank = 1. - m_bank
-
-# compute possible snr from integral starting at flow
-rho_int = (snr2s/snr2)**.5
-
-# combine snrs
-rho = rho_int * rho_bank
-
-fig = pyplot.figure()
-ax = fig.add_axes((.15,.16,.8,.6))
-ax.plot(flows, rho_bank, label=r'$\rho_{\rm bank}(f_{\rm low}) / \rho(%i\rm Hz)$'%(flow_bank))
-ax.plot(flows, rho_int, label=r'$\rho_{\rm int}(f_{\rm low}) / \rho(%i\rm Hz)$'%(flow_bank))
-ax.plot(flows, rho, label=r'$\rho_{\rm total}(f_{\rm low}) / \rho(%i\rm Hz)$'%(flow_bank))
-ax.set_ylabel(r'$\rho(f_{\rm low}) / \rho(%i\rm Hz)$'%(flow_bank))
-ax.set_xlabel(r'$f_{\rm low}$')
-pyplot.title(r'$\textrm{Maximum sensitivity at }$\\$f_{\rm low} = %i{\rm Hz},\,m = %s,\textrm{SNR gain} = %.1f\%%$'%(flows[rho == max(rho)], ('%.1e'%(m_bank[rho == max(rho)])).replace('-0','-').replace('+0','').replace('+','').replace('e',r'\times 10^{')+'}',100*(rho[rho == max(rho)]-rho[flows == flow_bank])))
-pyplot.legend(loc='best')
-pyplot.savefig(options.output)
diff --git a/gstlal-ugly/bin/gstlal_display_from_logs b/gstlal-ugly/bin/gstlal_display_from_logs
deleted file mode 100755
index 8a783a8c4c737981004d224a6f79b2f609719fe9..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_display_from_logs
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/python
-
-import sys, os
-import StringIO, base64
-from ligo import segments
-from glue.ligolw import ligolw
-from glue.ligolw import utils
-from glue.ligolw.utils import segments as segutils
-from glue.ligolw.utils import ligolw_add
-from glue.ligolw import lsctables, table
-lsctables.use_in(ligolw.LIGOLWContentHandler)
-import matplotlib
-matplotlib.use('Agg')
-from matplotlib import pyplot
-import numpy
-
-def to_png_figure(caption):
-	f = StringIO.StringIO()
-	pyplot.savefig(f, format="png")
-	print '<div><figure><img src="data:image/png;base64,',base64.b64encode(f.getvalue()),'"></img><figcaption>%s</figcaption></figure></div>' % (caption,)
-	f.close()
-
-print """
-<html>
-<head>
-<style>
-figure {
-  border: thin silver solid;
-  margin: 0.5em;
-  padding: 0.5em;
-}
-figcaption {
-  text-align: center;
-  font-style: italic;
-  font-size: larger;
-  text-indent: 0;
-}
-</style>
-</head>
-<body>"""
-
-xmldoc = ligolw.Document()
-ligolw_add.ligolw_add(xmldoc, [os.path.join(d[0], f) for d in os.walk(sys.argv[1]) for f in d[2] if "xml" in f], contenthandler = ligolw.LIGOLWContentHandler)
-
-# Add nanosecond columns
-segtable = table.get_table(xmldoc, lsctables.SegmentTable.tableName)
-for col in ("start_time_ns",  "end_time_ns"):
-	try:
-		column = segtable.appendColumn(col)
-	except ValueError:
-		continue
-	for i in range(len(segtable)):
-		column[i] = 0
-
-out = sys.stderr
-colordict = {"H1": "r", "L1": "g", "V1": "m"}
-segdictdict = {}
-
-# ASSUME we can combine everything by the name in the segment_definer table
-for r in table.get_table(xmldoc, lsctables.SegmentDefTable.tableName):
-	segdictdict.setdefault(r.name, segments.segmentlistdict())
-	segdictdict[r.name] += segutils.segmenttable_get_by_name(xmldoc, r.name).coalesce()
-
-
-
-for name in sorted(segdictdict.keys()):
-	pyplot.figure(figsize=(15,5))
-	out.write("\nprocessing %s:\n" % name)
-	segsdict = segdictdict[name]
-	endtime = segsdict.extent_all()[1]
-	nifos = len(segsdict.keys())
-	for n, ifo in enumerate(segsdict):
-		segs = sorted(segsdict[ifo], reverse = True)
-		ifo_endtime = segs[0][1]
-		startseg = segs[0]
-		reliability_time = []
-		reliability = []
-		for i, seg in enumerate(segs):
-			if i == 0:
-				reliability_time.append(float(ifo_endtime - endtime)/86400)
-			else:
-				reliability_time.append(float(segments.segmentlist(segs[:i+1]).extent()[0] - ifo_endtime) / 86400)
-			rel = 100 - 100 * (1.0 - float(abs(segments.segmentlist(segs[:i+1]).extent()) - abs(segments.segmentlist(segs[:i+1]))) / float(abs(segments.segmentlist(segs[:i+1]).extent())))
-			if rel == 0:
-				reliability.append(0.000001)
-			else:
-				reliability.append(rel)
-		
-		pyplot.subplot(nifos,1, n+1)
-		y1 = numpy.zeros(len(reliability))
-		y1.fill(0.000001)
-		pyplot.fill_between(reliability_time, y1, reliability, facecolor = colordict[ifo], lw=2, label = ifo)
-		pyplot.gca().set_yscale('log')
-		pyplot.yticks([0.000001,0.01,0.1,1,5], ('0','0.01','0.1','1','5'))
-		pyplot.ylabel('Unsuccessful %% %s' % ifo)
-		pyplot.ylim([0.000001, 5])
-		pyplot.xlim([-3, 0])
-		pyplot.grid()
-	pyplot.xlabel('Time (d)')
-	to_png_figure("%s Fraction of time successfully processed integrated backwards from %d" % (name, endtime))
-
-print "</body></html>"
diff --git a/gstlal-ugly/bin/gstlal_geo_player b/gstlal-ugly/bin/gstlal_geo_player
deleted file mode 100755
index f6adf61b4d31720e649f0d2b6552a2bbd00b8751..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_geo_player
+++ /dev/null
@@ -1,241 +0,0 @@
-#!/usr/bin/env python
-
-import sys, os
-import pygtk
-pygtk.require("2.0")
-import gtk, gobject
-import pygst
-pygst.require("0.10")
-import gst
-
-import numpy
-import scipy
-from scipy import pi, exp, cos
-
-import lal
-from glue.ligolw import utils as ligolw_utils
-from gstlal import pipeparts
-from gstlal import reference_psd
-from gstlal import pipeio
-
-#
-# =============================================================================
-#
-#			       Helper Functions
-#
-# =============================================================================
-#
-
-def auditory_critical_band(f):
-	return 24.7*(1. + 4.37*f/2000./pi)
-
-def gammatone(t, f, b=None, n=4):
-	if b is None:
-		b = auditory_critical_band(f)
-	return t**(n-1.) * exp(-2*pi*b*t) * cos(2*pi*f*t)
-
-#
-# =============================================================================
-#
-#				 Pipelines
-#
-# =============================================================================
-#
-
-def look_and_listen(self):
-	pipeline = gst.Pipeline("player")
-
-	analysis_rate = 4096
-	display_rate = 64
-	fft_length = 2
-	history = 5
-	videox = 800
-	videoy = 525
-
-	f_min = 10.
-	f_max = 2000.
-	f_max = min(f_max, .98*analysis_rate/2)
-	N_filters = 40
-
-	#channel_name = "G1:DER-DATA_H_DQ"
-	#channel_name = "G1:ACO-LSC_MID_MCE_MCN_LV_OUT_DQ"
-	channel_name = "G1:SUS-CHN11_DQ"
-	host = "firefly6"
-	port = 8088
-
-	head = gst.element_factory_make("ndssrc")
-	head.set_property("host", host)
-	head.set_property("channel-name", channel_name)
-	head.set_property("port", port)
-	head.set_property("channel-type", "online")
-	pipeline.add(head)
-
-	head = pipeparts.mkaudioconvert(pipeline, head, caps_string="audio/x-raw-float, width=64")
-	head = pipeparts.mkresample(pipeline, head)
-	head = pipeparts.mkcapsfilter(pipeline, head, "audio/x-raw-float, rate=%i"%(analysis_rate))
-
-	if self.td_whitening:
-		psds = lal.series.read_psd_xmldoc(ligolw_utils.load_filename(self.psd_file_name, contenthandler = lal.series.PSDContentHandler))
-		psd = psds["G1"]
-		psd.data.data = psd.data.data[:analysis_rate/psd.deltaF/2+1]
-		psd = reference_psd.interpolate_psd(psd, 1./fft_length)
-		psd.data.data = psd.data.data[:-1]
-		kernel1,latency1,sample_rate = reference_psd.psd_to_linear_phase_whitening_fir_kernel(psd)
-		kernel2,theta = reference_psd.linear_phase_fir_kernel_to_minimum_phase_whitening_fir_kernel(kernel1)
-		latency2 = 0
-		assert analysis_rate==sample_rate
-
-		# this is the time domain whitener
-		whitener = pipeparts.mkfirbank(pipeline, pipeparts.mkqueue(pipeline, head), fir_matrix=numpy.array([kernel2]))
-		whitener.set_property("time-domain", True)
-		whitener.set_property("latency", latency2)
-	else:
-		# this is the frequency domain whitener, use this to measure a PSD and save it
-		whitener = pipeparts.mkwhiten(pipeline, pipeparts.mkqueue(pipeline, head))
-		whitener.set_property("fft-length", fft_length)
-		whitener.set_property("median-samples", 5)
-		whitener.set_property("average-samples", 5)
-		whitener.set_property("psd-mode", 0)
-
-	tee = pipeparts.mktee(pipeline, whitener)
-
-	# here is the video branch of the pipeline
-	firmatrix = []
-	dt = 1./analysis_rate
-	x = scipy.arange(dt, .1, dt)
-	for idx,fc in enumerate(scipy.logspace(scipy.log10(f_min), scipy.log10(f_max), N_filters)):
-		y = gammatone(x, fc)
-		y /= sum(y*y)**.5
-		firmatrix.append(y[-1::-1])
-	firmatrix = scipy.array(firmatrix)
-	head = pipeparts.mkfirbank(pipeline, pipeparts.mkqueue(pipeline, tee), fir_matrix=firmatrix)
-	head.set_property("time-domain", True)
-	head.set_property("latency", analysis_rate*history)
-
-	head = pipeparts.mkgeneric(pipeline, head, "lal_mean")
-	head.set_property("n", analysis_rate/display_rate)
-	head.set_property("type", 1)
-
-	head = pipeparts.mkgeneric(pipeline, head, "lal_audioundersample")
-	head = pipeparts.mkcapsfilter(pipeline, head, "audio/x-raw-float, rate=%i"%(display_rate))
-
-	head = pipeparts.mkgeneric(pipeline, head, "log10")
-
-	head = pipeparts.mkgeneric(pipeline, head, "cairovis_waterfall")
-	head.set_property("z-autoscale", False)
-	head.set_property("z-min", 0)
-	head.set_property("z-max", 1.5)
-	head.set_property("colorbar", True)
-	head.set_property("y-label", "log10(f)")
-	head.set_property("x-label", "Time")
-	head.set_property("z-label", "log10(SNR^2)")
-	head.set_property("title", "Gammatone Filterbank " + channel_name)
-	head.set_property("y-data-min", round(scipy.log10(f_min), 1))
-	head.set_property("y-data-max", round(scipy.log10(f_max), 1))
-	head.set_property("y-data-autoscale",False)
-	head.set_property("history",history*int(1e9))
-	head = pipeparts.mkcapsfilter(pipeline, head, "video/x-raw-rgb, width=%i, height=%i"%(videox,videoy))
-	imagesink = pipeparts.mkgeneric(pipeline, head,"ximagesink")
-
-	# here is the audio branch of the pipeline
-	head = pipeparts.mkqueue(pipeline, tee)
-
-	head = pipeparts.mkgeneric(pipeline, head, "audiochebband")
-	head.set_property("lower-frequency", f_min)
-	head.set_property("upper-frequency", f_max)
-	head.set_property("poles", 8)
-
-	head = pipeparts.mkgeneric(pipeline, head, "audioamplify")
-	head.set_property("clipping-method", 0)
-	head.set_property("amplification", 1e-1)
-
-	head = pipeparts.mkgeneric(pipeline, head, "audiorate")
-	audio = pipeparts.mkaudioconvert(pipeline, head)
-
-	pipeparts.mkgeneric(pipeline, audio, "autoaudiosink")
-
-	self.player = pipeline
-	self.whitener = whitener
-
-
-class GTK_Main:
-	
-	def __init__(self):
-		window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-		window.set_title("GEO-Player")
-		window.set_default_size(400, 200)
-		window.connect("destroy", gtk.main_quit, "WM destroy")
-		vbox = gtk.VBox()
-		window.add(vbox)
-		self.button = gtk.Button("Start")
-		self.button.connect("clicked", self.start_stop)
-		vbox.add(self.button)
-
-		self.save_psd_button = gtk.Button("Save PSD")
-		self.save_psd_button.connect("clicked", self.save_psd)
-		vbox.add(self.save_psd_button)
-
-		self.print_psd_button = gtk.Button("Print PSD")
-		self.print_psd_button.connect("clicked", self.print_psd)
-		vbox.add(self.print_psd_button)
-
-		self.td_whitening = False
-		self.whitening_domain_button = gtk.Button("FD Whitening")
-		self.whitening_domain_button.connect("clicked", self.whitening_domain)
-		vbox.add(self.whitening_domain_button)
-
-		window.show_all()
-
-		self.psd_file_name = 'G1-GEO_PLAYER_PSD-SUS-CHN11_DQ.xml.gz'
-		self.psd = lal.CreateREAL8FrequencySeries(name = "PSD", epoch = lal.LIGOTimeGPS(0), f0 = 0.0, deltaF = 0.0, sampleUnits = lal.Unit(""), length = 0)
-
-
-	def start_stop(self, w):
-		if self.button.get_label() == "Start":
-			self.button.set_label("Stop")
-			look_and_listen(self)
-
-			bus = self.player.get_bus()
-			bus.add_signal_watch()
-			bus.connect("message", self.on_message)
-
-			self.player.set_state(gst.STATE_PLAYING)
-		else:
-			self.player.set_state(gst.STATE_NULL)
-			self.button.set_label("Start")
-
-			del self.player
-			del self.whitener
-
-	def save_psd(self, w):
-		self.psd_snapshot = self.psd
-		reference_psd.write_psd(self.psd_file_name, {'G1':self.psd_snapshot})
-
-	def print_psd(self, w):
-		print self.psd_snapshot.data
-		print self.psd.data
-
-	def whitening_domain(self, w):
-		if self.whitening_domain_button.get_label() == "FD Whitening":
-			self.td_whitening = True
-			self.whitening_domain_button.set_label("TD Whitening")
-		else:
-			self.td_whitening = False
-			self.whitening_domain_button.set_label("FD Whitening")
-
-	def on_message(self, bus, message):
-		t = message.type
-		if t == gst.MESSAGE_EOS:
-			self.player.set_state(gst.STATE_NULL)
-			self.button.set_label("Start")
-		elif t == gst.MESSAGE_ERROR:
-			self.player.set_state(gst.STATE_NULL)
-			self.button.set_label("Start")
-			err, debug = message.parse_error()
-			print "Error: %s" % err, debug
-		elif t == gst.MessageType.ELEMENT and message.structure.get_name() == "spectrum":
-				self.psd = pipeio.parse_spectrum_message(message)
-
-GTK_Main()
-gtk.gdk.threads_init()
-gtk.main()
diff --git a/gstlal-ugly/bin/gstlal_h1h2_coh_frames b/gstlal-ugly/bin/gstlal_h1h2_coh_frames
deleted file mode 100755
index 810730afdfa57ff53dea125b36a9d788d8c62e21..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_h1h2_coh_frames
+++ /dev/null
@@ -1,383 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012  Madeline Wade
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-
-#
-# =============================================================================
-#
-#                                   Preamble
-#
-# =============================================================================
-
-"""
-Generate frame files for LHO coherent data.  Generate a LIGO Light-Weight XML veto segment file from the LHO null stream.  If the null stream exceeds a threshold, this is marked as a veto segment.
-"""
-
-import os
-import sys
-import numpy
-
-import gobject
-gobject.threads_init()
-import pygtk
-pygtk.require('2.0')
-import pygst
-pygst.require('0.10')
-import gst
-from optparse import OptionParser
-
-import lal
-
-from gstlal import pipeparts
-from gstlal import lloidparts
-from gstlal import reference_psd
-from gstlal import simplehandler
-from gstlal import coherent_null
-from gstlal import inspiral
-from gstlal import datasource
-
-from ligo import segments
-from glue.ligolw import utils as ligolw_utils
-from glue.ligolw.utils import segments as ligolw_segments
-from glue.ligolw.utils import process as ligolw_process
-
-__author__ = "Madeline Wade <madeline.wade@ligo.org>"
-
-#
-# =============================================================================
-#
-#                                 Command Line
-#
-# =============================================================================
-#
-
-parser = OptionParser()
-
-datasource.append_options(parser)
-
-parser.add_option("--write-pipeline", metavar = "filename", help = "Write a DOT graph description of the as-built pipeline to this file (optional).  The environment variable GST_DEBUG_DUMP_DOT_DIR must be set for this option to work.")
-parser.add_option("--track-psd", action = "store_true", help = "Track the H1 and H2 psds.  The filters that create the coherent stream will be updated throughout the run.")
-parser.add_option("--reference-psd", metavar = "filename", help = ".xml file containing the H1 and H2 psds. Use this psd as first guess psd or fixed psd.")
-parser.add_option("--write-psd", metavar = "filename", help = "Measure psds and write to .xml file.  Use these psds as a first guess psd or fixed psd.")
-parser.add_option("--null-output", metavar="filename", help = "Set the output filename for the null vetoes (default = write to stdout).  If the filename ends with \".gz\" it will be gzip-compressed.")
-parser.add_option("--vetoes-name", metavar = "name", default = "vetoes_from_LHO_null", help = "Set the name of the vetoes segment lists in the output document (default = \"vetoes_from_LHO_null\").")
-parser.add_option("--write-null-frames", action="store_true", help = "Write the null stream to frame files as well as out put a null veto segment list (optional).")
-parser.add_option("--sample-rate", metavar = "Hz", default = 4096, type = "int", help = "Sample rate at which to generate the data, should be less than or equal to the sample rate of the measured psds provided, default = 4096 Hz")
-parser.add_option("--verbose", action="store_true", help = "Be verbose.")
-
-
-options, filenames = parser.parse_args()
-
-if options.reference_psd is None and options.write_psd is None and options.track_psd is None:
-	raise ValueError("must use --track-psd if --reference-psd or --write-psd are not given; you can use both simultaneously")
-
-if len([option for option in ("reference_psd", "write_psd") if getattr(options, option) is not None]) != 1 and len([option for option in ("reference_psd", "write_psd") if getattr(options, option) is not None]) != 0:
-	raise ValueError("must provide only one of --reference-psd or --write-psd")
-
-gw_data_source_info = datasource.GWDataSourceInfo(options)
-
-options.psd_fft_length = 8
-options.zero_pad_length = 2
-quality = 9
-
-#
-# =============================================================================
-#
-#                                   Handler Class
-#
-# =============================================================================
-#
-
-class COHhandler(simplehandler.Handler):
-	
-	def __init__(self, mainloop, pipeline):
-
-		# set various properties for psd and fir filter		
-		self.psd_fft_length = options.psd_fft_length
-		self.zero_pad_length = options.zero_pad_length		
-		self.srate = options.sample_rate
-		self.filter_length = int(self.srate*self.psd_fft_length)
-
-		# set default psds for H1 and H2
-		self.psd1 = self.build_default_psd(self.srate, self.filter_length)
-		self.psd2 = self.build_default_psd(self.srate, self.filter_length)
-
-		# set default impulse response and latency for H1 and H2
-		self.H1_impulse, self.H1_latency, self.H2_impulse, self.H2_latency, self.srate = coherent_null.psd_to_impulse_response(self.psd1, self.psd2)
-		self.H1_impulse = numpy.zeros(len(self.H1_impulse))
-		self.H2_impulse = numpy.zeros(len(self.H2_impulse))
-		
-		# psd1_change and psd2_change store when the psds have been updated
-		self.psd1_change = 0
-		self.psd2_change = 0
-
-		# coherent null bin default
-		self.cohnullbin = None
-
-		self.segment_start = None
-		self.segment_stop = None
-
-		# regular handler pipeline and message processing
-		self.mainloop = mainloop
-		self.pipeline = pipeline
-		bus = pipeline.get_bus()
-		bus.add_signal_watch()
-		bus.connect("message", self.on_message)
-		
-		# veto segment list
-		self.vetoes = segments.segmentlist()
-
-	def on_message(self, bus, message):
-		if message.type == gst.MESSAGE_EOS:
-			self.segment_EOS()
-			self.pipeline.set_state(gst.STATE_NULL)
-			self.mainloop.quit()
-		elif message.type == gst.MESSAGE_INFO:
-			gerr, dbgmsg = message.parse_info()
-			print >>sys.stderr, "info (%s:%d '%s'): %s" % (gerr.domain, gerr.code, gerr.message, dbgmsg)
-		elif message.type == gst.MESSAGE_WARNING:
-			gerr, dbgmsg = message.parse_warning()
-			print >>sys.stderr, "warning (%s:%d '%s'): %s" % (gerr.domain, gerr.code, gerr.message, dbgmsg)
-		elif message.type == gst.MESSAGE_ERROR:
-			gerr, dbgmsg = message.parse_error()
-			self.pipeline.set_state(gst.STATE_NULL)
-			self.mainloop.quit()
-			sys.exit("error (%s:%d '%s'): %s" % (gerr.domain, gerr.code, gerr.message, dbgmsg))
-
-	def build_default_psd(self, srate, filter_length):
-		psd = lal.CreateREAL8FrequencySeries(
-			f0 = 0.0,
-			deltaF = float(srate)/filter_length,
-			length = filter_length/2 + 1
-		)
-		psd.data.data = numpy.ones(filter_length/2 + 1)
-		return psd
-
-	def add_cohnull_bin(self, elem):
-		self.cohnullbin = elem
-	
-	def update_fir_filter(self):
-		self.psd1_change = 0
-		self.psd2_change = 0
-		self.H1_impulse, self.H1_latency, self.H2_impulse, self.H2_latency, self.srate = coherent_null.psd_to_impulse_response(self.psd1, self.psd2)
-		self.cohnullbin.set_property("block-stride", self.srate)
-		self.cohnullbin.set_property("H1-impulse", self.H1_impulse)
-		self.cohnullbin.set_property("H2-impulse", self.H2_impulse)
-		self.cohnullbin.set_property("H1-latency", self.H1_latency)
-		self.cohnullbin.set_property("H2-latency", self.H2_latency)		
-		
-	def update_psd1(self, elem):
-		data = numpy.array(elem.get_property("mean-psd"))
-		self.psd1 = lal.CreateREAL8FrequencySeries(
-			name = "PSD1",
-			f0 = 0.0,
-			deltaF = elem.get_property("delta-f"),
-			length = len(data)
-		)
-		self.psd1.data.data = data
-		self.psd1_change = 1
-
-	def update_psd2(self, elem):
-		data = numpy.array(elem.get_property("mean-psd"))
-		self.psd2 = lal.CreateREAL8FrequencySeries(
-			name = "PSD2",
-			f0 = 0.0,
-			deltaF = elem.get_property("delta-f"),
-			length = len(data)
-		)
-		self.psd2.data.data = data
-		self.psd2_change = 1
-	
-	def fixed_filters(self, psd1, psd2):
-		self.psd1 = lal.CreateREAL8FrequencySeries(
-			name = "PSD1",
-			f0 = 0.0,
-			deltaF = psd1.deltaF,
-			length = len(psd1.data.data))
-		self.psd1.data.data = psd1.data.data
-		self.psd2 = lal.CreateREAL8FrequencySeries(
-			name = "PSD2",
-			f0 = 0.0,
-			deltaF = psd2.deltaF,
-			length = len(psd2.data.data))
-		self.psd2.data.data = psd2.data.data
-		self.H1_impulse, self.H1_latency, self.H2_impulse, self.H2_latency, self.srate = coherent_null.psd_to_impulse_response(self.psd1, self.psd2)
-
-	def segment_sighandler(self, elem, timestamp, segment_type):
-		if (segment_type == "on"):
-			self.segment_start = timestamp
-		elif (segment_type == "off"):
-			self.segment_stop = timestamp
-		else:
-			raise ValueError("unrecognized message from mkhtgate signal handler")
-		if (self.segment_start is not None and segment_type == "off"):
-			self.vetoes.append(segments.segment(lsctables.LIGOTimeGPS(0, self.segment_start), lsctables.LIGOTimeGPS(0, self.segment_stop)))
-
-	def segment_EOS(self):
-		if self.segment_start >= self.segment_stop or self.segment_stop is None:
-			self.segment_stop = numpy.float(options.gps_end_time) * 1e9
-			self.vetoes.append(segments.segment(lsctables.LIGOTimeGPS(0, self.segment_start), lsctables.LIGOTimeGPS(0, self.segment_stop)))
-
-		vetoes = self.vetoes
-		vetoes.coalesce()
-		vetoes = segments.segmentlistdict.fromkeys(("H1H2",), vetoes)
-
-		xmldoc = ligolw.Document()
-		xmldoc.childNodes.append(ligolw.LIGO_LW())
-		process = ligolw_process.register_to_xmldoc(xmldoc, "vetoes_from_LHO_null", options.__dict__)
-		llwsegments = ligolw_segments.LigolwSegments(xmldoc)
-		llwsegments.insert_from_segmentlistdict(vetoes, options.vetoes_name, comment = "Null vetoes")
-		llwsegments.finalize(process)
-		
-		utils.write_filename(xmldoc, options.null_output, gz = (options.null_output or "stdout").endswith(".gz"), verbose = options.verbose)
-
-
-#
-# =============================================================================
-#
-#                                             Main
-#
-# =============================================================================
-#
-
-if options.reference_psd is not None:
-	psd = lal.series.read_psd_xmldoc(ligolw_utils.load_filename(options.reference_psd, verbose = options.verbose, contenthandler = lal.series.PSDContentHandler))
-	psd1 = psd["H1"]
-	psd2 = psd["H2"]
-if options.write_psd is not None:
-	psd1 = reference_psd.measure_psd(gw_data_source_info, instrument = "H1", rate = options.sample_rate, psd_fft_length = options.psd_fft_length, verbose = options.verbose)
-	psd2 = reference_psd.measure_psd(gw_data_source_info, instrument = "H2", rate = options.sample_rate, psd_fft_length = options.psd_fft_length, verbose = options.verbose)
-	reference_psd.write_psd(options.write_psd, { "H1" : psd1, "H2" : psd2 }, verbose = options.verbose)
-
-#
-# Functions called by signal handler
-#	
-
-#FIXME: Probably only want to update psds (and filters) when they have changed "significantly enough"
-def update_psd(elem, pspec, hand):
-	name = elem.get_property("name")
-	if name == "H1_whitener":
-		hand.update_psd1(elem)
-	if name == "H2_whitener":
-		hand.update_psd2(elem)
-	if (hand.psd1_change == 1 and hand.psd2_change == 1):
-		hand.update_fir_filter()
-
-#
-# begin pipline
-#
-
-pipeline = gst.Pipeline("coh_null_h1h2")
-mainloop = gobject.MainLoop()
-handler = COHhandler(mainloop, pipeline)
-
-if options.reference_psd is not None or options.write_psd is not None:
-	handler.fixed_filters(psd1, psd2)
-
-#
-# H1 branch
-#
-
-H1head, _, _ = datasource.mkbasicsrc(pipeline, gw_data_source_info, "H1", verbose = options.verbose)
-
-H1head = pipeparts.mkreblock(pipeline, H1head)
-H1head = pipeparts.mkcapsfilter(pipeline, H1head, "audio/x-raw-float, width=64, rate=[%d,MAX]" % handler.srate)
-H1head = pipeparts.mkresample(pipeline, H1head, quality = quality)
-H1head = pipeparts.mkcapsfilter(pipeline, H1head, "audio/x-raw-float, width=64, rate=%d" % handler.srate)
-
-# track psd
-if options.track_psd is not None:
-	H1psdtee = pipeparts.mktee(pipeline, H1head)
-	H1psd = pipeparts.mkwhiten(pipeline, H1psd, zero_pad = handler.zero_pad_length, fft_length = handler.psd_fft_length, name = "H1_whitener") 
-	H1psd.connect_after("notify::mean-psd", update_psd, handler)
-	pipeparts.mkfakesink(pipeline, H1psd)
-
-	H1head = H1psdtee
-
-#
-# H2 branch
-#
-
-H2head, _, _ = datasource.mkbasicsrc(pipeline, gw_data_source_info, "H2", verbose = options.verbose)
-
-H2head = pipeparts.mkreblock(pipeline, H2head)
-H2head = pipeparts.mkcapsfilter(pipeline, H2head, "audio/x-raw-float, rate=[%d,MAX]" % handler.srate)
-H2head = pipeparts.mkresample(pipeline, H2head, quality = quality)
-H2head = pipeparts.mkcapsfilter(pipeline, H2head, "audio/x-raw-float, rate=%d" % handler.srate)
-
-# track psd
-if options.track_psd is not None:
-	H2psdtee = pipeparts.mktee(pipeline, H2head)
-	H2psd = pipeparts.mkwhiten(pipeline, H2psd, zero_pad = handler.zero_pad_length, fft_length = handler.psd_fft_length, name = "H2_whitener")
-	H2psd.connect_after("notify::mean-psd", update_psd, handler)
-	H2psd = pipeparts.mkfakesink(pipeline, H2psd)
-	
-	H2head = H2psdtee
-
-#
-# Create coherent and null streams
-#
-
-coherent_null_bin = pipeparts.mklhocoherentnull(pipeline, H1head, H2head, handler.H1_impulse, handler.H1_latency, handler.H2_impulse, handler.H2_latency, handler.srate)
-if options.track_psd is not None:
-	handler.add_cohnull_bin(coherent_null_bin)
-cohhead = coherent_null_bin.get_pad("COHsrc")
-nullhead = coherent_null_bin.get_pad("NULLsrc")
-
-#
-# Create coherent and null frames
-#
-
-cohhead = pipeparts.mkprogressreport(pipeline, cohhead, "progress_coherent")
-cohhead = pipeparts.mktaginject(pipeline, cohhead, "instrument=H1H2, channel-name=LSC-STRAIN_HPLUS")
-pipeparts.mkframecppfilesink(pipeline, pipeparts.mkframecppchannelmux(pipeline, {"H1H2:LSC-STRAIN_HPLUS" : cohhead}, frame_duration = 1, frames_per_file = 4096), frame_type = "H1H2")
-
-# null veto
-nullhead = pipeparts.mkprogressreport(pipeline, nullhead, "progress_null")
-nullhead = pipeparts.mkwhiten(pipeline, nullhead, zero_pad = handler.zero_pad_length, fft_length = handler.psd_fft_length)
-
-if options.write_null_frames is not None:
-	nullhead = pipeparts.mktee(pipeline, nullhead)
-	nullframehead = pipeparts.mktaginject(pipeline, pipeparts.mkqueue(pipeline, nullhead), "instrument=H1H2, channel-name=LSC-STRAIN_HNULL")
-	pipeparts.mkframecppfilesink(pipeline, pipeparts.mkframecppchannelmux(pipeline, {"H1H2:LSC-STRAIN_HNULL" : nullframehead}, frame_duration = 1, frames_per_file = 4096), frame_type = "H1H2_NULL")
-
-nullhead = datasource.mkhtgate(pipeline, nullhead, threshold = 8.0)
-nullhead.set_property("emit-signals", True)
-nullhead.connect("start", handler.segment_sighandler, "off") # start means the start of non-gap output
-nullhead.connect("stop", handler.segment_sighandler, "on") # stop means the end of non-gap output
-pipeparts.mkfakesink(pipeline, nullhead)
-
-#
-# Running the pipeline messages and pipeline graph
-#
-
-if options.write_pipeline is not None:
-	pipeparts.write_dump_dot(pipeline, "%s.%s" % (options.write_pipeline, "NULL"), verbose = options.verbose)
-
-if options.verbose:
-	print >>sys.stderr, "setting pipeline state to playing ..."
-if pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_FAILURE:
-	raise RuntimeError("pipeline failed to enter PLAYING state")
-
-if options.write_pipeline is not None:
-	pipeparts.write_dump_dot(pipeline, "%s.%s" % (options.write_pipeline, "PLAYING"), verbose = options.verbose)
-
-if options.verbose:
-	print >>sys.stderr, "running pipeline ..."
-
-mainloop.run()
diff --git a/gstlal-ugly/bin/gstlal_injections_by_local_rate b/gstlal-ugly/bin/gstlal_injections_by_local_rate
deleted file mode 100755
index 390615bd161fdf27017ad6c6cd4c51e3c44fb492..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_injections_by_local_rate
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2011 Chad Hanna
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-from optparse import OptionParser, Option
-from scipy import random
-import numpy
-from glue.ligolw import lsctables
-from glue.ligolw import utils
-from glue.ligolw import ligolw
-from glue.ligolw.utils import process
-from gstlal import reference_psd
-import lal
-import sys
-
-def uniform_dec(num):
-	return (numpy.pi / 2.) - numpy.arccos(2 * random.random_sample(num) - 1)
-
-def uniform_theta(num):
-	return numpy.arccos(2 * random.random_sample(num) - 1)
-
-def uniform_phi(num):
-	return random.random_sample(num) * 2 * numpy.pi
-
-def uniform_interval(interval, num):
-	# http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.random_sample.html#numpy.random.random_sample
-	return (interval[1] - interval[0]) * random.random_sample(num) + interval[0]
-
-class spin(object):
-	def __init__(self, r, theta, phi):
-		self.x = r * numpy.cos(phi) * numpy.sin(theta)
-		self.y = r * numpy.sin(phi) * numpy.sin(theta)
-		self.z = r * numpy.cos(theta)
-
-
-class source(object):
-	def __init__(self, waveform, m1range, m2range, s1range, s2range, rate, distance, tstart, tstop):
-		self.waveform = waveform
-		self.m1range = m1range
-		self.m2range = m2range
-		self.s1range = s1range
-		self.s2range = s2range
-		self.rate = rate
-		self.distance = distance
-		self.tstart = tstart
-		self.tstop = tstop
-		self.Myrs = (tstop - tstart) / 365.25 / 86400 / 1.e6 # Julian years
-		maxdist = self.distance
-		volume = 4./3. * numpy.pi * maxdist**3
-		rate = self.rate
-		expnum = numpy.ceil(volume * self.Myrs * self.rate)
-		#redo the max distance based on an integer number of injections
-		maxdist = (expnum / self.Myrs / self.rate  / (4./3. * numpy.pi))**(1./3.)
-		self.distance = maxdist
-		self.expnum = expnum
-
-	def uniform_sky(self):
-		expnum = self.expnum
-		ra = uniform_phi(expnum)
-		dec = uniform_dec(expnum)
-		pol = uniform_phi(expnum)
-		inc = uniform_theta(expnum)
-		phase = uniform_phi(expnum)
-		return ra, dec, pol, inc, phase
-
-	def uniform_time(self):
-		return random.randint(self.tstart, self.tstop, self.expnum) + random.rand(self.expnum)
-	
-	def uniform_masses(self):
-		mass1 = uniform_interval(self.m1range, self.expnum)
-		mass2 = uniform_interval(self.m2range, self.expnum)
-		return mass1, mass2
-	
-	def volume_distributed_distances(self):
-		return random.power(3, self.expnum) * self.distance # 3 because it is this number minus 1 according to scipy doc
-
-	def uniform_spins(self):
-		# FIXME uniform in r not in the sphere, what is desired?
-		r1 = uniform_interval(self.s1range, self.expnum)
-		# FIXME, lal actually expects standard spherical coordinates in radians?
-		theta1 = uniform_theta(self.expnum)
-		phi1 = uniform_phi(self.expnum)
-		r2 = uniform_interval(self.s2range, self.expnum)
-		theta2 = uniform_theta(self.expnum)
-		phi2 = uniform_phi(self.expnum)
-		return spin(r1, theta1, phi1), spin(r2, theta2, phi2)
-
-	def aligned_spins(self):
-		# FIXME uniform in r not in the sphere, what is desired?
-		r1 = uniform_interval(self.s1range, self.expnum)
-		# FIXME, lal actually expects standard spherical coordinates in radians?
-		r2 = uniform_interval(self.s2range, self.expnum)
-		return spin(r1, 0, 0), spin(r2, 0, 0)
-
-
-parser = OptionParser(description = __doc__)
-parser.add_option("--gps-start-time", metavar = "seconds", type = "int", help = "Set the start time of the segment to analyze in GPS seconds (required).  Can be specified to nanosecond precision.")
-parser.add_option("--gps-end-time", metavar = "seconds", type = "int", help = "Set the end time of the segment to analyze in GPS seconds (required).  Can be specified to nanosecond precision.")
-parser.add_option("--bns-waveform", metavar = "str", default = "SpinTaylorT4threePointFivePN", help = "Set the name of the bns waveform, default = TaylorT4threePointFivePN")
-parser.add_option("--nsbh-waveform", metavar = "str", default = "SpinTaylorT4threePointFivePN", help = "Set the name of the nsbh waveform, default = SpinTaylorT4threePointFivePN")
-parser.add_option("--bbh-waveform", metavar = "str", default = "EOBNRv2HMpseudoFourPN", help = "Set the name of the bbh waveform, default = EOBNRv2HMpseudoFourPN")
-parser.add_option("--bns-local-rate", metavar = "mergers / Mpc^3 / Myr", default = 1.0, type = "float", help = "set the local merger rate in mergers / Mpc^3 / Myr. Setting to 0.0 or less will disable the BNS distribution - default = 1.0")
-parser.add_option("--nsbh-local-rate", metavar = "mergers / Mpc^3 / Myr", default = .03, type = "float", help = "set the local merger rate in mergers / Mpc^3 / Myr. Setting to 0.0 or less will disable the NSBH distribution - default = 0.03")
-parser.add_option("--bbh-local-rate", metavar = "mergers / Mpc^3 / Myr", default = .005, type = "float", help = "set the local merger rate in mergers / Mpc^3 / Myr. Setting to 0.0 or less will disable the BBH distribution - default = 0.005")
-parser.add_option("--output", metavar = "filename", help = "Set the name of the LIGO light-weight XML file to output")
-parser.add_option("--bns-max-distance", metavar = "Mpc", type = "float", default = 1000., help = "set the bns maximum distance (respected approximately) default = 1000")
-parser.add_option("--nsbh-max-distance", metavar = "Mpc", type = "float", default = 5000., help = "set the nsbh maximum distance (respected approximately) default = 5000")
-parser.add_option("--bbh-max-distance", metavar = "Mpc", type = "float", default = 5000., help = "set the bbh maximum distance (respected approximately) default = 5000")
-parser.add_option("--ns-min-mass", metavar = "Msun", type = "float", default = 1.0, help = "set the minimum mass of the neutron star, default = 1.0")
-parser.add_option("--ns-max-mass", metavar = "Msun", type = "float", default = 2.0, help = "set the maximum mass of the neutron star, default = 2.0")
-parser.add_option("--ns-min-spin", metavar = "dimensionless", type = "float", default = 0., help = "set the min neutron star spin, default = 0")
-parser.add_option("--ns-max-spin", metavar = "dimensionless", type = "float", default = 0., help = "set the max neutron star spin, default = 0")
-parser.add_option("--bh-min-mass", metavar = "Msun", type = "float", default = 5.0, help = "set the minimum mass of the black hole, default = 5.0")
-parser.add_option("--bh-max-mass", metavar = "Msun", type = "float", default = 20.0, help = "set the maximum mass of the black hole, default = 20.0")
-parser.add_option("--bh-min-spin", metavar = "dimensionless", type = "float", default = 0., help = "set the min black hole spin, default = 0")
-parser.add_option("--bh-max-spin", metavar = "dimensionless", type = "float", default = 1., help = "set the max black hole spin, default = 1")
-parser.add_option("--aligned-spin", action="store_true", default = False, help = "Align the bh spin direction with the z-direction.")
-parser.add_option("--flower", metavar = "float", type = "float", help = "set the minumum frequency")
-parser.add_option("--seed", metavar = "int", type = "int", default = 1, help = "set the random seed default = 1")
-
-#
-# Parse options
-#
-
-options, filenames = parser.parse_args()
-
-#
-# Setup the output document
-#
-
-xmldoc = ligolw.Document()
-lw = xmldoc.appendChild(ligolw.LIGO_LW())
-sim = lsctables.New(lsctables.SimInspiralTable)
-lw.appendChild(sim)
-procrow = process.register_to_xmldoc(xmldoc, "gstlal_injections_by_local_rate", options.__dict__)
-
-# Setup some global parameters
-stop, start = options.gps_end_time, options.gps_start_time
-random.seed(options.seed)
-
-# set up the types of sources
-srcs = []
-if options.bns_local_rate > 0.0:
-	srcs.append(source(options.bns_waveform, (options.ns_min_mass, options.ns_max_mass), (options.ns_min_mass, options.ns_max_mass), (options.ns_min_spin, options.ns_max_spin), (options.ns_min_spin, options.ns_max_spin), options.bns_local_rate, options.bns_max_distance, start, stop))
-if options.nsbh_local_rate > 0.0:
-	srcs.append(source(options.nsbh_waveform, (options.ns_min_mass,options.ns_max_mass), (options.bh_min_mass, options.bh_max_mass), (options.ns_min_spin, options.ns_max_spin), (options.bh_min_spin, options.bh_max_spin), options.nsbh_local_rate, options.nsbh_max_distance, start, stop))
-if options.bbh_local_rate > 0.0:
-	srcs.append(source(options.bbh_waveform, (options.bh_min_mass,options.bh_max_mass), (options.bh_min_mass, options.bh_max_mass), (options.bh_min_spin, options.bh_max_spin), (options.bh_min_spin, options.bh_max_spin), options.bbh_local_rate, options.bbh_max_distance, start, stop))
-
-for src in srcs:
-
-	# injection parameters
-	time = src.uniform_time()
-	mass1, mass2 = src.uniform_masses()
-	dist = src.volume_distributed_distances()
-	if options.aligned_spin:
-		spin1, spin2 = src.aligned_spins()
-	else:
-		spin1, spin2 = src.uniform_spins()
-	ra, dec, pol, inc, phase = src.uniform_sky()
-
-	#FIXME only set the "needed" columns. Hopefully these are the needed ones
-	for i,t in enumerate(time):
-		row = sim.RowType()
-	
-		# string paramters
-		row.waveform = src.waveform
-		row.source = ""
-		row.numrel_data = ""
-		row.taper = "TAPER_START"
-
-		# time parameters
-		row.time_geocent = float(t)
-		# shouldn't be needed as injection code recomputes these
-		row.h_end_time = row.h_end_time_ns = row.l_end_time = row.l_end_time_ns = row.v_end_time = row.v_end_time_ns = row.g_end_time = row.g_end_time_ns = row.t_end_time = row.t_end_time_ns = 0
-
-		# masses
-		row.mass2 = mass2[i]
-		row.mass1 = mass1[i]
-		row.eta = row.mass1 * row.mass2 / (row.mass1 + row.mass2)**2
-		row.mchirp = (row.mass1 * row.mass2)**(3./5.) / (row.mass1 + row.mass2)**(1./5.)
-		row.psi0 = row.psi3 = 0.0
-	
-		# location / orientation
-		row.distance = dist[i]
-		row.longitude = ra[i]
-		row.latitude = dec[i]
-		row.coa_phase = phase[i]
-		row.inclination = inc[i]
-		row.polarization = pol[i]
-		# set effective distances
-		for det,s in (("H1","h"), ("L1","l"), ("V1","v"), ("G1","g"), ("T1","t")):
-			fp, fc = lal.ComputeDetAMResponse(
-				lal.cached_detector_by_prefix[det].response,
-				row.longitude,	# ra
-				row.latitude,	# dec
-				row.polarization,
-				lal.GreenwichMeanSiderealTime(row.time_geocent)
-			)
-			setattr(row, "eff_dist_%s" % s, row.distance / reference_psd.effective_distance_factor(row.inclination, fp, fc))
-
-		# spins
-		row.spin1 = spin1.x[i], spin1.y[i], spin1.z[i]
-		row.spin2 = spin2.x[i], spin2.y[i], spin2.z[i]
-
-		# frequencies
-		row.f_lower = options.flower
-		row.f_final = 0
-
-		# misc
-		row.amp_order = -1
-		row.alpha = row.alpha1 = row.alpha2 = row.alpha3 = row.alpha4 = row.alpha5 = row.alpha6 = row.beta = row.theta0 = row.phi0 = row.numrel_mode_min = row.numrel_mode_max = row.bandpass = 0
-		row.simulation_id = sim.get_next_id()
-		row.process_id = procrow.process_id	
-		sim.append(row)
-
-utils.write_filename(xmldoc, options.output)
diff --git a/gstlal-ugly/bin/gstlal_injections_by_local_rate_plot b/gstlal-ugly/bin/gstlal_injections_by_local_rate_plot
deleted file mode 100755
index 162b63b7cbf4b41436f18970d5b432fddd8ec990..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_injections_by_local_rate_plot
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2011  Chad Hanna
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-from glue.ligolw import lsctables
-from glue.ligolw import utils
-from glue.ligolw import ligolw
-import sys
-import matplotlib
-matplotlib.use('Agg')
-import pylab
-import numpy
-
-xmldoc = utils.load_filename(sys.argv[1], verbose = True)
-sim_inspiral_table=lsctables.table.get_table(xmldoc, lsctables.SimInspiralTable.tableName)
-proc_params = lsctables.table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName)
-start = int([proc.value for proc in proc_params if proc.param == "--gps-start-time"][0])
-stop = int([proc.value for proc in proc_params if proc.param == "--gps-end-time"][0])
-waveforms = set()
-[waveforms.add(sim.waveform) for sim in sim_inspiral_table]
-
-#
-# Masses
-#
-
-pylab.figure(1)
-for waveform in waveforms:
-	mass1 = [sim.mass1 for sim in sim_inspiral_table if sim.waveform == waveform]
-	mass2 = [sim.mass2 for sim in sim_inspiral_table if sim.waveform == waveform]
-	pylab.plot(mass1, mass2, '.', label = waveform)
-
-pylab.legend()
-pylab.xlabel('mass1')
-pylab.ylabel('mass2')
-pylab.grid()
-pylab.savefig("mass.png")
-
-#
-# sky position
-#
-
-ra = [sim.longitude for sim in sim_inspiral_table]
-dec = [sim.latitude for sim in sim_inspiral_table]
-
-pylab.figure(2)
-pylab.plot(ra, numpy.cos(dec), '.k')
-pylab.xlabel('ra')
-pylab.ylabel('cos(dec)')
-pylab.grid()
-pylab.xlim([0, 2 * numpy.pi])
-pylab.ylim([-1, 1])
-pylab.savefig("sky.png")
-
-#
-# inc and pol
-#
-
-inc = [sim.inclination for sim in sim_inspiral_table]
-pol = [sim.polarization for sim in sim_inspiral_table]
-
-pylab.figure(3)
-pylab.plot(pol, numpy.cos(inc), '.k')
-pylab.xlabel('pol')
-pylab.ylabel('cos(inc)')
-pylab.grid()
-pylab.xlim([0, 2 * numpy.pi])
-pylab.ylim([-1, 1])
-pylab.savefig("pol_inc.png")
-
-#
-# distance (cumulative)
-#
-
-def rate_to_poly(rate):
-	return numpy.poly1d([4/3. * numpy.pi * rate, 0 , 0, 0])
-
-pylab.figure(4)
-for waveform in waveforms:
-	dist = numpy.array([0.] + sorted([sim.distance for sim in sim_inspiral_table if sim.waveform == waveform]))
-	num = numpy.arange(len(dist)) / float(stop - start) * 365.25 * 86400 #julian year
-	pylab.plot(dist, num, label=waveform)
-
-dist = numpy.array([0.] + sorted([sim.distance for sim in sim_inspiral_table]))
-
-# BNS
-bns_rate = [proc.value for proc in proc_params if proc.param == "--bns-local-rate"]
-if len(bns_rate) > 0:
-	bns_rate = start = float(bns_rate[0]) * 1e-6 # Myr
-	poly = rate_to_poly(bns_rate)
-	pylab.plot(dist, poly(dist), label="bns rate %.2e" % (bns_rate,) )
-
-# NSBH
-nsbh_rate = [proc.value for proc in proc_params if proc.param == "--nsbh-local-rate"]
-if len(nsbh_rate) > 0:
-	nsbh_rate = start = float(nsbh_rate[0]) * 1e-6 # Myr
-	poly = rate_to_poly(nsbh_rate)
-	pylab.plot(dist, poly(dist), label="nsbh rate %.2e" % (nsbh_rate,) )
-
-pylab.legend()
-pylab.grid()
-pylab.ylim([0, 1000])
-pylab.ylabel("mergers per year")
-pylab.savefig("dist.png")
diff --git a/gstlal-ugly/bin/gstlal_inspiral_plot_likelihoods b/gstlal-ugly/bin/gstlal_inspiral_plot_likelihoods
deleted file mode 100755
index 38db451a492d01910985bdfc8e45f355f1846561..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_inspiral_plot_likelihoods
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012  Kipp Cannon, Chad Hanna, Drew Keppel
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import sys, os
-from lal import rate
-os.environ["MPLCONFIGDIR"] = "/tmp"
-import matplotlib
-matplotlib.use('Agg')
-import pylab
-import numpy
-from scipy.stats import chi2
-from glue.ligolw import utils
-import copy
-import itertools
-from gstlal import far
-from glue.ligolw import ligolw
-from glue.ligolw import lsctables, param, array
-array.use_in(ligolw.LIGOLWContentHandler)
-param.use_in(ligolw.LIGOLWContentHandler)
-lsctables.use_in(ligolw.LIGOLWContentHandler)
-import StringIO,base64
-import cgi
-import cgitb
-cgitb.enable()
-form = cgi.FieldStorage()
-import time
-import lal
-
-def now():
-	return float(lal.UTCToGPS(time.gmtime()))
-
-def to_png_image():
-	f = StringIO.StringIO()
-	pylab.savefig(f, format="png")
-	print '<img src="data:image/png;base64,',base64.b64encode(f.getvalue()),'"></img>'
-	f.close()
-
-print >>sys.stdout, 'Cache-Control: no-cache, must-revalidate'
-print >>sys.stdout, 'Expires: Mon, 26 Jul 1997 05:00:00 GMT'
-print >>sys.stdout, 'Content-type: text/html\r\n'
-
-print """
-<html>
-<head>
-<meta http-equiv="Pragma" content="no-cache">
-<meta http-equiv="Expires" content="-1">
-<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
-  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
-  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
-  <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
-  <script type="text/javascript"> $(function() {
-    $("#accordion").accordion({
-    });
-
-  });</script>
-
-</head>
-<body>
-"""
-
-# title
-print """
-<font size=10>Likelihood</font><font size=6 color=#707070><b><right> GPS:%d Local Time: %s </right></b><br></font><hr><br>
-""" % (int(now()), time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.localtime()))
-
-print '<div id="accordion">'
-path = form.getlist("url")[0]
-
-likelihood_data = far.LocalRankingData.from_xml(utils.load_url(path, contenthandler = ligolw.LIGOLWContentHandler))
-
-print >> sys.stderr, "smooth" in form
-
-if "smooth" in form:
-	likelihood_data.smooth_distribution_stats()
-	counts = likelihood_data.distributions.background_pdf
-	inj = likelihood_data.distributions.injection_pdf
-else:
-	counts = likelihood_data.distributions.background_rates
-	inj = likelihood_data.distributions.injection_rates
-
-bgcol = (224/255.,224/255.,224/255.)
-
-likely = copy.deepcopy(inj)
-for i, ifo in enumerate(['H1','L1', 'V1']):
-	if form.getfirst(ifo):
-		snrm, chisqm = [float(v) for v in form.getfirst(ifo).split(",")]
-	else:
-		snrm, chisqm = None, None
-	print "<h1>%s SNR / CHISQ stats</h1>" % ifo
-	print "<div>"
-	likely[ifo+"_snr_chi"].array /= counts[ifo+"_snr_chi"].array
-	for name, obj in (("background", counts), ("injections", inj), ("likelihood", likely)):
-		fig = pylab.figure(figsize=(6,4), facecolor = 'g')
-		fig.patch.set_alpha(0.0)
-		#pylab.gray()
-		H1 = obj[ifo+"_snr_chi"].array
-		snr = obj[ifo+"_snr_chi"].bins[0].centres()[1:-1]
-		chi = obj[ifo+"_snr_chi"].bins[1].centres()[1:-1]
-		chi[0] = 0 # not inf
-		ax = pylab.subplot(111)
-		pylab.pcolormesh(snr, chi, numpy.log10(H1.T +1)[1:-1,1:-1])
-		if snrm is not None and chisqm is not None:
-			pylab.plot(snrm, chisqm / snrm / snrm, 'ko', mfc = 'None', ms = 14, mew=4)
-		if "Log" in str(obj[ifo+"_snr_chi"].bins[0]):
-			ax.set_xscale('log')
-		if "Log" in str(obj[ifo+"_snr_chi"].bins[1]):
-			ax.set_yscale('log')
-		pylab.colorbar()
-		pylab.xlabel('SNR')
-		pylab.ylabel('reduced chi^2 / SNR^2')
-		pylab.ylim([chi[1], chi[-1]])
-		pylab.xlim([snr[1],snr[-1]])
-		pylab.title('%s: %s log base 10 (number + 1)' % (ifo, name))
-		pylab.grid(color=(0.1,0.4,0.5), linewidth=2)
-		to_png_image()
-	print "</div>"
-
-print "</div>"
-print "</body>"
-print "</html>"		
diff --git a/gstlal-ugly/bin/gstlal_inspiral_plot_likelihoods_from_gracedb b/gstlal-ugly/bin/gstlal_inspiral_plot_likelihoods_from_gracedb
deleted file mode 100755
index 4cf7d6bfd30f7c66d1c3fce970ebc91ba72d2884..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_inspiral_plot_likelihoods_from_gracedb
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012  Kipp Cannon, Chad Hanna, Drew Keppel
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import sys, os
-from lal import rate
-os.environ["MPLCONFIGDIR"] = "/tmp"
-import matplotlib
-matplotlib.use('Agg')
-import pylab
-import numpy
-from scipy.stats import chi2
-from glue.ligolw import utils
-import copy
-import itertools
-from gstlal import far
-import StringIO,base64
-import cgi
-import cgitb
-cgitb.enable()
-form = cgi.FieldStorage()
-import time
-import lal
-
-from glue.ligolw import ligolw, table, lsctables, param, array
-array.use_in(ligolw.LIGOLWContentHandler)
-param.use_in(ligolw.LIGOLWContentHandler)
-lsctables.use_in(ligolw.LIGOLWContentHandler)
-
-from ligo.gracedb.rest import GraceDb
-import ast
-
-def now():
-	return float(lal.UTCToGPS(time.gmtime()))
-
-def to_png_image(out):
-	f = StringIO.StringIO()
-	pylab.savefig(f, format="png")
-	print >>out, '<img src="data:image/png;base64,',base64.b64encode(f.getvalue()),'"></img>'
-	f.close()
-
-def header(f):
-	print >> f, """
-<head>
-<meta http-equiv="Pragma" content="no-cache">
-<meta http-equiv="Expires" content="-1">
-<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
-<meta http-equiv="refresh" content="300">
-  <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" />
-  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
-  <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
-  <script type="text/javascript"> $(function() {
-    $("#accordion").accordion({
-    });
-
-  });</script>
-</head>
-<body>
-	"""
-
-	# title
-	print >> f, """
-<font size=10>Likelihood</font><font size=6 color=#707070><b><right> GPS:%d Local Time: %s </right></b><br></font><hr><br>
-	""" % (int(now()), time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.localtime()))
-
-	print >>f, '<div id="accordion">'
-
-if len(sys.argv) == 1:
-	xmldoc = utils.load_filename(filename = None, contenthandler = ligolw.LIGOLWContentHandler)
-	lv_table = table.get_table(xmldoc, "LVAlert:table")
-	for r in lv_table:
-        	if r.alert_type == "new":
-		        gid = r.uid
-else:
-	gid = sys.argv[1]
-
-fname = "%s_snrchi.html" % gid
-f = open(fname, "w")
-
-header(f)
-
-gracedb = GraceDb()
-fdict = ast.literal_eval(gracedb.files(gid).read().strip())
-xmldoc, checksum = utils.load_fileobj(gracedb.get(fdict['coinc.xml']), contenthandler = ligolw.LIGOLWContentHandler)
-sngl_inspiral_table = lsctables.table.get_table(xmldoc, lsctables.SnglInspiralTable.tableName)
-params = lsctables.table.get_table(xmldoc, lsctables.ProcessParamsTable.tableName)
-snr_chisq_dict = dict(((ifo,(None,None)) for ifo in ['H1','L1', 'V1']))
-for r in sngl_inspiral_table:
-	snr_chisq_dict[r.ifo] = (r.snr, r.chisq)
-for r in params:
-	if r.program == "gstlal_inspiral" and r.param == "--likelihood-file":
-		path = r.value
-
-likelihood_data = far.LocalRankingData.from_xml(utils.load_url(path, contenthandler = ligolw.LIGOLWContentHandler))
-
-print >> sys.stderr, "smooth" in form
-
-if "smooth" in form:
-	likelihood_data.smooth_distribution_stats()
-	counts = likelihood_data.distributions.background_pdf
-	inj = likelihood_data.distributions.injection_pdf
-else:
-	counts = likelihood_data.distributions.background_rates
-	inj = likelihood_data.distributions.injection_rates
-
-bgcol = (224/255.,224/255.,224/255.)
-
-likely = copy.deepcopy(inj)
-for i, ifo in enumerate(['H1','L1', 'V1']):
-	snrm, chisqm = snr_chisq_dict[ifo]
-	print >>f, "<h1>%s SNR / CHISQ stats</h1>" % ifo
-	print >>f, "<div>"
-	likely[ifo+"_snr_chi"].array /= counts[ifo+"_snr_chi"].array
-	for name, obj in (("background", counts), ("injections", inj), ("likelihood", likely)):
-		fig = pylab.figure(figsize=(6,4), facecolor = 'g')
-		fig.patch.set_alpha(0.0)
-		#pylab.gray()
-		H1 = obj[ifo+"_snr_chi"].array
-		snr = obj[ifo+"_snr_chi"].bins[0].centres()[1:-1]
-		chi = obj[ifo+"_snr_chi"].bins[1].centres()[1:-1]
-		chi[0] = 0 # not inf
-		ax = pylab.subplot(111)
-		pylab.pcolormesh(snr, chi, numpy.log10(H1.T +1)[1:-1,1:-1])
-		if snrm is not None and chisqm is not None:
-			pylab.plot(snrm, chisqm / snrm / snrm, 'ko', mfc = 'None', ms = 14, mew=4)
-		if "Log" in str(obj[ifo+"_snr_chi"].bins[0]):
-			ax.set_xscale('log')
-		if "Log" in str(obj[ifo+"_snr_chi"].bins[1]):
-			ax.set_yscale('log')
-		pylab.colorbar()
-		pylab.xlabel('SNR')
-		pylab.ylabel('reduced chi^2 / SNR^2')
-		pylab.ylim([chi[1], chi[-1]])
-		pylab.xlim([snr[1],snr[-1]])
-		pylab.title('%s: %s log base 10 (number + 1)' % (ifo, name))
-		pylab.grid(color=(0.1,0.4,0.5), linewidth=2)
-		to_png_image(f)
-	print >>f, "</div>"
-
-print >>f, "</div>"
-print >>f, "</body>"
-print >>f, "</html>"
-
-f.close()
-gracedb.writeLog(gid, "SNR/Chisq", filename = fname, filecontents = open(fname).read())
diff --git a/gstlal-ugly/bin/gstlal_inspiral_plot_log_state_at_gps_time b/gstlal-ugly/bin/gstlal_inspiral_plot_log_state_at_gps_time
deleted file mode 100755
index d97e21f5b973a3247cc10dc8bdb4da06028ac5bb..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_inspiral_plot_log_state_at_gps_time
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012  Chad Hanna
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import sys
-import os
-os.environ["MPLCONFIGDIR"] = "/tmp"
-import matplotlib
-matplotlib.use('Agg')
-import pylab
-import numpy
-import cgi
-import cgitb
-cgitb.enable()
-form = cgi.FieldStorage()
-import StringIO
-import base64
-import glob
-import bisect
-
-def to_png_image():
-        f = StringIO.StringIO()
-        pylab.savefig(f, format="png")
-        print '<img src="data:image/png;base64,',base64.b64encode(f.getvalue()),'"></img>'
-        f.close()
-
-
-def parse_log(logfiles):
-	time = {}
-	state = {}
-	for logfile in logfiles:
-		f = open(logfile)
-		# looking for lines like lal_gate2: L1: state transition: off @ 1023465196.000000000
-		for line in f:
-			for gate_line in line.split("lal_gate")[1:]:
-				lsplit = gate_line.split()
-				ifo = lsplit[1].replace(':','')
-				gps = float(lsplit[6])
-				try:
-					state[ifo].append(state[ifo][-1])
-					# update a virtual point right before this one with the previous state
-					# assumes time ordered log files
-					time[ifo].append(gps - 0.1)
-				except KeyError:
-					pass
-				time.setdefault(ifo, []).append(gps)
-				if lsplit[4] == "on":
-					state.setdefault(ifo, []).append(1)
-				else:
-					state.setdefault(ifo, []).append(0)
-				
-	return time, state
-
-path = form.getvalue("dir")
-eventtime = float(form.getvalue("gps"))
-mchirp = float(form.getvalue("mchirp"))
-data = []
-for fname in glob.glob(os.path.join(path, '*_bank.txt')):
-	try:
-		idstr = os.path.split(fname)[1][0:4]
-		f = open(fname)
-		duration, mc = f.readline().split()[1:]
-		data.append((float(mc), float(duration), idstr))
-		f.close()
-	except OSError:
-		pass
-
-data.sort()
-index = bisect.bisect_left([d[0] for d in data], mchirp) - 1 #because of how bisect works
-idstr = data[index][2]
-duration = data[index][1]
-
- 
-logfiles = glob.glob(os.path.join(path, 'logs/gstlal_inspiral-%s*.err' % (idstr,)))
-
-time, state = parse_log(logfiles)
-
-print >>sys.stdout, 'Cache-Control: no-cache, must-revalidate'
-print >>sys.stdout, 'Expires: Mon, 26 Jul 1997 05:00:00 GMT'
-print >>sys.stdout, 'Content-type: text/html\r\n'
-
-# HTML preamble
-print """
-<html>
-<head>
-<meta http-equiv="Pragma" content="no-cache">
-<meta http-equiv="Expires" content="-1">
-<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
-<meta http-equiv="refresh" content="300">
-</head>
-<body bgcolor=#E0E0E0 face="Arial">
-<br>
-"""
-
-
-
-
-for ifo in time:
-	pylab.figure(figsize=(12,2))
-	pylab.subplots_adjust(bottom = 0.1, top = 0.85)
-	pylab.fill_between(numpy.array(time[ifo]) - eventtime, state[ifo], alpha=0.5)#, ls = "steps-post")
-	pylab.xlim([-duration, 0])
-	pylab.title("%s state before event at %.0f with mchirp %.3f and duration %.0f (s)" % (ifo, eventtime, mchirp, duration))
-	pylab.yticks([])
-	to_png_image()
-
-print """
-</body>
-</html>
-"""
-		
diff --git a/gstlal-ugly/bin/gstlal_ll_inspiral_plot_segments_at_gps_time b/gstlal-ugly/bin/gstlal_ll_inspiral_plot_segments_at_gps_time
deleted file mode 100755
index 25509ed76bb4c4e9110aedd2f6caf634c60dbc11..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_ll_inspiral_plot_segments_at_gps_time
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012  Chad Hanna
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import sys
-import os
-os.environ["MPLCONFIGDIR"] = "/tmp"
-import matplotlib
-matplotlib.use('Agg')
-import pylab
-import numpy
-import cgi
-import cgitb
-cgitb.enable()
-form = cgi.FieldStorage()
-import StringIO
-import base64
-import glob
-import bisect
-from glue.lal import Cache
-from ligo import segments
-from glue.ligolw import utils
-from glue.ligolw.utils import segments as ligolw_segments
-from glue.ligolw import lsctables
-
-from lal import LIGOTimeGPS
-
-def to_png_image():
-        f = StringIO.StringIO()
-        pylab.savefig(f, format="png")
-        print '<img src="data:image/png;base64,',base64.b64encode(f.getvalue()),'"></img>'
-        f.close()
-
-def segment_table_to_state(segtable):
-	time = {}
-	state = {}
-	for ifo in segtable:
-		for seg in segtable[ifo]:
-			time.setdefault(ifo, []).append(float(seg[0]))
-			time.setdefault(ifo, []).append(float(seg[0]))
-			time.setdefault(ifo, []).append(float(seg[1]))
-			time.setdefault(ifo, []).append(float(seg[1]))
-			state.setdefault(ifo, []).append(0)
-			state.setdefault(ifo, []).append(1)
-			state.setdefault(ifo, []).append(1)
-			state.setdefault(ifo, []).append(0)
-				
-	return time, state
-
-def parse_segment_files_from_cache(segcache):
-	segdict = segments.segmentlistdict()
-	for c in segcache:
-		xmldoc = utils.load_url(c.url)
-		segdef = lsctables.table.get_table(xmldoc, lsctables.SegmentDefTable.tableName)
-		names = [r.name for r in segdef]
-		names = set(names)
-		for name in names:
-			yield name, segment_table_to_state(ligolw_segments.segmenttable_get_by_name(xmldoc, name).coalesce())
-
-def parse_segment_file(path, jobid, seg):
-	segment_cache = Cache.from_urls(glob.glob(os.path.join(path, '*_SEGMENTS-*.xml.gz')))
-	return segment_cache.sieve(description = jobid, segment = seg)
-
-
-def parse_id_and_duration(path, mchirp):
-	data = []
-	for fname in glob.glob(path + '/*_bank.txt'):
-		try:
-			idstr = os.path.split(fname)[1][0:4]
-			f = open(fname)
-			duration, mc = f.readline().split()[1:]
-			data.append((float(mc), float(duration), idstr))
-			f.close()
-		except OSError:
-			pass
-	data.sort()
-
-	# Identify the id for the requested chirp mass
-	index = bisect.bisect_left([d[0] for d in data], mchirp) - 1 #because of how bisect works
-	idstr = data[index][2]
-	duration = float(data[index][1])
-	return idstr, duration
-
-
-path = form.getvalue("dir")
-eventtime = float(form.getvalue("gps"))
-mchirp = float(form.getvalue("mchirp"))
-ifos = form.getlist("ifo")
-
-idstr, duration = parse_id_and_duration(path, mchirp)
-eventsegment = segments.segment((LIGOTimeGPS(eventtime-duration), LIGOTimeGPS(eventtime+duration)))
-
-segment_cache = parse_segment_file(path, idstr, eventsegment)
-
-times, states = parse_segment_files_from_cache(segment_cache)
-
-#logfiles = glob.glob(os.path.join(path, 'logs/gstlal_inspiral-%s*.err' % (idstr,)))
-
-#time, state = parse_log(logfiles)
-
-print >>sys.stdout, 'Cache-Control: no-cache, must-revalidate'
-print >>sys.stdout, 'Expires: Mon, 26 Jul 1997 05:00:00 GMT'
-print >>sys.stdout, 'Content-type: text/html\r\n'
-
-# HTML preamble
-print """
-<html>
-<head>
-<meta http-equiv="Pragma" content="no-cache">
-<meta http-equiv="Expires" content="-1">
-<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
-<meta http-equiv="refresh" content="300">
-</head>
-<body bgcolor=#E0E0E0 face="Arial">
-<br>
-"""
-
-for (name, (times, states)) in parse_segment_files_from_cache(segment_cache):
-	for ifo in times:
-		if ifos and ifo not in ifos:
-			continue
-		pylab.figure(figsize=(12,2))
-		pylab.subplots_adjust(bottom = 0.1, top = 0.85)
-		pylab.fill_between(numpy.array(times[ifo]) - eventtime, states[ifo], alpha=0.5)#, ls = "steps-post")
-		pylab.xlim([-duration, duration])
-		pylab.title("%s %s state before event at %.0f with mchirp %.3f and duration %.0f (s)" % (ifo, name, eventtime, mchirp, duration))
-		pylab.yticks([])
-		to_png_image()
-
-print """
-</body>
-</html>
-"""
-		
diff --git a/gstlal-ugly/bin/gstlal_ll_inspiral_regen_reg_from_condor_q b/gstlal-ugly/bin/gstlal_ll_inspiral_regen_reg_from_condor_q
deleted file mode 100755
index 81959c2c2c58ef5e9f6f4e9b04d1614b47e5fd6d..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_ll_inspiral_regen_reg_from_condor_q
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012  Chad Hanna
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import sys, os, urllib
-
-__doc__ = """
-USAGE: condor_q -long <user name> | gstlal_ll_inspiral_regen_reg_from_condor_q 0001 <job tag> > myregfile.txt
-EXAMPLE: condor_q -long channa | gstlal_ll_inspiral_regen_reg_from_condor_q 0001 > 0001_registry.txt
-
-it only print the registry for jobs running in the current working directory!
-"""
-
-jobs = {}
-lastnode = None
-jobs[lastnode] = {}
-
-jobids = sys.argv[1:]
-
-for l in sys.stdin:
-	try:
-		k, v = l.split("=")
-	except:
-		tmp = l.split("=")
-		k = tmp[0]
-		v = "=".join(tmp[1:])
-	k = k.strip()
-	v = v.strip()
-	if "DAGNodeName" in l:
-		jobs[v] = {}
-		lastnode = v
-	else:
-		jobs[lastnode][k] = v
-
-for k in jobs:
-	if os.path.realpath(jobs[k]['Iwd'].replace('"','')) != os.path.realpath(os.getcwd()):
-		continue
-	l = jobs[k]['Err'].split("-")
-	if "logs/gstlal_inspiral" in l[0]:
-		if l[1] in jobids:
-
-			try:
-				url = "http://%s:16953/registry.txt" % jobs[k]['RemoteHost'].replace('"','')
-				urllib.urlretrieve(url, '/dev/stdout')
-			except IOError as (errno, strerror):
-				print >> sys.stderr, "I/O error({0}): {1} on request {2}".format(errno, strerror, url)
diff --git a/gstlal-ugly/bin/gstlal_parse_frame_segment_logs b/gstlal-ugly/bin/gstlal_parse_frame_segment_logs
deleted file mode 100755
index 99450a93049fb4b99dc1bad803cbddf8b6a00072..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_parse_frame_segment_logs
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2013 Chad Hanna
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import sys
-import re
-import gzip
-from ligo import segments
-from glue.ligolw import ligolw
-from glue.ligolw import utils
-from glue.ligolw.utils import segments as ligolw_segments
-from glue.ligolw.utils import process as ligolw_process
-from lal import LIGOTimeGPS
-from optparse import OptionParser
-
-def parse_command_line():
-	parser = OptionParser(usage = "gstlal_parse_frame_segment_logs --function-name <func> < <infile> > <outfile>")
-	parser.add_option("--input", metavar = "name", default = "stdin", help = "Set the input log file name - Default is stdin")
-	parser.add_option("--output", metavar = "name", help = "Set the output xml ile name - Required")
-	parser.add_option("--function-name", metavar = "name", default = "datasegments", help = "Set the name of the function to look for in the logs, e.g. frvect_to_buffer_and_push - Required")
-	options, filenames = parser.parse_args()
-	return options, filenames
-
-opts, files = parse_command_line()
-
-# start a new output xml document
-xmldoc = ligolw.Document()
-xmldoc.appendChild(ligolw.LIGO_LW())
-process = ligolw_process.register_to_xmldoc(xmldoc, sys.argv[0], opts.__dict__)
-
-# regular expressions to look for
-# FIXME I don't know if these regular expressions will work for all elements, but it seems like a good guess.
-tagre = re.compile("<(.*)>")
-segre = re.compile(" \[(.*)s\)")
-
-# not a segmentlistdict object, yet
-segdict = {}
-
-# check for compression
-if opts.input != "stdin":
-	try:
-		f = gzip.open(opts.input).readline()
-		f = gzip.open(opts.input)
-	except IOError:
-		f = open(opts.input)
-else:
-	f = sys.stdin
-
-# parse the file
-for l in f:
-	if opts.function_name in l:
-		tag = tagre.search(l)
-		# e.g. framecppchanneldemux0:H1:PSL-ODC_CHANNEL_OUT_DQ
-		try:
-			element, ifo, channel = tag.group(1).split(':')
-		except ValueError:
-			# does not conform to element:ifo:channel, oh well.
-			continue
-		try:
-			s,e = segre.search(l).group(1).split('s,')
-		except AttributeError:
-			# the only known legitimate case where this shouldn't work
-			if "new caps" in l:
-				continue
-		seg = segments.segment(LIGOTimeGPS(float(s)), LIGOTimeGPS(float(e)))
-		segdict.setdefault((channel, element), segments.segmentlistdict()).setdefault(ifo, segments.segmentlist()).append(seg)
-
-# coalesce
-for v in segdict.values():
-	v.coalesce()
-
-# insert the segments
-lwseglists = ligolw_segments.LigolwSegments(xmldoc)
-for k, v in segdict.items():
-	lwseglists.insert_from_segmentlistdict(v, k[0], comment = k[1])
-
-# all finished
-lwseglists.optimize()
-ligolw_process.set_process_end_time(process)
-lwseglists.finalize(process)
-utils.write_filename(xmldoc, opts.output, gz = opts.output.endswith('.gz'))
diff --git a/gstlal-ugly/bin/gstlal_plot_channel_psd b/gstlal-ugly/bin/gstlal_plot_channel_psd
deleted file mode 100755
index 4ab7b640e2de9d2764bb3edc1d6720a791c7b87e..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_plot_channel_psd
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2012-2015  Chad Hanna
-# Copyright (C) 2015  Kipp Cannon
-# Copyright (C) 2017  Patrick Godwin
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-
-from optparse import OptionParser
-import os
-import sys
-import logging
-import math
-import numpy
-import matplotlib
-from matplotlib import figure
-from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
-
-from lal import series
-from glue.ligolw import utils as ligolw_utils
-from glue.ligolw import lsctables
-from gstlal import plotutil
-
-matplotlib.rcParams.update({
-	"font.size": 10.0,
-	"axes.titlesize": 10.0,
-	"axes.labelsize": 10.0,
-	"xtick.labelsize": 8.0,
-	"ytick.labelsize": 8.0,
-	"legend.fontsize": 8.0,
-	"figure.dpi": 300,
-	"savefig.dpi": 300,
-	"text.usetex": True,
-	"path.simplify": True
-})
-
-
-
-## @file
-# A program to plot reference psds; see gstlal_plot_channel_psd for more info
-#
-# A program to plot a psd such as one generated by gstlal_reference_psd
-#
-# ### Usage:
-#
-#		gstlal_plot_channel_psd -o OUTPUT-NAME PSD-FILE-1 PSD-FILE-2
-#
-# e.g.,
-#
-#		gstlal_plot_channel_psd -o psd.png psd.xml.gz
-#
-
-color_scheme = ['#332288', '#88CCEE', '#44AA99', '#117733', '#999933', '#DDCC77', '#CC6677', '#882255', '#AA4499']
-
-def parse_command_line():
-	parser = OptionParser()
-	parser.add_option("-o", "--output", help = "Set plot filename (default = replace input file's extension with .png).")
-	parser.add_option("-v", "--verbose", action = "store_true", help = "Be verbose.")
-	options, filenames = parser.parse_args()
-
-	if not filenames:
-		raise ValueError("must supply at least one input filename")
-	if options.output and len(filenames) > 1:
-		raise ValueError("must supply only one input file when setting --output")
-
-	return options, filenames
-
-def plot_psds(psds, plot_width = 640):
-	"""!
-	Produces a matplotlib figure of PSDs. 
-
-	@param psds A dictionary of PSDs as REAL8FrequencySeries keyed by
-	channel
-
-	@param plot_width How wide to make the plot in pixels
-	"""
-	on_channels = set(psds)
-	fig = figure.Figure()
-	FigureCanvas(fig)
-	fig.set_size_inches(plot_width / float(fig.get_dpi()), int(round(plot_width / plotutil.golden_ratio)) / float(fig.get_dpi()))
-	axes = fig.gca()
-	axes.grid(which = "both", linestyle = "-", linewidth = 0.2)
-
-	min_psds, max_psds = [], []
-	min_fs, max_fs = [], []
-	color_index = 0
-	for channel, psd in sorted(psds.items()):
-		if psd is None:
-			continue
-		psd_data = psd.data.data
-		f = psd.f0 + numpy.arange(len(psd_data)) * psd.deltaF
-		logging.info("found PSD for %s spanning [%g Hz, %g Hz]" % (channel, f[0], f[-1]))
-		min_fs.append(f[0])
-		max_fs.append(f[-1])
-		if channel in on_channels:
-			alpha = 0.8
-			linestyle = "-"
-		else:
-			alpha = 0.6
-			linestyle = ":"
-		label = r"%s" % channel.replace('_', '\_')
-		axes.loglog(f, psd_data, alpha = alpha, color = color_scheme[color_index], linestyle = linestyle, label = label)
-		# record the minimum from within the rage 10 Hz -- 1 kHz
-		min_psds.append(min([x for x in psd_data[int((10.0 - psd.f0) / psd.deltaF) : int((1000 - psd.f0) / psd.deltaF)] if x > 0]))
-		# record the maximum from within the rage 1 Hz -- 1 kHz
-		max_psds.append(psd_data[int((1.0 - psd.f0) / psd.deltaF) : int((1000 - psd.f0) / psd.deltaF)].max())
-		color_index += 1
-	if min_fs:
-		axes.set_xlim((6.0, max(max_fs)))
-	else:
-		axes.set_xlim((6.0, 3000.0))
-	if min_psds:
-		axes.set_ylim((10**math.floor(math.log10(min(min_psds))), 10**math.ceil(math.log10(max(max_psds)))))
-	title = r"Noise Spectral Density"
-	axes.set_title(title)
-	axes.set_xlabel(r"Frequency (Hz)")
-	axes.set_ylabel(r"Spectral Density ($\mathrm{1} / \mathrm{Hz}$)")
-	axes.legend(loc = "upper right")
-	fig.tight_layout(pad = .8)
-
-	return fig
-
-
-options, filenames = parse_command_line()
-for fname in filenames:
-	if options.output:
-		outname = options.output
-	else:
-		outname = os.path.splitext(fname)[0] + ".png"
-	
-	fig = plot_psds(
-		series.read_psd_xmldoc(
-			ligolw_utils.load_filename(
-				fname,
-				verbose = options.verbose,
-				contenthandler = series.PSDContentHandler
-			)
-		),
-		plot_width = 2400
-	)
-
-	fig.savefig(outname)
-
diff --git a/gstlal-ugly/bin/gstlal_prune_duplicate_mass_pairs b/gstlal-ugly/bin/gstlal_prune_duplicate_mass_pairs
deleted file mode 100755
index 8c701adadde089ff2e36baa47bafb64cd17aebfc..0000000000000000000000000000000000000000
--- a/gstlal-ugly/bin/gstlal_prune_duplicate_mass_pairs
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2014  Kipp Cannon
-# Copyright (C) 2010  Leo Singer
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-"""
-Prune duplicate templates from a template bank.  lalapps_tmpltbank often
-places the same template more than once.
-"""
-
-
-__prog__ = "gstlal_prune_duplicate_mass_pairs"
-
-from optparse import OptionParser
-from glue.ligolw import ligolw
-from glue.ligolw import lsctables
-from glue.ligolw import utils as ligolw_utils
-from glue.ligolw.utils import process as ligolw_process
-import sys
-
-class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
-	pass
-lsctables.use_in(LIGOLWContentHandler)
-
-
-def parse_command_line():
-	parser = OptionParser(
-		usage = "%prog [options] filename ...",
-		description = "Iterate over XML template bank files, removing duplicate templates from each.  Templates are taken to be the same if their masses and spins are the same.  If --orderless is given then the order of the components in each template is irrelevant, otherwise for two templates to be considered the same the masses and spins of the 1st components must match each other, and those of the 2nd components must match each other."
-	)
-	parser.add_option("-v", "--verbose", action = "store_true", help = "Be verbose.")
-	parser.add_option("-r", "--orderless", action = "store_true", help = "Order of component bodies doesn't matter.")
-	return parser.parse_args()
-
-options, filenames = parse_command_line()
-
-
-class SnglInspiral(lsctables.SnglInspiral):
-	if options.orderless:
-		def hash_components(self):
-			return frozenset(((self.mass1, self.spin1x, self.spin1y, self.spin1z), (self.mass2, self.spin2x, self.spin2y, self.spin2z)))
-	else:
-		def hash_components(self):
-			return (self.mass1, self.spin1x, self.spin1y, self.spin1z), (self.mass2, self.spin2x, self.spin2y, self.spin2z)
-
-	def __hash__(self):
-		return hash(self.hash_components())
-	def __cmp__(self, other):
-		return cmp(self.hash_components(), other.hash_components())
-
-lsctables.SnglInspiralTable.RowType = SnglInspiral
-
-
-for n, filename in enumerate(filenames, start=1):
-	if options.verbose:
-		print >>sys.stderr, "%d/%d:" % (n, len(filenames)),
-
-	xmldoc = ligolw_utils.load_filename(filename, contenthandler=LIGOLWContentHandler, verbose=options.verbose)
-	process = ligolw_process.register_to_xmldoc(xmldoc, __prog__, options.__dict__, cvs_repository=u"gstlal")
-	sngl_inspiral_table = lsctables.SnglInspiralTable.get_table(xmldoc)
-
-	n_before = len(sngl_inspiral_table)
-	sngl_inspiral_table[:] = set(sngl_inspiral_table)
-	if options.verbose:
-		print >>sys.stderr, "removed %d duplicate template(s), %d remaining" % (n_before - len(sngl_inspiral_table), len(sngl_inspiral_table))
-
-	ligolw_process.set_process_end_time(process)
-	ligolw_utils.write_filename(xmldoc, filename, gz=filename.endswith(".gz"), verbose=options.verbose)