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
f62e97f5
Commit
f62e97f5
authored
4 years ago
by
Zineb Aly
Browse files
Options
Downloads
Patches
Plain Diff
test best track
parent
e1756439
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
+26
-6
26 additions, 6 deletions
tests/test_offline.py
with
26 additions
and
6 deletions
tests/test_offline.py
+
26
−
6
View file @
f62e97f5
...
...
@@ -4,12 +4,15 @@ import awkward1 as ak1
from
pathlib
import
Path
from
km3io
import
OfflineReader
from
km3io.offline
import
_nested_mapper
,
Header
,
fitinf
,
fitparams
,
count_nested
,
_find
,
mask
from
km3io.offline
import
_nested_mapper
,
Header
,
fitinf
,
fitparams
,
count_nested
,
_find
,
mask
,
best_track
SAMPLES_DIR
=
Path
(
__file__
).
parent
/
'
samples
'
OFFLINE_FILE
=
OfflineReader
(
SAMPLES_DIR
/
'
aanet_v2.0.0.root
'
)
OFFLINE_USR
=
OfflineReader
(
SAMPLES_DIR
/
'
usr-sample.root
'
)
OFFLINE_MC_TRACK_USR
=
OfflineReader
(
SAMPLES_DIR
/
'
mcv5.11r2.gsg_muonCChigherE-CC_50-5000GeV.km3_AAv1.jterbr00004695.jchain.aanet.498.root
'
)
OFFLINE_MC_TRACK_USR
=
OfflineReader
(
SAMPLES_DIR
/
'
mcv5.11r2.gsg_muonCChigherE-CC_50-5000GeV.km3_AAv1.jterbr00004695.jchain.aanet.498.root
'
)
OFFLINE_NUMUCC
=
OfflineReader
(
SAMPLES_DIR
/
"
numucc.root
"
)
# with mc data
...
...
@@ -38,6 +41,21 @@ class TestFitinf(unittest.TestCase):
assert
"
JGANDALF_BETA0_RAD
"
in
keys
class
TestBestTrack
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
tracks
=
OFFLINE_FILE
.
events
.
tracks
def
test_best_tracks
(
self
):
first_tracks
=
best_track
(
self
.
tracks
,
strategy
=
"
first
"
)
rec_stages_tracks
=
best_track
(
self
.
tracks
,
strategy
=
"
rec_stages
"
,
rec_stages
=
[
1
,
3
,
5
,
4
])
assert
first_tracks
.
dir_z
[
0
]
==
self
.
tracks
.
dir_z
[
0
][
0
]
assert
first_tracks
.
dir_x
[
1
]
==
self
.
tracks
.
dir_x
[
1
][
0
]
assert
rec_stages_tracks
.
rec_stages
[
0
]
==
[
1
,
3
,
5
,
4
]
class
TestCountNested
(
unittest
.
TestCase
):
def
test_count_nested
(
self
):
fit
=
OFFLINE_FILE
.
events
.
tracks
.
fitinf
...
...
@@ -442,10 +460,12 @@ class TestMcTrackUsr(unittest.TestCase):
def
test_usr_names
(
self
):
n_tracks
=
len
(
self
.
f
.
events
)
for
i
in
range
(
3
):
self
.
assertListEqual
([
b
'
bx
'
,
b
'
by
'
,
b
'
ichan
'
,
b
'
cc
'
],
self
.
f
.
events
.
mc_tracks
.
usr_names
[
i
][
0
].
tolist
())
self
.
assertListEqual
([
b
'
energy_lost_in_can
'
],
self
.
f
.
events
.
mc_tracks
.
usr_names
[
i
][
1
].
tolist
())
self
.
assertListEqual
(
[
b
'
bx
'
,
b
'
by
'
,
b
'
ichan
'
,
b
'
cc
'
],
self
.
f
.
events
.
mc_tracks
.
usr_names
[
i
][
0
].
tolist
())
self
.
assertListEqual
(
[
b
'
energy_lost_in_can
'
],
self
.
f
.
events
.
mc_tracks
.
usr_names
[
i
][
1
].
tolist
())
def
test_usr
(
self
):
assert
np
.
allclose
([
0.0487
,
0.0588
,
3
,
2
],
...
...
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