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
1e7c52e0
Verified
Commit
1e7c52e0
authored
6 months ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Improve time residuals plot
parent
c9fdb8c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#54886
passed
6 months ago
Stage: docker
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/scripts/time_residuals.py
+21
-6
21 additions, 6 deletions
backend/scripts/time_residuals.py
with
21 additions
and
6 deletions
backend/scripts/time_residuals.py
+
21
−
6
View file @
1e7c52e0
...
...
@@ -21,6 +21,7 @@ import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib
.
use
(
'
Agg
'
)
import
matplotlib.pyplot
as
plt
import
seaborn
as
sns
import
numpy
as
np
import
pandas
as
pd
...
...
@@ -28,6 +29,10 @@ import km3pipe as kp
kp
.
style
.
use
(
'
km3pipe
'
)
LINE_STYLES
=
[
'
solid
'
,
'
dashed
'
,
'
dashdot
'
,
'
dotted
'
]
N_STYLES
=
len
(
LINE_STYLES
)
def
main
():
from
docopt
import
docopt
args
=
docopt
(
__doc__
)
...
...
@@ -42,6 +47,12 @@ def main():
names
=
[
"
run
"
,
"
timestamp
"
,
"
du
"
,
"
floor
"
,
"
dom_id
"
,
"
t_res
"
,
"
Q
"
],
header
=
1
,
)
n_dus
=
len
(
np
.
unique
(
df
.
du
))
n_colors
=
int
(
np
.
ceil
(
n_dus
/
N_STYLES
))
colors
=
sns
.
color_palette
(
'
colorblind
'
,
n_colors
=
n_colors
)
linestyles
=
[(
c
,
s
)
for
c
in
colors
for
s
in
LINE_STYLES
]
df
=
df
[
df
.
timestamp
>
time
.
time
()
-
60
*
60
*
hours
]
print
(
f
"
-> number of entries:
{
len
(
df
)
}
"
)
...
...
@@ -53,16 +64,20 @@ def main():
constrained_layout
=
True
)
for
ax
,
floor
in
zip
(
axes
.
flatten
(),
range
(
1
,
19
)):
for
du
in
np
.
unique
(
df
.
du
):
for
du
,
linestyle
in
zip
(
sorted
(
np
.
unique
(
df
.
du
)
),
linestyles
)
:
_df
=
df
[
df
.
du
==
du
]
t_res
=
_df
[
_df
.
floor
==
floor
].
t_res
t_res
=
t_res
[
np
.
abs
(
t_res
)
<
500
]
t_res
=
t_res
[
np
.
abs
(
t_res
)
<
150
]
du
=
int
(
du
)
print
(
f
"
DU
{
du
}
floor
{
floor
}
:
{
len
(
t_res
)
}
entries
"
)
ax
.
hist
(
t_res
,
bins
=
10
0
,
bins
=
6
0
,
histtype
=
'
step
'
,
lw
=
2
,
label
=
f
'
Floor
{
floor
}
/ DU
{
du
}
'
)
label
=
f
'
DU
{
du
}
'
,
density
=
true
,
color
=
linestyle
[
0
],
linestyle
=
linestyle
[
1
])
ax
.
legend
(
loc
=
'
upper right
'
)
if
floor
>
15
:
ax
.
set_xlabel
(
'
time residual [ns]
'
)
...
...
@@ -70,14 +85,14 @@ def main():
ax
.
set_ylabel
(
'
count
'
)
ax
.
set_yscale
(
'
log
'
)
utc_now
=
datetime
.
utcnow
().
strftime
(
"
%c
"
)
fig
.
suptitle
(
f
"
Time residuals using
ROy
reconstructions
"
fig
.
suptitle
(
f
"
Time residuals using
FibonacciFit
reconstructions
"
f
"
from the past
{
hours
}
hours -
"
f
"
{
utc_now
}
UTC
\n
"
)
plt
.
savefig
(
os
.
path
.
join
(
plots_path
,
'
time_residuals
'
))
plt
.
close
(
'
all
'
)
gc
.
collect
()
time
.
sleep
(
6
0
)
time
.
sleep
(
30
0
)
if
__name__
==
'
__main__
'
:
...
...
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