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
bbf79216
Commit
bbf79216
authored
6 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Add function to retrieve baseline data
parent
3f8dee3c
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
scripts/rttc.py
+34
-1
34 additions, 1 deletion
scripts/rttc.py
with
34 additions
and
1 deletion
scripts/rttc.py
+
34
−
1
View file @
bbf79216
...
...
@@ -19,6 +19,7 @@ from __future__ import division
import
os
from
datetime
import
datetime
import
time
import
matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib
.
use
(
'
Agg
'
)
...
...
@@ -28,7 +29,7 @@ import matplotlib.ticker as ticker
from
matplotlib.colors
import
LogNorm
import
numpy
as
np
from
collections
import
deque
,
defaultdict
from
collections
import
deque
,
defaultdict
,
OrderedDict
from
functools
import
partial
import
km3pipe
as
kp
...
...
@@ -39,6 +40,38 @@ km3pipe.style.use('km3pipe')
from
km3pipe.logger
import
logging
def
get_baseline_rttc
(
det_id
,
hours
=
24
):
"""
Retrieve the median and std RTTC values for a given time interval [h]
"""
now
=
time
.
time
()
dm
=
kp
.
db
.
DBManager
()
det_oid
=
dm
.
get_det_oid
(
det_id
)
sds
=
kp
.
db
.
StreamDS
()
det
=
kp
.
hardware
.
Detector
(
det_id
=
det_id
)
clbmap
=
kp
.
db
.
CLBMap
(
det_oid
=
det_oid
)
runs
=
sds
.
runs
(
detid
=
det_id
)
latest_run
=
int
(
runs
.
tail
(
1
).
RUN
)
run_24h_ago
=
int
(
runs
[
runs
.
UNIXSTARTTIME
<
(
now
-
60
*
60
*
hours
)
*
1000
].
tail
(
1
).
RUN
)
baselines
=
{}
for
du
in
self
.
det
.
dus
:
data
=
OrderedDict
()
for
param
in
[
'
wr_mu
'
]
+
[
'
wr_delta[%d]
'
%
i
for
i
in
range
(
4
)]:
_data
=
sds
.
datalognumbers
(
parameter_name
=
param
,
detid
=
det_oid
,
minrun
=
run_24h_ago
,
maxrun
=
latest_run
,
source_name
=
clbmap
.
base
(
1
).
upi
)
data
[
param
]
=
(
_data
.
DATA_VALUE
.
median
(),
_data
.
DATA_VALUE
.
std
())
rttc_median
=
data
[
'
wr_mu
'
][
0
]
-
sum
(
[
data
[
p
][
0
]
for
p
in
list
(
data
.
keys
())[
1
:]])
rttc_std
=
data
[
'
wr_mu
'
][
1
]
-
sum
(
[
data
[
p
][
1
]
for
p
in
list
(
data
.
keys
())[
1
:]])
baselines
[
du
]
=
(
rttc_median
,
rttc_std
)
return
baselines
def
main
():
from
docopt
import
docopt
args
=
docopt
(
__doc__
)
...
...
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