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
af27859b
Commit
af27859b
authored
4 years ago
by
Zineb Aly
Browse files
Options
Downloads
Patches
Plain Diff
add fitparams function
parent
fb2aa560
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
km3io/offline.py
+29
-1
29 additions, 1 deletion
km3io/offline.py
with
29 additions
and
1 deletion
km3io/offline.py
+
29
−
1
View file @
af27859b
from
collections
import
namedtuple
import
uproot
import
warnings
from
.definitions
import
mc_header
import
awkward1
as
ak1
from
.definitions
import
mc_header
,
fitparameters
from
.tools
import
Branch
,
BranchMapper
,
cached_property
,
_to_num
,
_unfold_indices
MAIN_TREE_NAME
=
"
E
"
...
...
@@ -17,6 +18,33 @@ def _nested_mapper(key):
return
'
_
'
.
join
(
key
.
split
(
'
.
'
)[
1
:])
def
fitinf
(
fitparam
,
tracks
):
"""
Access fit parameters in tracks.fitinf.
Parameters
----------
fitparam : str
the fit parameter name according to fitparameters defined in
km3net-dataformat.
tracks : class km3io.offline.OfflineBranch
the tracks class .
Returns
-------
awkward array
awkward array of the fit parameters.
"""
fit
=
tracks
.
fitinf
counts
=
ak1
.
Array
([
ak1
.
num
(
i
,
axis
=
1
)
for
i
in
fit
])
index
=
fitparameters
[
fitparam
]
params
=
fit
[
counts
>
index
]
return
ak1
.
Array
([
i
[:,
index
]
for
i
in
params
])
def
fitparams
():
return
fitparameters
.
keys
()
EVENTS_MAP
=
BranchMapper
(
name
=
"
events
"
,
key
=
"
Evt
"
,
extra
=
{
...
...
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