Skip to content
Snippets Groups Projects
Commit 47661bdc authored by Jonah Kanner's avatar Jonah Kanner :nerd:
Browse files

Improvements to plot_pec.py

git-svn-id: https://svn.ligo.caltech.edu/svn/bayeswave/trunk@123 c56465c9-8126-4a4f-9d7d-ac845eff4865
parent bcf29c7d
No related branches found
No related tags found
No related merge requests found
......@@ -228,6 +228,66 @@ for ifo in ifoList:
plt.xlabel('Overlap - recovered signal and injection')
plt.savefig('overlap_{0}.png'.format(ifo))
plt.close()
# -- Read moments file
moments = np.recfromtxt('moments.dat.{0}'.format(ifo), names=True)
# -- Histogram of signal energy
plt.figure()
rn,rbins,patches = plt.hist(np.log10(moments['energy_rec']), bins=100, label='Recovered', alpha=0.5)
n,bins,patches = plt.hist(np.log10(moments['energy_inj']), bins=100, label='Injected', alpha=0.5, color='yellow')
plt.xlabel("log10 (Signal Energy)")
plt.title('IFO {0}'.format(ifo))
plt.ylim(0, rn.max())
bindx = np.append(rn > 1, False)
# plt.xlim(rbins[bindx].min(), rbins[bindx].max())
plt.legend()
plt.savefig('energy_{0}.png'.format(ifo))
plt.close()
# -- Histogram central time
plt.figure()
rn,bins,patches = plt.hist(moments['time_rec'] - 2, bins=100, label='Recovered', alpha=0.5)
n,bins,patches = plt.hist(moments['time_inj'] - 2, bins=100, label='Injected', alpha=0.5, color='yellow')
plt.xlabel("Central Time")
plt.title('IFO {0}'.format(ifo))
plt.ylim(0, rn.max())
plt.legend()
plt.savefig('tzero_{0}.png'.format(ifo))
plt.close()
# -- Histogram of duration
plt.figure()
rn,bins,patches = plt.hist(np.log10(moments['duration_rec']), bins=100, label='Recovered', alpha=0.5)
n,bins,patches = plt.hist(np.log10(moments['duration_inj']), bins=100, label='Injected', alpha=0.5, color='yellow')
plt.xlabel("log10(Duration)")
plt.title('IFO {0}'.format(ifo))
plt.ylim(0, rn.max())
plt.legend()
plt.savefig('duration_{0}.png'.format(ifo))
plt.close()
# -- Histogram of central frequency
plt.figure()
rn,bins,patches = plt.hist(moments['f_rec'], bins=100, label='Recovered', alpha=0.5, linewidth=0)
n,bins,patches = plt.hist(moments['f_inj'], bins=100, label='Injected', alpha=0.5, color='yellow')
plt.xlabel("Central Freq (Hz)")
plt.title('IFO {0}'.format(ifo))
plt.ylim(0, rn.max())
plt.legend()
plt.savefig('freq_{0}.png'.format(ifo))
plt.close()
# -- Histogram of bandwidth
plt.figure()
rn,bins,patches = plt.hist(moments['ban_rec'], bins=100, label='Recovered', alpha=0.5, linewidth=0)
n,bins,patches = plt.hist(moments['band_inj'], bins=100, label='Injected', alpha=0.5, color='yellow')
plt.xlabel("Bandwidth (Hz)")
plt.title('IFO {0}'.format(ifo))
plt.ylim(0, rn.max())
plt.legend()
plt.savefig('band_{0}.png'.format(ifo))
plt.close()
# --------------------------
# For debugging, plot signal energy
......@@ -460,10 +520,36 @@ web.write("Reconstructed waveforms in whitened data. Red is injected waveform,
for ifo in ifoList:
web.write("<img src='./waveform_{0}.png' alt='waveform_{0}.png' width=500>".format(ifo))
# -- Add histogram of overlaps
web.write("<h3> Overlap Histogram between whitened recovered signal and injection</h3>")
for ifo in ifoList:
web.write("<img src='overlap_{0}.png' alt='overlap' width=500>".format(ifo))
# -- Add histogram of signal energy
web.write("<h3>Histogram of signal energy, (aka ||<i>h(t)</i>||<sup>2</sup>) </h3>")
for ifo in ifoList:
web.write("<img src='energy_{0}.png' alt='t0' width=500>".format(ifo))
# -- Add histogram of recovered times
web.write("<h3>Histogram of central time</h3>")
for ifo in ifoList:
web.write("<img src='tzero_{0}.png' alt='t0' width=500>".format(ifo))
# -- Add histogram of duration
web.write("<h3>Histogram of duration</h3>")
for ifo in ifoList:
web.write("<img src='duration_{0}.png' alt='t0' width=500>".format(ifo))
# -- Add histogram of central frequency
web.write("<h3>Histogram of central frequency</h3>")
for ifo in ifoList:
web.write("<img src='freq_{0}.png' alt='t0' width=500>".format(ifo))
# -- Add histogram of bandwidth
web.write("<h3>Histogram of bandwidth</h3>")
for ifo in ifoList:
web.write("<img src='band_{0}.png' alt='t0' width=500>".format(ifo))
# -- Write out Glitch model
web.write("<h3>Median Glitch Model Waveforms and 1-sigma Uncertainties</h3>")
web.write("Reconstructed waveforms in whitened data<br/>")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment