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
32d98a68
Commit
32d98a68
authored
4 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Missing status and mother_id in offline reader"
parent
ac48ca1f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.rst
+2
-0
2 additions, 0 deletions
CHANGELOG.rst
km3io/offline.py
+2
-2
2 additions, 2 deletions
km3io/offline.py
tests/test_offline.py
+19
-0
19 additions, 0 deletions
tests/test_offline.py
with
23 additions
and
2 deletions
CHANGELOG.rst
+
2
−
0
View file @
32d98a68
Unreleased changes
------------------
* ``km3net-dataformat`` updated to 2.0.0
* mother ID and status are now read out for MC tracks
Version 0
---------
0.20.0 / 2021-02-18
~~~~~~~~~~~~~~~~~~~
* The fields ``.tdc``, ``.pos_{xyz}`` and ``.dir_{xyz}`` in ``.hits`` are
...
...
This diff is collapsed.
Click to expand it.
km3io/offline.py
+
2
−
2
View file @
32d98a68
...
...
@@ -79,8 +79,8 @@ class OfflineReader(EventReader):
"
E
"
:
"
mc_trks.E
"
,
"
t
"
:
"
mc_trks.t
"
,
"
len
"
:
"
mc_trks.len
"
,
#
"status": "mc_trks.status",
# TODO: check this
#
"mother_id": "mc_trks.mother_id",
# TODO: check this
"
status
"
:
"
mc_trks.status
"
,
"
mother_id
"
:
"
mc_trks.mother_id
"
,
"
pdgid
"
:
"
mc_trks.type
"
,
"
hit_ids
"
:
"
mc_trks.hit_ids
"
,
"
usr
"
:
"
mc_trks.usr
"
,
# TODO: trouble with uproot4
...
...
This diff is collapsed.
Click to expand it.
tests/test_offline.py
+
19
−
0
View file @
32d98a68
...
...
@@ -18,6 +18,9 @@ OFFLINE_MC_TRACK_USR = OfflineReader(
)
)
OFFLINE_NUMUCC
=
OfflineReader
(
data_path
(
"
offline/numucc.root
"
))
# with mc data
OFFLINE_MC_TRACK
=
OfflineReader
(
data_path
(
"
gseagen/gseagen_v7.0.0_numuCC_diffuse.aa.root
"
)
)
class
TestOfflineReader
(
unittest
.
TestCase
):
...
...
@@ -412,7 +415,11 @@ class TestOfflineTracks(unittest.TestCase):
self
.
f
=
OFFLINE_FILE
self
.
tracks
=
OFFLINE_FILE
.
events
.
tracks
self
.
tracks_numucc
=
OFFLINE_NUMUCC
self
.
mc_tracks
=
OFFLINE_MC_TRACK
.
mc_tracks
self
.
mc_tracks_old
=
OFFLINE_MC_TRACK_USR
.
mc_tracks
self
.
n_events
=
10
self
.
status
=
[
100
,
5
,
11
,
15
,
1
,
12
,
12
,
12
,
12
,
12
]
self
.
mother_id
=
[
-
1
,
-
1
,
1
,
1
,
0
,
2
,
5
,
5
,
6
,
8
]
def
test_fields
(
self
):
for
field
in
[
...
...
@@ -433,6 +440,18 @@ class TestOfflineTracks(unittest.TestCase):
]:
getattr
(
self
.
tracks
,
field
)
def
test_status
(
self
):
assert
np
.
allclose
(
self
.
status
,
self
.
mc_tracks
[
1
].
status
[:
10
].
tolist
())
def
test_mother_id
(
self
):
assert
np
.
allclose
(
self
.
mother_id
,
self
.
mc_tracks
[
1
].
mother_id
[:
10
].
tolist
())
def
test_attribute_error_raised_for_older_files
(
self
):
with
self
.
assertRaises
(
AttributeError
):
self
.
mc_tracks_old
[
1
].
mother_id
with
self
.
assertRaises
(
AttributeError
):
self
.
mc_tracks_old
[
1
].
status
def
test_item_selection
(
self
):
self
.
assertListEqual
(
list
(
self
.
tracks
[
0
].
dir_z
[:
2
]),
[
-
0.872885221293917
,
-
0.872885221293917
]
...
...
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