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
157ce85c
Commit
157ce85c
authored
4 years ago
by
Zineb Aly
Browse files
Options
Downloads
Patches
Plain Diff
add tests
parent
9c3b102a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_offline.py
+17
-1
17 additions, 1 deletion
tests/test_offline.py
with
17 additions
and
1 deletion
tests/test_offline.py
+
17
−
1
View file @
157ce85c
import
unittest
import
numpy
as
np
import
awkward1
as
ak1
from
pathlib
import
Path
from
km3io
import
OfflineReader
from
km3io.offline
import
_nested_mapper
,
Header
,
fitinf
,
fitparams
from
km3io.offline
import
_nested_mapper
,
Header
,
fitinf
,
fitparams
,
count_nested
SAMPLES_DIR
=
Path
(
__file__
).
parent
/
'
samples
'
OFFLINE_FILE
=
OfflineReader
(
SAMPLES_DIR
/
'
aanet_v2.0.0.root
'
)
...
...
@@ -15,19 +16,34 @@ class TestFitinf(unittest.TestCase):
def
setUp
(
self
):
self
.
tracks
=
OFFLINE_FILE
.
events
.
tracks
self
.
fit
=
self
.
tracks
.
fitinf
self
.
best
=
self
.
tracks
[:,
0
]
self
.
best_fit
=
self
.
best
.
fitinf
def
test_fitinf
(
self
):
beta
=
fitinf
(
'
JGANDALF_BETA0_RAD
'
,
self
.
tracks
)
best_beta
=
fitinf
(
'
JGANDALF_BETA0_RAD
'
,
self
.
best
)
assert
beta
[
0
][
0
]
==
self
.
fit
[
0
][
0
][
0
]
assert
beta
[
0
][
1
]
==
self
.
fit
[
0
][
1
][
0
]
assert
beta
[
0
][
2
]
==
self
.
fit
[
0
][
2
][
0
]
assert
best_beta
[
0
]
==
self
.
best_fit
[
0
][
0
]
assert
best_beta
[
1
]
==
self
.
best_fit
[
1
][
0
]
assert
best_beta
[
2
]
==
self
.
best_fit
[
2
][
0
]
def
test_fitparams
(
self
):
keys
=
set
(
fitparams
())
assert
"
JGANDALF_BETA0_RAD
"
in
keys
class
TestCountNested
(
unittest
.
TestCase
):
def
test_count_nested
(
self
):
fit
=
OFFLINE_FILE
.
events
.
tracks
.
fitinf
assert
count_nested
(
fit
,
axis
=
0
)
==
10
assert
count_nested
(
fit
,
axis
=
1
)[
0
:
4
]
==
ak1
.
Array
([
56
,
55
,
56
,
56
])
assert
count_nested
(
fit
,
axis
=
2
)[
0
][
0
:
4
]
==
ak1
.
Array
([
17
,
11
,
8
,
8
])
class
TestOfflineReader
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
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