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
5bcc6793
Commit
5bcc6793
authored
5 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Hide fobj pointer from public API
parent
c04eb2bc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#7853
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/daq.py
+11
-11
11 additions, 11 deletions
km3io/daq.py
with
11 additions
and
11 deletions
km3io/daq.py
+
11
−
11
View file @
5bcc6793
...
...
@@ -31,7 +31,7 @@ def get_rate(value):
class
DAQReader
:
"""
Reader for DAQ ROOT files
"""
def
__init__
(
self
,
filename
):
self
.
fobj
=
uproot
.
open
(
filename
)
self
.
_
fobj
=
uproot
.
open
(
filename
)
self
.
_events
=
None
self
.
_timeslices
=
None
self
.
_summaryslices
=
None
...
...
@@ -39,7 +39,7 @@ class DAQReader:
@property
def
events
(
self
):
if
self
.
_events
is
None
:
tree
=
self
.
fobj
[
"
KM3NET_EVENT
"
]
tree
=
self
.
_
fobj
[
"
KM3NET_EVENT
"
]
headers
=
tree
[
"
KM3NETDAQ::JDAQEventHeader
"
].
array
(
uproot
.
interpret
(
tree
[
"
KM3NETDAQ::JDAQEventHeader
"
],
...
...
@@ -62,20 +62,20 @@ class DAQReader:
@property
def
timeslices
(
self
):
if
self
.
_timeslices
is
None
:
self
.
_timeslices
=
DAQTimeslices
(
self
.
fobj
)
self
.
_timeslices
=
DAQTimeslices
(
self
.
_
fobj
)
return
self
.
_timeslices
@property
def
summaryslices
(
self
):
if
self
.
_summaryslices
is
None
:
self
.
_summaryslices
=
SummmarySlices
(
self
.
fobj
)
self
.
_summaryslices
=
SummmarySlices
(
self
.
_
fobj
)
return
self
.
_summaryslices
class
SummmarySlices
:
"""
A wrapper for summary slices
"""
def
__init__
(
self
,
fobj
):
self
.
fobj
=
fobj
self
.
_
fobj
=
fobj
self
.
_slices
=
None
self
.
_headers
=
None
self
.
_rates
=
None
...
...
@@ -101,7 +101,7 @@ class SummmarySlices:
def
_read_summaryslices
(
self
):
"""
Reads a lazyarray of summary slices
"""
tree
=
self
.
fobj
[
b
'
KM3NET_SUMMARYSLICE
'
][
b
'
KM3NET_SUMMARYSLICE
'
]
tree
=
self
.
_
fobj
[
b
'
KM3NET_SUMMARYSLICE
'
][
b
'
KM3NET_SUMMARYSLICE
'
]
return
tree
[
b
'
vector<KM3NETDAQ::JDAQSummaryFrame>
'
].
lazyarray
(
uproot
.
asjagged
(
uproot
.
astable
(
uproot
.
asdtype
([(
"
dom_id
"
,
"
i4
"
),
(
"
dq_status
"
,
"
u4
"
),
...
...
@@ -114,7 +114,7 @@ class SummmarySlices:
def
_read_headers
(
self
):
"""
Reads a lazyarray of summary slice headers
"""
tree
=
self
.
fobj
[
b
'
KM3NET_SUMMARYSLICE
'
][
b
'
KM3NET_SUMMARYSLICE
'
]
tree
=
self
.
_
fobj
[
b
'
KM3NET_SUMMARYSLICE
'
][
b
'
KM3NET_SUMMARYSLICE
'
]
return
tree
[
b
'
KM3NETDAQ::JDAQSummarysliceHeader
'
].
lazyarray
(
uproot
.
interpret
(
tree
[
b
'
KM3NETDAQ::JDAQSummarysliceHeader
'
],
cntvers
=
True
))
...
...
@@ -123,7 +123,7 @@ class SummmarySlices:
class
DAQTimeslices
:
"""
A simple wrapper for DAQ timeslices
"""
def
__init__
(
self
,
fobj
):
self
.
fobj
=
fobj
self
.
_
fobj
=
fobj
self
.
_timeslices
=
{}
self
.
_read_streams
()
...
...
@@ -131,10 +131,10 @@ class DAQTimeslices:
"""
Read the L0, L1, L2 and SN streams if available
"""
streams
=
set
(
s
.
split
(
b
"
KM3NET_TIMESLICE_
"
)[
1
].
split
(
b
'
;
'
)[
0
]
for
s
in
self
.
fobj
.
keys
()
if
b
"
KM3NET_TIMESLICE_
"
in
s
)
for
s
in
self
.
_
fobj
.
keys
()
if
b
"
KM3NET_TIMESLICE_
"
in
s
)
for
stream
in
streams
:
tree
=
self
.
fobj
[
b
'
KM3NET_TIMESLICE_
'
+
stream
][
b
'
KM3NETDAQ::JDAQTimeslice
'
]
tree
=
self
.
_
fobj
[
b
'
KM3NET_TIMESLICE_
'
+
stream
][
b
'
KM3NETDAQ::JDAQTimeslice
'
]
headers
=
tree
[
b
'
KM3NETDAQ::JDAQTimesliceHeader
'
][
b
'
KM3NETDAQ::JDAQHeader
'
][
b
'
KM3NETDAQ::JDAQChronometer
'
]
if
len
(
headers
)
==
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