Commit 8bb086f1 authored by Reed Essick's avatar Reed Essick
Browse files

modified idq summary jobs and plots to make the web directories more navigable...

modified idq summary jobs and plots to make the web directories more navigable and to improve the usefulness of the pages
Original: 05c204f2fdd9d57cea908832f227b72383c983ce
parent 24ad2c40
......@@ -18,6 +18,7 @@ import ConfigParser
from optparse import *
import sys
import os
import glob
import time
from laldetchar.idq import idq
import numpy
......@@ -543,31 +544,36 @@ while gpsstart < gpsstop:
+ classifier)
logger.info('Done')
### generate channel trending plot
### generate channel trending plots
logger.info('generating channel performance trending plot')
chanlist_trend = []
for classifier in classifiers:
if classifier not in ['ovl']:
logger.info('skipping ' + classifier)
continue
try:
figure_name = this_sumdir + '/' + classifier \
+ '-%d-%d_channel_performance_trends.png' \
% (lookbacktime, gpsstart + stride)
chan_perform_png = idq_s_p.chanlist_trending(
lookbacktime,
gpsstart + stride,
sumdir,
classifier=classifier,
figure_name=figure_name,
annotated=False,
)
chanlist_trend.append((chan_perform_png, classifier))
except:
traceback.print_exc()
chanlist_trend.append(('', classifier))
logger.info('WARNING: FAILED to generated channel trending plot for '
+ classifier)
for yvalue in ["rank", "eff", "fap"]:
for classifier in classifiers:
logger.info('%s %s channel performance trending'%(classifier, yvalue))
if classifier not in ['ovl']:
logger.info('skipping ' + classifier)
continue
try:
figure_name = this_sumdir + '/' + classifier \
+ '-%d-%d_channel_performance_%s_trends.png' \
% (lookbacktime, gpsstart + stride, yvalue)
chan_perform_png = idq_s_p.chanlist_trending(
lookbacktime,
gpsstart + stride,
sumdir,
classifier=classifier,
figure_name=figure_name,
annotated=False,
yvalue=yvalue
)
chanlist_trend.append((chan_perform_png, classifier))
except:
traceback.print_exc()
chanlist_trend.append(('', classifier))
logger.info('WARNING: FAILED to generated channel trending plot for '
+ classifier)
logger.info('Done')
......@@ -719,6 +725,11 @@ while gpsstart < gpsstop:
logger.info('Done')
### soft link html page to index.html
index_html = "%s/index.html"%this_sumdir
logger.info("soft linking %s -> %s"%(html_path, index_html))
os.system("ln -s %s %s"%(html_path, index_html))
# update symbolic link
# ....iif os.path.lexists(symlink_path):
# ........os.remove(symlink_path)
......@@ -727,3 +738,41 @@ while gpsstart < gpsstop:
### continue onto the next stride
gpsstart += stride
#===================================================================================================
### (re)write index.html for sumdir once all pages are built
logger.info("writting top-level index.html page to point to individual directories")
index_html = "%s/index.html"%(sumdir)
file_obj = open(index_html, "w")
print >> file_obj, "<body>"
print >> file_obj, "<h1>iDQ summary pages Directory</h1>"
sumdirs = glob.glob("%s/*_*/"%sumdir)
sumdirs.reverse()
for this_sumdir in sumdirs:
this_sumdir = this_sumdir.strip("/").split("/")[-1]
print >> file_obj, "<p>information about iDQ between %s and %s : "%tuple(this_sumdir.split("_"))
print >> file_obj, "<a href=\"%s/index.html\">here</a>"%(this_sumdir)
print >> file_obj, "</p>"
print >> file_obj, "<hr />"
### print timestamp
c_time = time.localtime()
tzname = time.tzname[0]
print >> file_obj, '<p>last updated %d:%d:%d %s %2d/%2d/%4d </p>' % (
c_time.tm_hour,
c_time.tm_min,
c_time.tm_sec,
tzname,
c_time.tm_mon,
c_time.tm_mday,
c_time.tm_year,
)
print >> file_obj, "</body>"
file_obj.close()
......@@ -26,6 +26,8 @@
import sys
from laldetchar.idq import pdf_estimation as pdf_e
from laldetchar.idq import ovl
import numpy as np
import matplotlib
matplotlib.use('Agg')
......@@ -1192,11 +1194,15 @@ def chanlist_trending(
figure_name=False,
verbose=False,
annotated=True,
yvalue="rank"
):
"""
builds a channel performance trending plot using chanlist files
"""
if yvalue not in ["rank", "eff", "fap"]:
raise ValueError, "yvalue=%s not understood"%yvalue
ax_bounds = [0.025, 0.075, 0.5, 0.775]
ax_cb_bounds = [0.025, 0.875, 0.5, 0.05]
......@@ -1245,12 +1251,20 @@ def chanlist_trending(
for chan_dat in c:
channel = chan_dat[chanlistD['channel']]
if yvalue == "rank":
yValue = ovl.effbydt_to_rank(chan_dat[chanlistD['eff/fap']])
elif yvalue == "eff":
yValue = chan_dat[chanlistD['c_eff']]
elif yvalue == "fap":
yValue = chan_dat[chanlistD['c_fap']]
else:
raise ValueError, "yvalue=%s not understood"%yvalue
if chans.has_key(channel):
chans[channel].append([_start, _start + _dur,
chan_dat[chanlistD['eff/fap']]])
chans[channel].append([_start, _start + _dur, yValue])
else:
chans[channel] = [[_start, _start + _dur,
chan_dat[chanlistD['eff/fap']]]]
chans[channel] = [[_start, _start + _dur, yValue]]
# ## build plot
......@@ -1268,14 +1282,15 @@ def chanlist_trending(
sorted(chans.keys()) if chan
!= 'none']): # we don't care about the "none" channel
yticklabels.append(channel.replace("_","\_"))
for (_start, _stop, eff_fap) in chans[channel]:
for (_start, _stop, yValue) in chans[channel]:
if _start - gps_stop < time_min:
time_min = _start - gps_stop
rank = 1 - np.exp(-eff_fap / 100.0)
ax.fill_between([(_start - gps_stop) / tau, (_stop
- gps_stop) / tau], [ind + 0.49, ind
+ 0.49], [ind - 0.49, ind - 0.49],
facecolor=color_map(rank), edgecolor='none')
facecolor=color_map(yValue), edgecolor='none')
if annotated:
ax.text(((_start + _stop) / 2. - gps_stop) / tau, ind,
'%.2f' % rank, ha='center', va='center')
......@@ -1294,7 +1309,16 @@ def chanlist_trending(
ax_colorbar = fig.add_axes(ax_cb_bounds)
cb = mpl.colorbar.ColorbarBase(ax_colorbar, cmap=color_map,
norm=norm, orientation='horizontal')
cb.set_label(classifier + ' rank')
if yvalue == "rank":
cb.set_label(classifier + ' rank')
elif yvalue == "eff":
cb.set_label(classifier + ' efficiency')
elif yvalue == "fap":
cb.set_label(classifier + ' false alarm probability')
else:
raise ValueError, "yvalue=%s not understood"%yvalue
ax_colorbar.xaxis.tick_top()
ax_colorbar.xaxis.set_label_position('top')
......
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