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
Merge requests
!18
Allow disabling numba jitted functions
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Allow disabling numba jitted functions
numba-optional
into
master
Overview
1
Commits
2
Pipelines
2
Changes
3
Merged
Tamas Gal
requested to merge
numba-optional
into
master
5 years ago
Overview
1
Commits
2
Pipelines
2
Changes
3
Expand
0
0
Merge request reports
Compare
master
version 1
9ba0c612
5 years ago
master (base)
and
latest version
latest version
12aae6c7
2 commits,
5 years ago
version 1
9ba0c612
1 commit,
5 years ago
3 files
+
40
−
11
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
km3io/daq.py
+
22
−
11
Options
import
os
import
uproot
import
numpy
as
np
import
numba
as
nb
if
os
.
getenv
(
"
DISABLE_NUMBA
"
):
print
(
"
Numba is disabled, DAQ helper functions will not work!
"
)
# A hack to to get the @vectorize, @guvectorize and nb.types silently pass.
def
dummy_decorator
(
*
args
,
**
kwargs
):
def
decorator
(
f
):
def
wrapper
(
*
args
,
**
kwargs
):
return
dummy_decorator
(
*
args
,
**
kwargs
)
return
wrapper
return
decorator
vectorize
=
dummy_decorator
guvectorize
=
dummy_decorator
int8
=
int16
=
int32
=
int64
=
dummy_decorator
else
:
from
numba
import
vectorize
,
guvectorize
,
int8
,
int16
,
int32
,
int64
TIMESLICE_FRAME_BASKET_CACHE_SIZE
=
523
*
1024
**
2
# [byte]
SUMMARYSLICE_FRAME_BASKET_CACHE_SIZE
=
523
*
1024
**
2
# [byte]
@@ -16,12 +32,7 @@ RATE_FACTOR = np.log(MAXIMAL_RATE_HZ / MINIMAL_RATE_HZ) / 255
CHANNEL_BITS_TEMPLATE
=
np
.
zeros
(
31
,
dtype
=
bool
)
@nb.vectorize
([
nb
.
int32
(
nb
.
int8
),
nb
.
int32
(
nb
.
int16
),
nb
.
int32
(
nb
.
int32
),
nb
.
int32
(
nb
.
int64
)
])
@vectorize
([
int32
(
int8
),
int32
(
int16
),
int32
(
int32
),
int32
(
int64
)])
def
get_rate
(
value
):
#pragma: no cover
"""
Return the rate in Hz from the short int value
"""
if
value
==
0
:
@@ -30,10 +41,10 @@ def get_rate(value): #pragma: no cover
return
MINIMAL_RATE_HZ
*
np
.
exp
(
value
*
RATE_FACTOR
)
@
nb.
guvectorize
(
"
void(i8, b1[:], b1[:])
"
,
"
(), (n) -> (n)
"
,
target
=
"
parallel
"
,
nopython
=
True
)
@guvectorize
(
"
void(i8, b1[:], b1[:])
"
,
"
(), (n) -> (n)
"
,
target
=
"
parallel
"
,
nopython
=
True
)
def
unpack_bits
(
value
,
bits_template
,
out
):
#pragma: no cover
"""
Return a boolean array for a value
'
s bit representation.
Loading