#!/usr/bin/python # Copyright (C) 2012 Alan Weinstein # # 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. # # A copy of the GNU General Public License may be found at # http://www.gnu.org/copyleft/gpl.html # or write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. """ plot_trigvals.py This is example python code to read in the values of the likelihood ratio detection statistic for the on-source 6-second region searched for a signal associated with GRB051103 and the 324 6-second off-source regions used to estimate the on-source background. """ ############################################## # import everything we need, up front: import numpy as np import matplotlib matplotlib.use('Agg') # This lets us make plots without a display. from matplotlib import pyplot as plt # Load the on-source likelihood ratio value (time and value) dir = './GRB051103_LIGO_triggervals/' Lon = np.loadtxt(dir+'GRB051103_LIGO_onsource_triggervals.txt') # Load the off-source likelihood ratio times and values. Loff = np.loadtxt(dir+'GRB051103_LIGO_offsource_triggervals.txt') # plot time relative to GPS offset Toffset = 815040000 # plot the values plt.figure(1) plt.plot(Loff[:,0]-Toffset,Loff[:,1],'bo',Lon[0]-Toffset,Lon[1],'r*') plt.xlabel('time since '+str(Toffset)+' (s)') plt.ylabel('Segment Likelihood') plt.savefig('trigvals1.png') # histogram the values edges = np.arange(0.,6.,0.25) plt.figure(2) plt.hist(Loff[:,1],edges) plt.plot(Lon[1],1,'r*',markersize=12) plt.xlabel('Segment Likelihood') plt.ylabel('Nsegments') plt.title('GRB051103 segment likelihoods (trigvals)') plt.savefig('trigvalsh.png')