diff --git a/combtrack_makesummary.py b/combtrack_makesummary.py index 8012ad29bb4f12968e78ec7915e996d9ff1f9246..277809c0113deba21092bb0f1496cee9382213ef 100644 --- a/combtrack_makesummary.py +++ b/combtrack_makesummary.py @@ -9,7 +9,11 @@ from gwpy import time import argparse import glob import generalio as g -from matplotlib import colors,cm +import matplotlib +matplotlib.use('Agg') +from matplotlib import cm +from matplotlib import pyplot as plt +from StringIO import StringIO def color_for_combtrack_file(fname): strnow=0 @@ -52,6 +56,7 @@ def makeparser(): parser.add_argument("--channels",nargs="+",help="More channels (user specified)") parser.add_argument("--include",nargs="+",help="Files containing notes to include.") parser.add_argument("--combnotesfile",help="Files containing tooltips for each comb.") + parser.add_argument("--reloadpreviewimgs",type='bool',help="Update preview images.") return parser @@ -91,26 +96,42 @@ def main(): else: pass + if not os.path.isdir(args.inputfolder+"summaryplots"): + os.mkdir(args.inputfolder+"summaryplots") + for fname in os.listdir(args.inputfolder): if fname[0:2]=="sp" and fname.split("_")[1][0:3]=="off": + IFO=fname.split(":")[0][-2:] + chname=IFO+":"+fname.split(IFO+":")[-1].strip(".html") + if "DARM" in chname: + chname="(DARM) "+chname c=color_for_combtrack_file(args.inputfolder+fname) combspstr,comboffstr=fname.split("_")[0:2] combsp=combspstr.strip("sp").replace("p",".") comboff=comboffstr.strip("off").replace("p",".") comb_tag="{0}<br><hr>{1}".format(combsp,comboff) - #comb_tag="sp"+g.num_to_pstr(combsp)+"_off"+g.num_to_pstr(comboff) - # if args.combnotesfile: - # for combkey in notesdict.keys(): - # if combkey in fname: - # combnotes=notesdict[combkey] - # continue - #link="<td style=\"background-color:{};\" class=\"colorcell\"><span class='tooltip'><a href=\"{}\" target=\"_blank\">{}</a><span class='tooltiptext'>{}</span></span></td>".format(c,args.folderurl+fname,comb_tag,combnotes) - #else: - link="<td style=\"background-color:{};\" class=\"colorcell\"><a href=\"{}\" target=\"_blank\">{}</a></td>".format(c,args.folderurl+fname,"link") - IFO=fname.split(":")[0][-2:] - chname=IFO+":"+fname.split(IFO+":")[-1].strip(".html") - if "DARM" in chname: - chname="(DARM) "+chname + + chnameformat=chname.replace("(DARM) ","") + splotfname="SMALLPLOT_"+"ch"+chnameformat+"_sp"+g.num_to_pstr(combsp)+"_off"+g.num_to_pstr(comboff)+".png" + if args.reloadpreviewimgs: + dat=open(args.inputfolder+fname).readlines() + fig=plt.figure(figsize=(1,.5)) + for line in dat: + if "],\"y2\":[" in line: + vals=line.split("],\"y2\":[")[1].split("]")[0] + vals=np.genfromtxt(StringIO(vals),delimiter=",") + vals=np.log(vals) + + plt.clf() + plt.plot(vals,color='black',linewidth=2) + plt.axis('off') + fig.axes[0].get_xaxis().set_visible(False) + fig.axes[0].get_yaxis().set_visible(False) + plt.savefig(args.inputfolder+"summaryplots/"+splotfname,transparent=True,bbox_inches='tight') + plt.close() + cellcont="./summaryplots/"+splotfname + + link="<td style=\"background-color:{};\" class=\"colorcell\"><a href=\"{}\" target=\"_blank\"><img src=\"{}\"></a></td>".format(c,args.folderurl+fname,cellcont) row=df([[link,comb_tag,chname]],columns=["link","comb_tag","channel_tag"]) content=content.append(row) diff --git a/combtrack_summary_template.html b/combtrack_summary_template.html index 896d141e52850a5efee25736bb5332b63f6c0e49..593183812cd5a6e029e9909ea91509bee987159c 100644 --- a/combtrack_summary_template.html +++ b/combtrack_summary_template.html @@ -11,7 +11,7 @@ <table class="scroll"> <thead> <tr class="tablehead"> - <th class="lefthandcol"><b>Tracked combs</b> →<br><small>(spacing, offset where teeth=offset+n*spacing)</small></th> + <th class="lefthandcol"><b>Tracked combs</b> →<br><small>(spacing | offset, where teeth=offset+n*spacing)</small></th> {% for tag in content.columns.values %} <th class="colorcell">{{ tag }}</th> {% endfor %} @@ -95,12 +95,6 @@ <td>Notes</td> </tr> -<tr> - <td>Which combs am I looking at?</td> - <td>The two numbers in each cell indicate spacing and offset.</td> - <td>This information is the same for each entry in the column. These are intended to be human-readable labels; the number of significant figures does not correspond to known comb resolution (which will be added to extended info in hover text)</td> -</tr> - <tr> <td>In which channels is the comb present?</td> <td>The color of each cell indicates the strength and pervasiveness of the comb in the most recent spectrum for that channel.</td> diff --git a/summary_style.css b/summary_style.css index 1931743c7e2ffe307ba75579baca88b615c2e77c..3468a48b7631578a96d802a6b2abd975b5efa64e 100644 --- a/summary_style.css +++ b/summary_style.css @@ -1,3 +1,11 @@ +img { +max-width:60px; +width:100%; +max-height:20px; +height:100%; +image-rendering:pixelated; +} + table{ background-color:white; } @@ -15,11 +23,11 @@ vertical-align:middle; border-collapse:collapse; } -hr { +.tablehead hr { border:1px solid rgba(0, 0, 0, .3)!important; -width:100%; +width:60px; margin-top:0px; -margin-bottom:0px; +margin-bottom:1px; opacity:50%; } @@ -63,6 +71,8 @@ border-collapse:collapse; .notes td { padding: 6 10 6 10; +border:1px solid black; +border-collapse:collapse; } #alert { @@ -76,7 +86,7 @@ padding: 3 3 3 3; display: inline-block; } -.rowspacer td{ +.rowspacer td, .rowspacer tr{ line-height:5px!important; border: 0px solid white!important; background-color:white!important; @@ -93,6 +103,7 @@ border-top:1px solid black!important; border-bottom:0px solid white!important; border-left:0px solid white!important; border-right:0px solid white!important; +background-color:white!important; } @@ -149,18 +160,18 @@ width:500px; display: flex; } -.scroll tr:hover { -background-color:lightgray!important; -} - .scroll td { flex: 1 auto; - padding: 2 10 2 10; word-wrap: break; border-left: 1px solid black; border-top: 1px solid black; } +.scroll td, .scroll th{ +padding:2 5 2 5; +vertical-align:middle; +line-height:20px; +} .scroll thead tr:after { content: ''; overflow-y: scroll; @@ -182,3 +193,9 @@ background-color:lightgray!important; height: 500px; width:100%; } + +.tooltiptext hr { +width:100%; +margin-top:2px; +margin-bottom:2px; +} diff --git a/trackComb.py b/trackComb.py index 9bc3ae823c8b980c32a5998a0dff1f0dafa7b3c1..382002fc11740118679fcd3d84ac6939df3658e7 100644 --- a/trackComb.py +++ b/trackComb.py @@ -134,9 +134,6 @@ def main(): for j in range(len(event_days_since[keep])): flag1text=Label(x=event_days_since[keep][j],x_offset=2.5,y_offset=0,angle=90,angle_units="deg",text=eventtags[keep][j],background_fill_color='white',background_fill_alpha=.9) p.add_layout(flag1text) - #sourceEvent=ColumnDataSource(data=dict(xE=eventflag_xlist,yE=np.ones(len(eventflag_xlist))*2*ymax,descript=eventflag_taglist)) - #d1=p.circle(source=sourceEvent,x='xE',y='yE',size=10,color='red') - #p.add_tools(HoverTool(renderers=[d1], tooltips='@descript',line_policy='nearest',mode='mouse')) c1=p.circle('x','y1',source=source,size=10,fill_alpha=.5,hover_line_color="black",line_color="black") c2=p.circle('x','y2',source=source,size='pervade',fill_alpha=.5,color='gold',hover_line_color="black",hover_color='gold',line_color="black") l1=p.line('x','lowb',source=source,color='black',alpha=.5)