Skip to content
Snippets Groups Projects
Commit a4e73ece authored by Ansel Neunzert's avatar Ansel Neunzert
Browse files

Major update to comb summary page

parent 769761a3
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,32 @@ from gwpy import time ...@@ -9,7 +9,32 @@ from gwpy import time
import argparse import argparse
import glob import glob
import generalio as g import generalio as g
from matplotlib import colors,cm
def color_for_combtrack_file(fname):
strnow=0
pervadenow=0
for line in open(fname).readlines():
if "\"y2\":" in line:
strnow=float(line.split("],\"y2\":")[0].split(",")[-1])
if "\"url\":" in line:
pervadenow=float(line.split("],\"url\":")[0].split(",")[-1])
x=int(max(0,np.log10(strnow*pervadenow))*50)
return colors.rgb2hex(cm.viridis(x)[:-1])
def recent_link_for_combtrack_file(fname):
reclink=""
for line in open(fname).readlines():
if "\"x\":" in line:
reclink=line.split("],\"x\":")[0].split(",")[-1]
return reclink
def recent_link_for_channel(folder,chname):
if "(DARM) " in chname:
chname=chname.strip("(DARM) ")
for fname in os.listdir(folder):
if chname in fname:
return recent_link_for_combtrack_file(folder+fname)
def makeparser(): def makeparser():
parser=argparse.ArgumentParser(description="Create a summary page of channels processed with chplot/chdata at different times.") parser=argparse.ArgumentParser(description="Create a summary page of channels processed with chplot/chdata at different times.")
...@@ -21,6 +46,8 @@ def makeparser(): ...@@ -21,6 +46,8 @@ def makeparser():
parser.add_argument("--timelinemode",help="Organize times vertically (good for tracking a few channels over time)",type='bool',default=False) parser.add_argument("--timelinemode",help="Organize times vertically (good for tracking a few channels over time)",type='bool',default=False)
parser.add_argument("--channellistfile",help="Channel list source (path to a newline-delimited text file)") parser.add_argument("--channellistfile",help="Channel list source (path to a newline-delimited text file)")
parser.add_argument("--channels",nargs="+",help="More channels (user specified)") 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.")
return parser return parser
...@@ -37,15 +64,47 @@ def main(): ...@@ -37,15 +64,47 @@ def main():
cols=["comb_tag","channel_tag","link"] cols=["comb_tag","channel_tag","link"]
content=pd.DataFrame(columns=cols) content=pd.DataFrame(columns=cols)
if args.combnotesfile:
notesdict={}
combdat=open(args.combnotesfile,'r').readlines()
combkey=""
for line in combdat:
if line[0]=="\"":
combsp,comboff=g.comb_string_to_floats(line)
combkey="sp"+g.num_to_pstr(combsp)+"_off"+g.num_to_pstr(comboff)
notesdict[combkey]=""
else:
notesdict[combkey]+=line
for key in notesdict.keys():
if notesdict[key]=="" or notesdict[key]=="\n":
notesdict[key]="No notes available."
else:
notesdict[key]=notesdict[key].replace("\n\n\n","<br><hr>")
notesdict[key]=notesdict[key].replace("\n\n","<br><hr>")
if notesdict[key][-4:]=="<hr>":
notesdict[key]=notesdict[key][:-4]
else:
pass
for fname in os.listdir(args.inputfolder): for fname in os.listdir(args.inputfolder):
if fname[0:2]=="sp" and fname.split("_")[1][0:3]=="off": if fname[0:2]=="sp" and fname.split("_")[1][0:3]=="off":
c=color_for_combtrack_file(args.inputfolder+fname)
combspstr,comboffstr=fname.split("_")[0:2] combspstr,comboffstr=fname.split("_")[0:2]
combsp=combspstr.strip("sp").replace("p",".") combsp=combspstr.strip("sp").replace("p",".")
comboff=comboffstr.strip("off").replace("p",".") comboff=comboffstr.strip("off").replace("p",".")
comb_tag="{0}<br>{1}".format(combsp,comboff) comb_tag="{0}<br>{1}".format(combsp,comboff)
link="<p id=\"p3\"><a href=\""+args.folderurl+fname+"\">"+comb_tag+"</a></p>" if args.combnotesfile:
for combkey in notesdict.keys():
if combkey in fname:
combnotes=notesdict[combkey]
continue
link="<td style=\"background-color:{};\"><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:{};\"><a href=\"{}\" target=\"_blank\">{}</a></td>".format(c,args.folderurl+fname,comb_tag)
IFO=fname.split(":")[0][-2:] IFO=fname.split(":")[0][-2:]
chname=IFO+":"+fname.split(IFO+":")[-1].strip(".html") chname=IFO+":"+fname.split(IFO+":")[-1].strip(".html")
if "DARM" in chname:
chname="(DARM) "+chname
row=df([[link,comb_tag,chname]],columns=["link","comb_tag","channel_tag"]) row=df([[link,comb_tag,chname]],columns=["link","comb_tag","channel_tag"])
content=content.append(row) content=content.append(row)
...@@ -53,8 +112,19 @@ def main(): ...@@ -53,8 +112,19 @@ def main():
content=content[content['channel_tag'].isin(args.chlist)] content=content[content['channel_tag'].isin(args.chlist)]
content=content.pivot('channel_tag','comb_tag','link') content=content.pivot('channel_tag','comb_tag','link')
newtags=["<a href={} target=\"_blank\">{}</a>".format(recent_link_for_channel(args.inputfolder,tag),tag) for tag in content.index]
for i in range(len(content.index)):
if "-CUMUL" in content.index[i]:
recentlink=recent_link_for_channel(args.inputfolder,content.index[i])
cumulsince=recentlink.split("fscan_cumulsince_")[1].split("/")[0]
newtags[i]=newtags[i].replace("-CUMUL","<br>Cumulative since {}".format(cumulsince))
content.index=newtags
output_from_parsed_template = template.render(content=content,args=" ".join(sys.argv[1:]),curdir=curdir) includetxt=""
for fname in args.include:
l="".join(open(fname).readlines())
includetxt+="\n"+l
output_from_parsed_template = template.render(content=content,includetxt=includetxt,curdir=curdir)
# to save the results # to save the results
with open(args.inputfolder+args.outputfile, "wb") as fh: with open(args.inputfolder+args.outputfile, "wb") as fh:
......
...@@ -6,8 +6,6 @@ FineTooth documentation ...@@ -6,8 +6,6 @@ FineTooth documentation
[`Gitlab repository <https://gitlab.aei.uni-hannover.de/aneunzert/FineTooth/>`_] [`Gitlab repository <https://gitlab.aei.uni-hannover.de/aneunzert/FineTooth/>`_]
These docs are only somewhat complete...
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
......
...@@ -2,14 +2,9 @@ ...@@ -2,14 +2,9 @@
Tutorial Tutorial
++++++++ ++++++++
This is a non-exhaustive introduction to using the tools within FineTooth. More information can be found within the help for each of these scripts-- simply type:: For each script, more information (including a full list of arguments and defaults) can be found in the help message. Or equivalently, in the "module and function docs" section of this document.
$ python SCRIPTNAME.py --help Before starting assuming you are on the LHO cluster, be sure to run::
to get a list of all the available options.
Before starting (assuming you are on the LHO cluster), be sure to run::
$ source /home/aneunzert/gwypybokeh/bin/activate $ source /home/aneunzert/gwypybokeh/bin/activate
...@@ -113,6 +108,8 @@ As you might imagine, if we keep adding days and channels, plotting them will ge ...@@ -113,6 +108,8 @@ As you might imagine, if we keep adding days and channels, plotting them will ge
Summary pages Summary pages
------------- -------------
*[This section will soon be deprecated as I improve the summary scripts]*
We're now dealing with 6 different plots, and might wish to generate a summary page to keep track of everything:: We're now dealing with 6 different plots, and might wish to generate a summary page to keep track of everything::
python makesummary.py --inputfolder="/home/aneunzert/public_html/comb_plots/tutorial*hrs/" --outputfilepath="/home/aneunzert/public_html/comb_plots/tutorial_summary.html" python makesummary.py --inputfolder="/home/aneunzert/public_html/comb_plots/tutorial*hrs/" --outputfilepath="/home/aneunzert/public_html/comb_plots/tutorial_summary.html"
...@@ -220,7 +217,7 @@ Finally, the ``--consecutive`` and ``--checkrange`` options work within ``combTr ...@@ -220,7 +217,7 @@ Finally, the ``--consecutive`` and ``--checkrange`` options work within ``combTr
Comb tracking summary pages Comb tracking summary pages
--------------------------- ---------------------------
TBA *[To be added]*
Finding combs Finding combs
------------- -------------
......
table{ table{
border: 1px solid; border: 1px solid;
border-collapse: collapse; border-collapse: collapse;
background-color:darkgray;
} }
td { td {
padding:2 10 2 10; padding:2 10 2 10;
} }
td:hover {
outline: 3px solid white;
}
tr:hover { tr:hover {
background-color: yellow!important; background-color: lightgray!important;
} }
a:link, a:visited, a:hover, a:active { a:link, a:visited, a:hover, a:active {
text-decoration: none; text-decoration: none;
color: blue; color: black;
target-name:new;
target-new:tab;
}
td a{
width:100%;
line-height:100%
display:block;
}
div {
width:80%;
background-color:lightgray;
padding: 3px 10px 3px 10px;
margin-bottom: 10px;
}
div.container {
width:100%;
background-color:white;
padding: 0px;
margin-bottom:0px;
}
#notes span{
background-color:white;
display:inline-block;
padding: 3 3 3 3;
}
#notes a {
text-decoration: underline;
}
#notes table {
background-color:white;
}
#notes td {
border:1px solid;
border-collapse:collapse;
padding: 6 10 6 10;
} }
#notes td:hover {
outline: 0px;
}
#alert {
display:inline-block;
padding: 3 3 3 3;
}
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
width: 180px;
top: 100%;
left: 50%;
margin-left: -90px;
background-color: white;
color: #black;
padding: 5px;
border: 1px solid black;
border-radius: 6px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}
.tooltiptext a {
text-decoration:underline;
}
.tooltiptext ul {
margin-left:-10px;
}
.tooltiptext li {
padding-bottom:5px;
}
...@@ -30,8 +30,5 @@ ...@@ -30,8 +30,5 @@
{% endfor %} {% endfor %}
</table> </table>
<p><b>The following arguments for makesummary.py were used to generate this page:</b>
<br>{{args}}
</body> </body>
</html> </html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment