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
8332b510
Commit
8332b510
authored
4 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Use LRUArrayCache instead
parent
1ee98152
No related branches found
No related tags found
1 merge request
!39
WIP: Resolve "uproot4 integration"
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
km3io/offline.py
+2
-2
2 additions, 2 deletions
km3io/offline.py
km3io/online.py
+24
-46
24 additions, 46 deletions
km3io/online.py
km3io/rootio.py
+2
-2
2 additions, 2 deletions
km3io/rootio.py
km3io/tools.py
+2
-2
2 additions, 2 deletions
km3io/tools.py
with
30 additions
and
52 deletions
km3io/offline.py
+
2
−
2
View file @
8332b510
...
...
@@ -13,8 +13,8 @@ MAIN_TREE_NAME = "E"
EXCLUDE_KEYS
=
[
"
AAObject
"
,
"
t
"
,
"
fBits
"
,
"
fUniqueID
"
]
# 110 MB based on the size of the largest basket found so far in km3net
BASKET_CACHE_SIZE
=
110
*
1024
**
2
BASKET_CACHE
=
uproot
.
cache
.
ThreadSafe
ArrayCache
(
BASKET_CACHE_SIZE
)
BASKET_CACHE_SIZE
=
110
*
1024
**
2
BASKET_CACHE
=
uproot
.
cache
.
LRU
ArrayCache
(
BASKET_CACHE_SIZE
)
def
_nested_mapper
(
key
):
...
...
This diff is collapsed.
Click to expand it.
km3io/online.py
+
24
−
46
View file @
8332b510
...
...
@@ -5,10 +5,10 @@ import numpy as np
import
numba
as
nb
TIMESLICE_FRAME_BASKET_CACHE_SIZE
=
523
*
1024
**
2
# [byte]
SUMMARYSLICE_FRAME_BASKET_CACHE_SIZE
=
523
*
1024
**
2
# [byte]
BASKET_CACHE_SIZE
=
110
*
1024
**
2
BASKET_CACHE
=
uproot
.
cache
.
ThreadSafe
ArrayCache
(
BASKET_CACHE_SIZE
)
TIMESLICE_FRAME_BASKET_CACHE_SIZE
=
523
*
1024
**
2
# [byte]
SUMMARYSLICE_FRAME_BASKET_CACHE_SIZE
=
523
*
1024
**
2
# [byte]
BASKET_CACHE_SIZE
=
110
*
1024
**
2
BASKET_CACHE
=
uproot
.
cache
.
LRU
ArrayCache
(
BASKET_CACHE_SIZE
)
# Parameters for PMT rate conversions, since the rates in summary slices are
# stored as a single byte to save space. The values from 0-255 can be decoded
...
...
@@ -215,28 +215,16 @@ class SummarySlices:
def
_read_summaryslices
(
self
):
"""
Reads a lazyarray of summary slices
"""
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
"
),
(
"
hrv
"
,
"
u4
"
),
(
"
fifo
"
,
"
u4
"
),
(
"
status3
"
,
"
u4
"
),
(
"
status4
"
,
"
u4
"
),
]
+
[(
c
,
"
u1
"
)
for
c
in
self
.
_ch_selector
]
)
),
skipbytes
=
10
,
),
basketcache
=
uproot
.
cache
.
ThreadSafeArrayCache
(
SUMMARYSLICE_FRAME_BASKET_CACHE_SIZE
),
)
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
"
),
(
"
hrv
"
,
"
u4
"
),
(
"
fifo
"
,
"
u4
"
),
(
"
status3
"
,
"
u4
"
),
(
"
status4
"
,
"
u4
"
)]
+
[(
c
,
"
u1
"
)
for
c
in
self
.
_ch_selector
])),
skipbytes
=
10
),
basketcache
=
uproot
.
cache
.
LRUArrayCache
(
SUMMARYSLICE_FRAME_BASKET_CACHE_SIZE
))
def
_read_headers
(
self
):
"""
Reads a lazyarray of summary slice headers
"""
...
...
@@ -276,25 +264,15 @@ class Timeslices:
superframes
=
tree
[
b
"
vector<KM3NETDAQ::JDAQSuperFrame>
"
]
hits_dtype
=
np
.
dtype
([(
"
pmt
"
,
"
u1
"
),
(
"
tdc
"
,
"
<u4
"
),
(
"
tot
"
,
"
u1
"
)])
hits_buffer
=
superframes
[
b
"
vector<KM3NETDAQ::JDAQSuperFrame>.buffer
"
].
lazyarray
(
uproot
.
asjagged
(
uproot
.
astable
(
uproot
.
asdtype
(
hits_dtype
)),
skipbytes
=
6
),
basketcache
=
uproot
.
cache
.
ThreadSafeArrayCache
(
TIMESLICE_FRAME_BASKET_CACHE_SIZE
),
)
self
.
_timeslices
[
stream
.
decode
(
"
ascii
"
)]
=
(
headers
,
superframes
,
hits_buffer
,
)
setattr
(
self
,
stream
.
decode
(
"
ascii
"
),
TimesliceStream
(
headers
,
superframes
,
hits_buffer
),
)
b
'
vector<KM3NETDAQ::JDAQSuperFrame>.buffer
'
].
lazyarray
(
uproot
.
asjagged
(
uproot
.
astable
(
uproot
.
asdtype
(
hits_dtype
)),
skipbytes
=
6
),
basketcache
=
uproot
.
cache
.
LRUArrayCache
(
TIMESLICE_FRAME_BASKET_CACHE_SIZE
))
self
.
_timeslices
[
stream
.
decode
(
"
ascii
"
)]
=
(
headers
,
superframes
,
hits_buffer
)
setattr
(
self
,
stream
.
decode
(
"
ascii
"
),
TimesliceStream
(
headers
,
superframes
,
hits_buffer
))
def
stream
(
self
,
stream
,
idx
):
ts
=
self
.
_timeslices
[
stream
]
...
...
@@ -317,7 +295,7 @@ class TimesliceStream:
# np.dtype([('a', 'i4'), ('b', 'i4'), ('c', 'i4'),
# ('d', 'i4'), ('e', 'i4')]))),
# skipbytes=6),
# basketcache=uproot.cache.
ThreadSafe
ArrayCache(
# basketcache=uproot.cache.
LRU
ArrayCache(
# TIMESLICE_FRAME_BASKET_CACHE_SIZE))
self
.
headers
=
headers
self
.
superframes
=
superframes
...
...
This diff is collapsed.
Click to expand it.
km3io/rootio.py
+
2
−
2
View file @
8332b510
...
...
@@ -6,8 +6,8 @@ import uproot4 as uproot
from
.tools
import
unfold_indices
# 110 MB based on the size of the largest basket found so far in km3net
BASKET_CACHE_SIZE
=
110
*
1024
**
2
BASKET_CACHE
=
uproot
.
cache
.
ThreadSafe
ArrayCache
(
BASKET_CACHE_SIZE
)
BASKET_CACHE_SIZE
=
110
*
1024
**
2
BASKET_CACHE
=
uproot
.
cache
.
LRU
ArrayCache
(
BASKET_CACHE_SIZE
)
class
BranchMapper
:
...
...
This diff is collapsed.
Click to expand it.
km3io/tools.py
+
2
−
2
View file @
8332b510
...
...
@@ -11,8 +11,8 @@ from km3io.definitions import w2list_genhen as kw2gen
from
km3io.definitions
import
w2list_gseagen
as
kw2gsg
# 110 MB based on the size of the largest basket found so far in km3net
BASKET_CACHE_SIZE
=
110
*
1024
**
2
BASKET_CACHE
=
uproot
.
cache
.
ThreadSafe
ArrayCache
(
BASKET_CACHE_SIZE
)
BASKET_CACHE_SIZE
=
110
*
1024
**
2
BASKET_CACHE
=
uproot
.
cache
.
LRU
ArrayCache
(
BASKET_CACHE_SIZE
)
class
cached_property
:
...
...
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