3 # Copyright (C) 2012 Chad Hanna
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2 of the License, or (at your
8 # option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 # Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # A program to plot the contents of a gstlal_svd_bank file by reconstructing the waveforms
31 from gstlal.svd_bank
import read_banks
36 form = cgi.FieldStorage()
40 from matplotlib
import pyplot
42 from glue.ligolw
import lsctables
44 print >>sys.stdout,
'Expires: Mon, 26 Jul 1997 05:00:00 GMT'
45 print >>sys.stdout,
'Content-type: text/html\r\n'
50 <meta http-equiv="Pragma
" content="no-cache
">
51 <meta http-equiv="Expires
" content="-1
">
52 <meta http-equiv="CACHE-CONTROL
" content="NO-CACHE
">
54 <body bgcolor=#E0E0E0>
59 <font size=10>SVD BANK</font><br>
63 for bank in read_banks(form.getlist(
"url")[0]):
65 #
get the
template number
66 tmps = bank.bank_fragments[0].mix_matrix.shape[1] / 2
67 row = bank.sngl_inspiral_table
70 mc, s1z, s2z = row[n].mchirp, row[n].spin1z, row[n].spin2z
72 pyplot.figure(figsize=(18,6))
77 for frag in bank.bank_fragments:
79 s = frag.singular_values
80 u = frag.orthogonal_template_bank
82 t = numpy.linspace(-frag.end, -frag.start, h.shape[1])
83 pyplot.plot(t, h[2 * n,:] * frag.rate**.5)
84 pyplot.plot(t, h[2 * n + 1,:] * frag.rate**.5)
85 maxrate = max(maxrate, frag.rate)
86 mint = min(t[0], mint)
87 pyplot.xlabel('time (s) mc:%.2f s1z:%.2f s2z:%.2f' % (mc, s1z, s2z))
88 pyplot.xlim([-.25, 0])
91 pyplot.xlabel('samples')
92 l = len(bank.autocorrelation_bank[n,:])
93 ts = l /
float(maxrate)
94 t = numpy.linspace(-ts, 0, l)
95 pyplot.plot(numpy.real(bank.autocorrelation_bank[n,:]))
96 pyplot.plot(numpy.imag(bank.autocorrelation_bank[n,:]))
97 pyplot.savefig(sys.stdout, format="svg")
101 print "</body></html>"