Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
km3io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
km3io
Commits
b557c280
Commit
b557c280
authored
4 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Fix wrong mask
parent
7193b893
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!40
Resolve "Parsing of HRV and FIFO status words"
Pipeline
#13984
passed with warnings
4 years ago
Stage: test
Stage: coverage
Stage: doc
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3io/online.py
+1
-1
1 addition, 1 deletion
km3io/online.py
tests/test_online.py
+42
-0
42 additions, 0 deletions
tests/test_online.py
with
43 additions
and
1 deletion
km3io/online.py
+
1
−
1
View file @
b557c280
...
...
@@ -69,7 +69,7 @@ def get_channel_flags(value):
value : int32
The integer value to be parsed.
"""
channel_bits
=
np
.
bitwise_and
(
value
,
0x
4
FFFFFFF
)
channel_bits
=
np
.
bitwise_and
(
value
,
0x
7
FFFFFFF
)
flags
=
unpack_bits
(
channel_bits
,
CHANNEL_BITS_TEMPLATE
)
return
np
.
flip
(
flags
,
axis
=-
1
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_online.py
+
42
−
0
View file @
b557c280
from
collections
import
namedtuple
import
itertools
import
os
import
re
import
unittest
...
...
@@ -5,6 +7,7 @@ import unittest
from
km3net_testdata
import
data_path
from
km3io.online
import
OnlineReader
,
get_rate
,
has_udp_trailer
,
get_udp_max_sequence_number
,
get_channel_flags
,
get_number_udp_packets
from
km3io.tools
import
to_num
ONLINE_FILE
=
data_path
(
"
online/km3net_online.root
"
)
...
...
@@ -399,6 +402,45 @@ class TestSummaryslices(unittest.TestCase):
print
(
str
(
self
.
ss
))
class
TestGetChannelFlags_Issue59
(
unittest
.
TestCase
):
def
test_sample_summaryslice_dump
(
self
):
fieldnames
=
[
"
dom_id
"
]
for
i
in
range
(
31
):
fieldnames
.
append
(
f
"
ch
{
i
}
"
)
fieldnames
.
append
(
f
"
hrvfifo
{
i
}
"
)
Entry
=
namedtuple
(
"
Entry
"
,
fieldnames
)
with
open
(
data_path
(
"
online/KM3NeT_00000049_00008456.summaryslice-167941.txt
"
)
)
as
fobj
:
ref_entries
=
[
Entry
(
*
list
(
l
.
strip
().
split
()))
for
l
in
fobj
.
readlines
()]
r
=
OnlineReader
(
data_path
(
"
online/KM3NeT_00000049_00008456.summaryslice-167941.root
"
)
)
summaryslice
=
r
.
summaryslices
.
slices
[
0
]
for
ours
,
ref
in
zip
(
summaryslice
,
ref_entries
):
assert
ours
.
dom_id
==
to_num
(
ref
.
dom_id
)
fifos
=
get_channel_flags
(
ours
.
fifo
)
hrvs
=
get_channel_flags
(
ours
.
hrv
)
for
i
in
range
(
31
):
attr
=
f
"
ch
{
i
}
"
self
.
assertAlmostEqual
(
get_rate
(
getattr
(
ours
,
attr
))
/
1000.0
,
to_num
(
getattr
(
ref
,
attr
)),
places
=
1
,
)
hrvfifo
=
getattr
(
ref
,
f
"
hrvfifo
{
i
}
"
)
ref_hrv
=
bool
(
int
(
hrvfifo
[
0
]))
ref_fifo
=
bool
(
int
(
hrvfifo
[
1
]))
assert
hrvs
[
i
]
==
ref_hrv
assert
fifos
[
i
]
==
ref_fifo
class
TestGetRate
(
unittest
.
TestCase
):
def
test_zero
(
self
):
assert
0
==
get_rate
(
0
)
...
...
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