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
f77dc37a
Commit
f77dc37a
authored
5 years ago
by
Zineb Aly
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git.km3net.de:km3py/km3io
parents
6acc1c0b
4a211004
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#6948
passed with warnings
5 years ago
Stage: test
Stage: coverage
Stage: doc
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3io/jpp.py
+43
-0
43 additions, 0 deletions
km3io/jpp.py
with
43 additions
and
0 deletions
km3io/jpp.py
+
43
−
0
View file @
f77dc37a
...
...
@@ -6,6 +6,7 @@ class JppReader:
def
__init__
(
self
,
filename
):
self
.
fobj
=
uproot
.
open
(
filename
)
self
.
_events
=
None
self
.
_timeslices
=
None
@property
def
events
(
self
):
...
...
@@ -30,6 +31,48 @@ class JppReader:
self
.
_events
=
JppEvents
(
headers
,
snapshot_hits
,
triggered_hits
)
return
self
.
_events
@property
def
timeslices
(
self
):
if
self
.
_timeslices
is
None
:
self
.
_timeslices
=
JppTimeslices
(
self
.
fobj
)
return
self
.
_timeslices
class
JppTimeslices
:
"""
A simple wrapper for Jpp timeslices
"""
def
__init__
(
self
,
fobj
):
self
.
_timeslices
=
{}
streams
=
[
s
.
split
(
b
"
KM3NET_TIMESLICE_
"
)[
1
].
split
(
b
'
;
'
)[
0
]
for
s
in
fobj
.
keys
()
if
b
"
KM3NET_TIMESLICE_
"
in
s
]
for
stream
in
streams
:
tree
=
fobj
[
b
'
KM3NET_TIMESLICE_
'
+
stream
]
self
.
_timeslices
[
stream
]
=
JppTimeslice
(
tree
[
b
'
km3net_timeslice_
'
+
stream
])
def
__str__
(
self
):
return
"
Available timeslice streams: {}
"
.
format
(
'
,
'
.
join
(
s
.
decode
(
"
ascii
"
)
for
s
in
self
.
_timeslices
.
keys
()))
def
__repr__
(
self
):
return
str
(
self
)
class
JppTimeslice
:
"""
A wrapper for a Jpp timeslice
"""
def
__init__
(
self
,
tree
):
self
.
header
=
tree
[
b
'
KM3NETDAQ::JDAQTimeslice
'
][
b
'
KM3NETDAQ::JDAQTimesliceHeader
'
][
b
'
KM3NETDAQ::JDAQHeader
'
][
b
'
KM3NETDAQ::JDAQChronometer
'
]
# [b'KM3NETDAQ::JDAQTimeslice'][b'vector<KM3NETDAQ::JDAQSuperFrame>']
def
__str__
(
self
):
return
"
Jpp timeslice
"
def
__repr__
(
self
):
return
str
(
self
)
class
JppEvents
:
"""
A simple wrapper for Jpp events
"""
...
...
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