Commit 7bd6fdca authored by Francesco Pannarale's avatar Francesco Pannarale
Browse files

Allowing megaplot.py to display more of the megasky.py results on the skymap webpage

git-svn-id: https://svn.ligo.caltech.edu/svn/bayeswave/trunk@263 c56465c9-8126-4a4f-9d7d-ac845eff4865
parent c1f82e29
......@@ -19,17 +19,20 @@ if [ -s "$pathtoBWB" ] ; then
echo
echo "Entering $dirname ..."
cd $dirname
echo
echo " * Running megaplot..."
python -W ignore $pathtoBWB/postprocess/megaplot.py
MDC="$(grep MDC *bayeswave.run)"
inj="$(grep \\.xml *bayeswave.run)"
if [ ${#MDC} -ne "0" -o ${#inj} -ne "0" ] ; then
echo
echo " * Running skymap..."
$pathtoBWB/postprocess/run_skymap.sh $ra $dec
mv skymap.png plots/.
#$pathtoBWB/postprocess/run_skymap.sh $ra $dec
python $pathtoBWB/postprocess/skymap/megasky.py
mv -f skymap.png plots/.
mv -f ra_acf.png plots/.
mv -f ra_chain.png plots/.
fi
echo
echo " * Running megaplot..."
python -W ignore $pathtoBWB/postprocess/megaplot.py
#echo
#echo " * Running plot_evidence..."
#python -W ignore $pathtoBWB/postprocess/plot_evidence.py
......
......@@ -864,22 +864,25 @@ def make_subpage(htmlDir, plotsDir, page, model, modelList, ifoList, ifoNames, m
plotsrc = './'+plotsDir+plot+'.png'
subpage.write(' <a href="'+plotsrc+'"><img src="'+plotsrc+'" alt="'+plotsrc+'" width=500></a>\n')
elif page == 'skymap':
subpage.write(' <a href="./'+plotsDir+'skymap.png"><img src="./'+plotsDir+'skymap.png" alt="skymap.png" width=650></a>\n')
#TODO: Eventually display all skyview results too. Will need to:
# - import skyview.py
# - add return(trigtime, pixarea, area50, area90, searcharea, injcontour) to skyview.py
# - avoid having 2 skyview.png files
# - have skyview produce its output in plotsDir
#trigtime, pixarea, area50, area90, searcharea, injcontour = make_skyview(directory='.', mdc=None, NSIDE=512, results=None, sim=True)
#subpage.write(' <h4>Sky View for trigger at {0}</h4>\n'.format(trigtime))
#subpage.write(' The area per pixel is {0:.2f} sq. degrees.<br/>\n'.format(pixarea))
#subpage.write(' The area of the 50% region is {0:.2f} sq. degrees.<br/>\n'.format(area50))
#subpage.write(' The area of the 90% region is {0:.2f} sq. degrees.<br/>\n'.format(area90))
#subpage.write(' The searched area is {0:.2f} sq. degrees.<br/>\n'.format(searcharea))
#subpage.write(' The injection was found at the {0:.2f} percent area contour.<br/>\n'.format(injcontour * 100.0))
#subpage.write(' <a href="./'+plotsDir+'ra_acf.png"><img src="./'+plotsDir+'ra_acf.png" alt="ra_acf.png" width=650></a>\n')
#subpage.write(' <a href="./'+plotsDir+'ra_chain.png"><img src="./'+plotsDir+'ra_chain.png" alt="ra_chain.png" width=650></a>\n')
#subpage.write(' <a href="./'+plotsDir+'skymap.png"><img src="./'+plotsDir+'skymap.png" alt="skymap.png" width=650></a>\n')
# Display the skymap
plotsrc = './'+plotsDir+'skymap.png'
subpage.write(' <a href="'+plotsrc+'"><img src="'+plotsrc+'" alt="'+plotsrc+'" width=650></a><br/>\n')
# Display all the megasky results: remember to run megasky first, then megaplot
if os.path.exists(str(jobName)+'megasky_results.dat'):
megasky_results = np.loadtxt(str(jobName)+'megasky_results.dat')
pixarea, area50, area90, searcharea, injcontour = megasky_results
subpage.write(' The area per pixel is {0:.2f} sq. degrees.<br/>\n'.format(pixarea))
subpage.write(' The area of the 50% region is {0:.2f} sq. degrees.<br/>\n'.format(area50))
subpage.write(' The area of the 90% region is {0:.2f} sq. degrees.<br/>\n'.format(area90))
subpage.write(' The searched area is {0:.2f} sq. degrees.<br/>\n'.format(searcharea))
subpage.write(' The injection was found at the {0:.2f} percent area contour.<br/>\n'.format(injcontour))
# Display the other megaksy plots, if present
plotsrc = './'+plotsDir+'ra_acf.png'
if os.path.exists(plotsrc):
subpage.write(' <a href="'+plotsrc+'"><img src="'+plotsrc+'" alt="'+plotsrc+'" width=500></a>\n')
plotsrc = './'+plotsDir+'ra_chain.png'
if os.path.exists(plotsrc):
subpage.write(' <a href="'+plotsrc+'"><img src="'+plotsrc+'" alt="'+plotsrc+'" width=500></a>\n')
elif page in ['waveform', 'bayesogram', 'spec']:
subpage.write(' <br/>\n')
for mod in modelList:
......
......@@ -206,23 +206,34 @@ def make_skyview(directory='.', mdc=None, NSIDE=256, results=None):
# -- 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>')
skyview.write('<h1>Sky View for trigger at {0}</h1>'.format(trigtime))
skyview.write('<h2>Links</h2>')
skyview.write('<a href="./index.html">Event Overview</a> for this trigger<br/>')
skyview.write('<a href="../../top.html">Top level page</a> for this injection set<br/>')
skyview.write('<h2>Statistics</h2>')
skyview.write('The area per pixel is {0:.2f} sq. degrees.<br/>'.format(pixarea))
skyview.write('The area of the 50% region is {0:.2f} sq. degrees.<br/>'.format(area50))
skyview.write('The area of the 90% region is {0:.2f} sq. degrees.<br/>'.format(area90))
skyview.write('The searched area is {0:.2f} sq. degrees.<br/>'.format(searcharea))
skyview.write('The injection was found at the {0:.2f} percent area contour.<br/>'.format(injcontour * 100.0))
skyview.write('<h2>Plots</h2>')
skyview.write('<img src="plots/skymap.png" width=600>')
skyview.write('<img src="ra_chain.png" width=600>')
skyview.write('<img src="ra_acf.png" width=600>')
skyview.write('<html><head><title>Skyview</title></head><body>\n')
skyview.write('<h1>Sky View for trigger at {0}</h1>\n'.format(trigtime))
skyview.write('<h2>Links</h2>\n')
skyview.write('<a href="./index.html">Event Overview</a> for this trigger<br/>\n')
skyview.write('<a href="../../top.html">Top level page</a> for this injection set<br/>\n')
skyview.write('<h2>Statistics</h2>\n')
skyview.write('The area per pixel is {0:.2f} sq. degrees.<br/>\n'.format(pixarea))
skyview.write('The area of the 50% region is {0:.2f} sq. degrees.<br/>\n'.format(area50))
skyview.write('The area of the 90% region is {0:.2f} sq. degrees.<br/>\n'.format(area90))
skyview.write('The searched area is {0:.2f} sq. degrees.<br/>\n'.format(searcharea))
skyview.write('The injection was found at the {0:.2f} percent area contour.<br/>\n'.format(injcontour * 100.0))
skyview.write('<h2>Plots</h2>\n')
skyview.write('<img src="plots/skymap.png" width=600>\n')
skyview.write('<img src="ra_chain.png" width=600>\n')
skyview.write('<img src="ra_acf.png" width=600>\n')
skyview.write('</body></html>')
skyview.close()
# -- Let's also save the main results on a txt file for megaplot.py to read in
datoutput = open('megasky_results.dat', 'w')
datoutput.write('# Megasky main results\n')
datoutput.write('# Rows are: pixarea [sq. degrees.], area50 [sq. degrees.], area90 [sq. degrees.], searcharea [sq. degrees.], injcontour%\n')
datoutput.write('{0}\n'.format(pixarea))
datoutput.write('{0}\n'.format(area50))
datoutput.write('{0}\n'.format(area90))
datoutput.write('{0}\n'.format(searcharea))
datoutput.write('{0}'.format(format(injcontour * 100.0)))
datoutput.close
os.chdir(topdir)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment