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
575358a6
Commit
575358a6
authored
5 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
All methods to extract the summary slice infomation
parent
47643539
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Summaryslice status
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3io/daq.py
+34
-4
34 additions, 4 deletions
km3io/daq.py
with
34 additions
and
4 deletions
km3io/daq.py
+
34
−
4
View file @
575358a6
...
...
@@ -27,13 +27,43 @@ def get_rate(value):
else
:
return
MINIMAL_RATE_HZ
*
np
.
exp
(
value
*
RATE_FACTOR
)
def
unpack_bits
(
value
):
"""
Helper to unpack bits to bool flags (little endian)
"""
value
=
np
.
array
(
value
).
astype
(
np
.
int64
)
value
=
value
.
reshape
(
-
1
,
1
)
value
=
value
.
view
(
np
.
uint8
)
value
=
np
.
flip
(
value
,
axis
=
1
)
length
=
value
.
shape
[
0
]
return
np
.
unpackbits
(
value
).
reshape
(
length
,
-
1
).
astype
(
bool
)
def
get_fifo_status
(
value
):
"""
Returns the fifo status (fifo)
"""
return
np
.
any
(
np
.
bitwise_and
(
value
,
2
**
31
))
def
get_channel_flags
(
value
):
"""
Returns the hrv/fifo flags for the PMT channels (hrv/fifo)
"""
channel_bits
=
np
.
bitwise_and
(
value
,
0x3FFFFFFF
)
flags
=
unpack_bits
(
channel_bits
)
return
np
.
flip
(
flags
,
axis
=
1
)[:,
:
31
]
def
get_number_udp_packets
(
value
):
"""
Return the number of received UDP packets
based on the
dq_status
value
"""
"""
Return
s
the number of received UDP packets
(
dq_status
)
"""
return
np
.
bitwise_and
(
value
&
0x7FFF
)
def
has_udp_trailer
(
value
)
"""
Returns the UDP Trailer flag based on on the fifo field value
"""
return
np
.
any
(
np
.
bitwise_and
(
value
,
np
.
leftshift
(
1
,
31
)))
def
get_udp_max_sequence_number
(
value
):
"""
Returns the maximum sequence number of the received UDP packets (dq_status)
"""
return
np
.
right_shift
(
value
,
16
)
def
has_udp_trailer
(
value
):
"""
Returns the UDP Trailer flag (fifo)
"""
return
np
.
any
(
np
.
bitwise_and
(
value
,
np
.
leftshift
(
1
,
31
)))
class
DAQReader
:
"""
Reader for DAQ ROOT files
"""
...
...
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