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
632f7aee
Commit
632f7aee
authored
4 years ago
by
Zineb Aly
Browse files
Options
Downloads
Patches
Plain Diff
comment old tests
parent
3df6826c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!45
Adapt best track root access
Pipeline
#14275
passed with warnings
4 years ago
Stage: test
Stage: coverage
Stage: doc
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_tools.py
+52
-51
52 additions, 51 deletions
tests/test_tools.py
with
52 additions
and
51 deletions
tests/test_tools.py
+
52
−
51
View file @
632f7aee
...
...
@@ -53,57 +53,58 @@ class TestRecoTypes(unittest.TestCase):
assert
"
JPP_RECONSTRUCTION_TYPE
"
in
keys
class
TestBestTrack
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
events
=
OFFLINE_FILE
.
events
self
.
one_event
=
OFFLINE_FILE
.
events
[
0
]
def
test_best_track_from_multiple_events
(
self
):
events
=
self
.
events
[
self
.
events
.
n_tracks
>
0
]
first_tracks
=
best_track
(
events
.
tracks
,
strategy
=
"
first
"
)
default_best
=
best_track
(
events
.
tracks
,
strategy
=
"
default
"
,
rec_type
=
"
JPP_RECONSTRUCTION_TYPE
"
)
assert
first_tracks
.
dir_z
[
0
]
==
events
.
tracks
.
dir_z
[
0
][
0
]
assert
first_tracks
.
dir_x
[
1
]
==
events
.
tracks
.
dir_x
[
1
][
0
]
assert
default_best
.
lik
[
0
]
==
ak
.
max
(
events
.
tracks
.
lik
[
0
])
assert
default_best
.
lik
[
1
]
==
ak
.
max
(
events
.
tracks
.
lik
[
1
])
assert
default_best
.
rec_type
[
0
]
==
4000
def
test_best_track_from_a_single_event
(
self
):
first_track
=
best_track
(
self
.
one_event
.
tracks
,
strategy
=
"
first
"
)
best
=
best_track
(
self
.
one_event
.
tracks
,
strategy
=
"
default
"
,
rec_type
=
"
JPP_RECONSTRUCTION_TYPE
"
)
assert
first_track
.
dir_z
==
self
.
one_event
.
tracks
.
dir_z
[
0
]
assert
first_track
.
lik
==
self
.
one_event
.
tracks
.
lik
[
0
]
assert
best
.
lik
==
ak
.
max
(
self
.
one_event
.
tracks
.
lik
)
assert
best
.
rec_type
==
4000
def
test_best_track_raises_when_unknown_strategy
(
self
):
with
self
.
assertRaises
(
ValueError
):
best_track
(
self
.
events
.
tracks
,
strategy
=
"
Zineb
"
)
def
test_best_track_raises_when_default_strategy_and_no_rectype
(
self
):
with
self
.
assertRaises
(
ValueError
):
best_track
(
self
.
events
.
tracks
)
def
test_best_track_on_slices
(
self
):
tracks_slice
=
self
.
one_event
.
tracks
[
self
.
one_event
.
tracks
.
rec_type
==
4000
]
first_track
=
best_track
(
tracks_slice
,
strategy
=
"
first
"
)
best
=
best_track
(
tracks_slice
,
strategy
=
"
default
"
,
rec_type
=
"
JPP_RECONSTRUCTION_TYPE
"
)
assert
first_track
.
dir_z
==
self
.
one_event
.
tracks
.
dir_z
[
0
]
assert
first_track
.
lik
==
self
.
one_event
.
tracks
.
lik
[
0
]
assert
best
.
lik
==
ak
.
max
(
self
.
one_event
.
tracks
.
lik
)
assert
best
.
rec_type
==
4000
# class TestBestTrack(unittest.TestCase):
# def setUp(self):
# self.events = OFFLINE_FILE.events
# self.one_event = OFFLINE_FILE.events[0]
# def test_best_track_from_multiple_events(self):
# events = self.events[self.events.n_tracks > 0]
# first_tracks = best_track(events.tracks, strategy="first")
# default_best = best_track(events.tracks,
# strategy="default",
# rec_type="JPP_RECONSTRUCTION_TYPE")
# assert first_tracks.dir_z[0] == events.tracks.dir_z[0][0]
# assert first_tracks.dir_x[1] == events.tracks.dir_x[1][0]
# assert default_best.lik[0] == ak.max(events.tracks.lik[0])
# assert default_best.lik[1] == ak.max(events.tracks.lik[1])
# assert default_best.rec_type[0] == 4000
# def test_best_track_from_a_single_event(self):
# first_track = best_track(self.one_event.tracks, strategy="first")
# best = best_track(self.one_event.tracks,
# strategy="default",
# rec_type="JPP_RECONSTRUCTION_TYPE")
# assert first_track.dir_z == self.one_event.tracks.dir_z[0]
# assert first_track.lik == self.one_event.tracks.lik[0]
# assert best.lik == ak.max(self.one_event.tracks.lik)
# assert best.rec_type == 4000
# def test_best_track_raises_when_unknown_strategy(self):
# with self.assertRaises(ValueError):
# best_track(self.events.tracks, strategy="Zineb")
# def test_best_track_raises_when_default_strategy_and_no_rectype(self):
# with self.assertRaises(ValueError):
# best_track(self.events.tracks)
# def test_best_track_on_slices(self):
# tracks_slice = self.one_event.tracks[self.one_event.tracks.rec_type ==
# 4000]
# first_track = best_track(tracks_slice, strategy="first")
# best = best_track(tracks_slice,
# strategy="default",
# rec_type="JPP_RECONSTRUCTION_TYPE")
# assert first_track.dir_z == self.one_event.tracks.dir_z[0]
# assert first_track.lik == self.one_event.tracks.lik[0]
# assert best.lik == ak.max(self.one_event.tracks.lik)
# assert best.rec_type == 4000
class
TestGetMultiplicity
(
unittest
.
TestCase
):
...
...
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