Skip to content
Snippets Groups Projects
Commit 91cb31ca authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Merge branch 'master' of git.km3net.de:km3py/km3mon

parents c93454be a0586091
No related branches found
No related tags found
No related merge requests found
Showing
with 481 additions and 29 deletions
Makefile
data/
__pycache__
*.pyc
plots/
......@@ -30,7 +30,7 @@ start:
@echo Starting the web server on 0.0.0.0:${WEBSERVER_PORT}
@#
@tmux send-keys -t ${SESSION_NAME}:main.3 \
"cd www && python3 -m http.server ${WEBSERVER_PORT}" Enter
"FLASK_APP=km3mon.py flask run --host=0.0.0.0 --port=${WEBSERVER_PORT}" Enter
@tmux select-layout even-vertical
@echo Starting the monitoring scripts
......
from flask import Flask
app = Flask(__name__)
from app import routes
from os.path import join
from flask import render_template, send_from_directory
from app import app
PLOTS_PATH = "../plots"
PLOTS = [
['dom_activity', 'dom_rates'],
['pmt_rates', 'pmt_hrv'],
['trigger_rates'],
]
@app.route('/')
def index():
return render_template('plots.html', plots=PLOTS)
@app.route('/plots/<path:filename>')
def custom_static(filename):
print(filename)
filepath = join(app.root_path, PLOTS_PATH)
print(filepath)
return send_from_directory(join(app.root_path, PLOTS_PATH), filename)
This diff is collapsed.
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 50px;
padding-bottom: 20px;
}
img.plot {
width: 100%;
}
.plot-container {
text-align: center;
}
.ruler {
background-color: steelblue;
position: absolute;
}
#horizontal{
margin-top: 50px;
width:98%;
height:4px;
opacity: 0.5;
display: none;
}
#vertical{
width:1px;
height:100%;
display: none;
}
File added
This diff is collapsed.
File added
File added
File added
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>KM3Mon Detector Monitor</title>
<link href="static/css/bootstrap.min.css" rel="stylesheet">
<link href="static/css/main.css" rel="stylesheet">
<script src="static/js/jquery-3.3.1.slim.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">KM3Mon</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="index.html">Overview</a></li>
</ul>
<ul class="nav navbar-nav">
<li class="active"><a href="intradom.html">Intra DOM Calibration</a></li>
</ul>
<ul class="nav navbar-nav">
<li class="active"><a href="k40rate_dist.html">K40 Rate Dist</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<h4 style="padding-top: 4px; padding-right: 10px; text-align: center">
<span id="divUTC" class="label label-info"></span>
</h4>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
{% block plots %}{% endblock %}
<script type = "text/javascript">
$(document).ready(function(){
$(function(){
setInterval(function(){
var divUtc = $('#divUTC');
var d1 = new Date();
var utc_string = d1.toUTCString().replace("GMT", "UTC");
divUtc.text(utc_string);
},1000);
});
});
</script>
</body>
</html>
{% extends "base.html" %}
{% block plots %}
<div class="container-fluid" id="plots">
{% for row in plots %}
<div class="row">
{% for plot in row %}
<div class="col-md-{{ (12/(row|length))|int }} plot-container">
<img id="{{ plot }}"
class="plot img-responsive"
src="plots/{{ plot }}.png"
alt="{{ plot }}"/>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
<script type = "text/javascript">
$(document).ready(function(){
setInterval(function(){
{% for row in plots %}
{% for plot in row %}
$("#{{ plot }}").attr("src", "plots/{{ plot }}.png?"+new Date().getTime());
{% endfor %}
{% endfor %}
}, 45000);
});
</script>
{% endblock %}
from app import app
......@@ -14,7 +14,7 @@ Options:
-l LIGIER_IP The IP of the ligier [default: 127.0.0.1].
-p LIGIER_PORT The port of the ligier [default: 5553].
-d DET_ID Detector ID [default: 29].
-o PLOT_DIR The directory to save the plot [default: www/plots].
-o PLOT_DIR The directory to save the plot [default: plots].
-h --help Show this screen.
"""
......@@ -56,22 +56,15 @@ class DOMActivityPlotter(kp.Module):
if self.index % 30:
return blob
tag = str(blob['CHPrefix'].tag)
if 'RawSummaryslice' in blob:
summaryslice = blob['RawSummaryslice']
timestamp = summaryslice.header.time_stamp
if tag != 'IO_SUM':
return blob
data = blob['CHData']
data_io = BytesIO(data)
preamble = kp.io.daq.DAQPreamble(file_obj=data_io) # noqa
summaryslice = kp.io.daq.DAQSummaryslice(file_obj=data_io)
timestamp = summaryslice.header.time_stamp
for dom_id, _ in summaryslice.summary_frames.items():
du, dom, _ = self.detector.doms[dom_id]
self.last_activity[(du, dom)] = timestamp
for dom_id, _ in summaryslice.summary_frames.items():
du, dom, _ = self.detector.doms[dom_id]
self.last_activity[(du, dom)] = timestamp
self.cuckoo.msg()
self.cuckoo.msg()
return blob
......
......@@ -14,7 +14,7 @@ Options:
-l LIGIER_IP The IP of the ligier [default: 127.0.0.1].
-p LIGIER_PORT The port of the ligier [default: 5553].
-d DET_ID Detector ID [default: 29].
-o PLOT_DIR The directory to save the plot [default: www/plots].
-o PLOT_DIR The directory to save the plot [default: plots].
-h --help Show this screen.
"""
......@@ -57,16 +57,14 @@ class MonitorRates(kp.Module):
if self.index % 30:
return blob
data = blob['CHData']
data_io = BytesIO(data)
preamble = kp.io.daq.DAQPreamble(file_obj=data_io) # noqa
summaryslice = kp.io.daq.DAQSummaryslice(file_obj=data_io)
self.rates = {} # TODO: review this hack
for dom_id, rates in summaryslice.summary_frames.items():
du, dom, _ = self.detector.doms[dom_id]
self.rates[(du, dom)] = np.sum(rates) / 1000
if 'RawSummaryslice' in blob:
summaryslice = blob['RawSummaryslice']
self.rates = {} # TODO: review this hack
for dom_id, rates in summaryslice.summary_frames.items():
du, dom, _ = self.detector.doms[dom_id]
self.rates[(du, dom)] = np.sum(rates) / 1000
self.cuckoo.msg()
self.cuckoo.msg()
return blob
......
......@@ -16,7 +16,7 @@ Options:
-u DU The DU to monitor [default: 1].
-d DET_ID Detector ID [default: 29].
-i INTERVAL Time interval for one pixel [default: 10].
-o PLOT_DIR The directory to save the plot [default: www/plots].
-o PLOT_DIR The directory to save the plot [default: plots].
-h --help Show this screen.
"""
......@@ -49,8 +49,8 @@ class PMTRates(kp.Module):
self.detector = self.require("detector")
self.du = self.require("du")
self.interval = self.get("interval", default=10)
self.plot_path = self.get("plot_path", default="www/plots")
self.filename = self.get("filename", default="pmtrates.png")
self.plot_path = self.get("plot_path", default="plots")
self.filename = self.get("filename", default="pmt_rates.png")
self.max_x = 800
self.index = 0
self.rates = defaultdict(list)
......
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