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

Added main script for skyview.py

git-svn-id: https://svn.ligo.caltech.edu/svn/bayeswave/trunk@92 c56465c9-8126-4a4f-9d7d-ac845eff4865
parent a5ceaf21
No related branches found
No related tags found
No related merge requests found
......@@ -68,20 +68,22 @@ print "Found {0} loud WNB in good times".format(goodloudwnb.size)
# -- Set how many triggers we want
N = 20
N = 300
start = 21
stop = start + N
outfile = open('trigs_sg153.txt','w')
for time in goodsg[0:N]:
for time in goodsg[start:stop]:
outfile.write("{0} \n".format(time) )
outfile.close()
outfile = open('trigs_qwnb.txt','w')
for time in goodwnb[0:N]:
for time in goodwnb[start:stop]:
outfile.write("{0} \n".format(time) )
outfile.close()
outfile = open('trigs_lwnb.txt','w')
for time in goodloudwnb[0:N]:
for time in goodloudwnb[start:stop]:
outfile.write("{0} \n".format(time) )
outfile.close()
......
......@@ -5,6 +5,8 @@ import numpy as np
doit_str = """#! /bin/sh
source /home/jkanner/.bashrc.mine
cd {top}
gps=$1
......@@ -41,6 +43,8 @@ ligo_data_find --observatory L --type L1_LDAS_C02_L2 -s $start -e $end --lal-cac
--MDC-prefactor {scale} \
python /home/jkanner/baysewave/svn/trunk/postprocess/skymap/skyview.py --mdc {mdclog}
tar -cf chains.tar chains
tar -cf waveforms.tar waveforms
tar -cf snr.tar snr
......@@ -68,15 +72,18 @@ queue 1
# -----------------
# -- Set paramters
topdir = '/home/jkanner/baysewave/PEC/mdc_v1'
topdir = '/home/jkanner/baysewave/PEC/mdc_v2'
# topdir = '/home/jkanner/baysewave/test'
mdcdir = '/home/jkanner/baysewave/svn/trunk/burstinj/s6'
waveformList = ['elpsg153']
scaleList = ['0.15', '0.3', '0.6', '1.2']
mdccache = '/home/jkanner/baysewave/svn/trunk/burstinj/s6/elptc_s6.cache'
waveformList = ['sg153']
scaleList = ['0.3']
mdccache = '/home/jkanner/baysewave/svn/trunk/burstinj/s6/brst_s6.cache'
mdclog = '/home/jkanner/baysewave/svn/trunk/burstinj/s6/BurstMDC-BRST_S6-Log.txt'
# -- Alternate parameters
# waveformList = ['sg153', 'lwnb', 'qwnb']
# mdccache = '/home/jkanner/baysewave/svn/trunk/burstinj/s6brst_s6.cache'
# mdccache = '/home/jkanner/baysewave/svn/trunk/burstinj/s6/brst_s6.cache'
# scaleList = ['0.15', '0.3', '0.6', '1.2']
dagfile = open( os.path.join(topdir, 'submit.dag'), 'w')
......@@ -101,7 +108,7 @@ for waveform in waveformList:
submitfile.close()
doitfile = open( os.path.join(trigdir, 'doit.sh'), 'w')
doitfile.write(doit_str.format(top=trigdir, cachefile=mdccache, scale=scale))
doitfile.write(doit_str.format(top=trigdir, cachefile=mdccache, scale=scale, mdclog=mdclog))
doitfile.close()
jobname = "{0}_{1}_{2}".format(waveform, scale, int(float(trig)))
......
......@@ -21,7 +21,7 @@ import skyview
# --------------
# -- Set skymap resolution
NSIDE = 32
mdcfile = '/home/jkanner/baysewave/svn/trunk/burstinj/s6/BurstMDC-ELPTC_S6-Log.txt'
mdcfile = '/home/jkanner/baysewave/svn/trunk/burstinj/s6/BurstMDC-BRST_S6-Log.txt'
# -- Close any open figures
plt.close('all')
......
......@@ -14,13 +14,13 @@ from subprocess import call
import acor
from pylal import bayespputils
import sky_area.sky_area_clustering as sky
import getopt
# -------------------------------------------
# Module to make skymaps, skyview webpage, etc.
# Works with single output directory from
# BayesWaveBurst
# -------------------------------------------
def make_skyview(directory='.', mdc=None, NSIDE=32, results=None, sim=True):
# -- Close any open figures
......@@ -162,6 +162,12 @@ def make_skyview(directory='.', mdc=None, NSIDE=32, results=None, sim=True):
plt.title('RA chain: {0} samples'.format(ralist.size), fontsize=14)
plt.savefig('ra_chain.png')
# -- Make an output file with key statistics
outfile = open('skystats.txt', 'w')
outfile.write("# area50 area90 searcharea injcontour \n")
outfile.write("{0} {1} {2} {3}".format(area50, area90, searcharea, injcontour))
outfile.close()
# -- Since we've done all the sky stuff, let's try making the skyview web page right here
skyview = open('skyview.html','w')
skyview.write('<html><head><title>Skyview</title></head><body>')
......@@ -184,5 +190,36 @@ def make_skyview(directory='.', mdc=None, NSIDE=32, results=None, sim=True):
os.chdir(topdir)
# -- Write main script for command line running
if __name__ == "__main__":
opts, args = getopt.getopt(sys.argv[1:], "", ['directory=', 'mdc=', 'NSIDE=', 'sim='])
# -- Set default argument values
directory='.'
mdc=None
NSIDE=32
results=None
sim=True
print "Got these arguments"
print opts
print "Missed these:"
print args
for opt, arg in opts:
print opt
if opt=='--mdc':
# -- mdc argument should be the name of the MDC log
print "Reading MDC log {0}".format(arg)
mdc = ft.Mdc(arg)
if opt == '--directory':
directory = arg
if opt == '--NSIDE':
NSIDE = int(arg)
if opt == '--sim':
sim = 'True' == arg
make_skyview(directory, mdc, NSIDE, results, sim)
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