Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
km3mon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
km3py
km3mon
Commits
9176dc76
Commit
9176dc76
authored
5 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Allow the usage of wildcards in plot layouts
parent
6b15ec8a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/routes.py
+25
-17
25 additions, 17 deletions
app/routes.py
with
25 additions
and
17 deletions
app/routes.py
+
25
−
17
View file @
9176dc76
from
glob
import
glob
from
os.path
import
basename
,
join
,
exists
from
os.path
import
basename
,
join
,
exists
,
splitext
from
functools
import
wraps
import
toml
from
flask
import
render_template
,
send_from_directory
,
request
,
Response
...
...
@@ -14,7 +14,7 @@ app.config['FREEZER_DESTINATION'] = '../km3web'
PLOTS
=
[[
'
dom_activity
'
,
'
dom_rates
'
],
[
'
pmt_rates
'
,
'
pmt_hrv
'
],
[
'
trigger_rates
'
],
[
'
ztplot
'
,
'
triggermap
'
]]
AHRS_PLOTS
=
[
[
'
yaw_calib_du*
'
]
,
[
'
pitch_calib_du*
'
]
,
[
'
roll_calib_du*
'
]
]
AHRS_PLOTS
=
[
'
yaw_calib_du*
'
,
'
pitch_calib_du*
'
,
'
roll_calib_du*
'
]
TRIGGER_PLOTS
=
[[
'
trigger_rates
'
],
[
'
trigger_rates_lin
'
]]
K40_PLOTS
=
[[
'
intradom
'
],
[
'
angular_k40rate_distribution
'
]]
RTTC_PLOTS
=
[[
'
rttc
'
]]
...
...
@@ -32,6 +32,21 @@ if exists(CONFIG_PATH):
PASSWORD
=
config
[
"
WebServer
"
][
"
password
"
]
def
expand_wildcards
(
plot_layout
):
"""
Replace wildcard entries with list of files
"""
plots
=
[]
for
row
in
AHRS_PLOTS
:
if
not
isinstance
(
row
,
list
)
and
'
*
'
in
row
:
plots
.
append
(
sorted
([
splitext
(
basename
(
p
))[
0
]
for
p
in
glob
(
join
(
app
.
root_path
,
PLOTS_PATH
,
row
))
]))
else
:
plots
.
append
(
row
)
return
plots
def
check_auth
(
username
,
password
):
"""
This function is called to check if a username /
password combination is valid.
...
...
@@ -77,38 +92,31 @@ def add_header(r):
@app.route
(
'
/index.html
'
)
@requires_auth
def
index
():
return
render_template
(
'
plots.html
'
,
plots
=
PLOTS
)
return
render_template
(
'
plots.html
'
,
plots
=
expand_wildcards
(
PLOTS
)
)
@app.route
(
'
/ahrs.html
'
)
@requires_auth
def
ahrs
():
plots
=
[]
for
row
in
AHRS_PLOTS
:
if
not
isinstance
(
row
,
list
)
and
'
*
'
in
row
:
plots
.
append
(
sorted
([
basename
(
p
)
for
p
in
glob
(
join
(
PLOTS_PATH
,
row
))]))
else
:
plots
.
append
(
row
)
return
render_template
(
'
plots.html
'
,
plots
=
plots
)
return
render_template
(
'
plots.html
'
,
plots
=
expand_wildcards
(
AHRS_PLOTS
))
@app.route
(
'
/reco.html
'
)
@requires_auth
def
reco
():
return
render_template
(
'
plots.html
'
,
plots
=
RECO_PLOTS
)
return
render_template
(
'
plots.html
'
,
plots
=
expand_wildcards
(
RECO_PLOTS
)
)
@app.route
(
'
/sn.html
'
)
@requires_auth
def
supernova
():
return
render_template
(
'
plots.html
'
,
plots
=
SN_PLOTS
)
return
render_template
(
'
plots.html
'
,
plots
=
expand_wildcards
(
SN_PLOTS
)
)
@app.route
(
'
/compact.html
'
)
@requires_auth
def
compact
():
return
render_template
(
'
plots.html
'
,
plots
=
COMPACT_PLOTS
)
return
render_template
(
'
plots.html
'
,
plots
=
expand_wildcards
(
COMPACT_PLOTS
)
)
@app.route
(
'
/rttc.html
'
)
...
...
@@ -116,7 +124,7 @@ def compact():
def
rttc
():
return
render_template
(
'
plots.html
'
,
plots
=
RTTC_PLOTS
,
plots
=
expand_wildcards
(
RTTC_PLOTS
)
,
info
=
"
Cable Round Trip Time calculated from realtime data provided by the
"
"
Detector Manager. The red lines shows the median and the STD
"
...
...
@@ -129,7 +137,7 @@ def rttc():
def
k40
():
return
render_template
(
'
plots.html
'
,
plots
=
K40_PLOTS
,
plots
=
expand_wildcards
(
K40_PLOTS
)
,
info
=
"
The first plot shows the intra-DOM calibration.
"
"
y-axis: delta_t [ns], x-axis: cosine of angles.
"
"
The second plot the angular distribution of K40 rates.
"
...
...
@@ -140,7 +148,7 @@ def k40():
@app.route
(
'
/trigger.html
'
)
@requires_auth
def
trigger
():
return
render_template
(
'
plots.html
'
,
plots
=
TRIGGER_PLOTS
)
return
render_template
(
'
plots.html
'
,
plots
=
expand_wildcards
(
TRIGGER_PLOTS
)
)
@app.route
(
'
/plots/<path:filename>
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment