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
d4997d63
Commit
d4997d63
authored
4 years ago
by
Zineb Aly
Browse files
Options
Downloads
Patches
Plain Diff
make yapf
parent
0a92e8c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#12603
passed with warnings
4 years ago
Stage: test
Stage: coverage
Stage: doc
Stage: release
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3io/tools.py
+1
-1
1 addition, 1 deletion
km3io/tools.py
tests/test_tools.py
+5
-2
5 additions, 2 deletions
tests/test_tools.py
with
6 additions
and
3 deletions
km3io/tools.py
+
1
−
1
View file @
d4997d63
...
...
@@ -306,7 +306,7 @@ def best_track(events, strategy="default", rec_type=None, rec_stages=None):
raise
ValueError
(
"
{} not in {}
"
.
format
(
strategy
,
options
))
n_events
=
len
(
events
)
if
n_events
>
1
and
any
(
events
.
n_tracks
==
0
):
if
n_events
>
1
and
any
(
events
.
n_tracks
==
0
):
raise
ValueError
(
"'
events
'
should not contain empty tracks. Consider applying the mask: events.n_tracks>0
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_tools.py
+
5
−
2
View file @
d4997d63
...
...
@@ -8,7 +8,8 @@ from pathlib import Path
from
km3io
import
OfflineReader
from
km3io.tools
import
(
to_num
,
cached_property
,
unfold_indices
,
unique
,
uniquecount
,
fitinf
,
fitparams
,
count_nested
,
_find
,
mask
,
best_track
,
rec_types
,
get_w2list_param
,
get_multiplicity
)
mask
,
best_track
,
rec_types
,
get_w2list_param
,
get_multiplicity
)
SAMPLES_DIR
=
Path
(
__file__
).
parent
/
'
samples
'
OFFLINE_FILE
=
OfflineReader
(
SAMPLES_DIR
/
'
km3net_offline.root
'
)
...
...
@@ -90,11 +91,13 @@ class TestBestTrack(unittest.TestCase):
class
TestGetMultiplicity
(
unittest
.
TestCase
):
def
test_get_multiplicity
(
self
):
rec_stages_tracks
=
get_multiplicity
(
OFFLINE_FILE
.
events
.
tracks
,
[
1
,
3
,
5
,
4
])
rec_stages_tracks
=
get_multiplicity
(
OFFLINE_FILE
.
events
.
tracks
,
[
1
,
3
,
5
,
4
])
assert
rec_stages_tracks
.
rec_stages
[
0
]
==
[
1
,
3
,
5
,
4
]
assert
rec_stages_tracks
.
rec_stages
[
1
]
==
[
1
,
3
,
5
,
4
]
class
TestCountNested
(
unittest
.
TestCase
):
def
test_count_nested
(
self
):
fit
=
OFFLINE_FILE
.
events
.
tracks
.
fitinf
...
...
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