Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OrcaSong
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Machine Learning
OrcaSong
Commits
9e20d808
Commit
9e20d808
authored
6 years ago
by
Stefan Reck
Browse files
Options
Downloads
Patches
Plain Diff
More docs.
parent
edd6d2ea
No related branches found
No related tags found
No related merge requests found
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
orcasong_plag/mc_info_types.py
+11
-3
11 additions, 3 deletions
orcasong_plag/mc_info_types.py
orcasong_plag/modules.py
+25
-0
25 additions, 0 deletions
orcasong_plag/modules.py
orcasong_plag/util/binning_1d_visualizer.py
+2
-45
2 additions, 45 deletions
orcasong_plag/util/binning_1d_visualizer.py
with
38 additions
and
48 deletions
orcasong_plag/mc_info_types.py
+
11
−
3
View file @
9e20d808
...
...
@@ -6,16 +6,22 @@ in the h5 files.
import
numpy
as
np
def
get_mc_info_extr
(
mc_info_
type
):
def
get_mc_info_extr
(
mc_info_
extr
):
"""
Get an existing mc info extractor function.
Attributes
----------
mc_info_extr : function
Function to extract the info. Takes the blob as input, outputs
a dict with the desired mc_infos.
"""
if
mc_info_
type
==
"
mupage
"
:
if
mc_info_
extr
==
"
mupage
"
:
mc_info_extr
=
get_mupage_mc
else
:
raise
ValueError
(
"
Unknown mc_info_type
"
+
mc_info_
type
)
raise
ValueError
(
"
Unknown mc_info_type
"
+
mc_info_
extr
)
return
mc_info_extr
...
...
@@ -24,6 +30,8 @@ def get_mupage_mc(blob):
"""
For mupage muon simulations.
e.g. mcv5.1_r3.mupage_10G.km3_AAv1.jterbr00002800.5103.root.h5
Parameters
----------
blob : dict
...
...
This diff is collapsed.
Click to expand it.
orcasong_plag/modules.py
+
25
−
0
View file @
9e20d808
...
...
@@ -9,6 +9,15 @@ import numpy as np
class
McInfoMaker
(
kp
.
Module
):
"""
Get the desired mc_info from the blob.
Attributes
----------
mc_info_extr : function
Function to extract the info. Takes the blob as input, outputs
a dict with the desired mc_infos.
store_as : str
Store the mcinfo with this name in the blob.
"""
def
configure
(
self
):
self
.
mc_info_extr
=
self
.
require
(
'
mc_info_extr
'
)
...
...
@@ -34,6 +43,13 @@ class TimePreproc(kp.Module):
Time hits and mchits will be shifted by the time of the first
triggered hit.
Attributes
----------
correct_hits : bool
If true, will correct time of the hits.
correct_mchits : bool
If true, will correct the time of the McHits.
"""
def
configure
(
self
):
self
.
correct_hits
=
self
.
get
(
'
correct_hits
'
,
default
=
True
)
...
...
@@ -76,6 +92,15 @@ def time_preproc(blob, correct_hits=True, correct_mchits=True):
class
ImageMaker
(
kp
.
Module
):
"""
Make a n-d histogram from the blob.
Attributes
----------
bin_edges_list : List
List with the names of the fields to bin, and the respective bin edges,
including the left- and right-most bin edge.
store_as : str
Store the images with this name in the blob.
"""
def
configure
(
self
):
self
.
bin_edges_list
=
self
.
require
(
'
bin_edges_list
'
)
...
...
This diff is collapsed.
Click to expand it.
orcasong_plag/util/binning_1d_visualizer.py
+
2
−
45
View file @
9e20d808
...
...
@@ -14,6 +14,8 @@ import numpy as np
import
km3pipe
as
kp
import
matplotlib.pyplot
as
plt
from
orcasong_plag.modules
import
time_preproc
class
FieldPlotter
:
"""
...
...
@@ -337,51 +339,6 @@ class FieldPlotter:
return
"
<FieldPlotter: {}>
"
.
format
(
self
.
files
)
class
TimePreproc
(
kp
.
Module
):
"""
Preprocess the time in the blob.
t0 will be added to the time for real data, but not simulations.
Time hits and mchits will be shifted by the time of the first triggered hit.
"""
def
configure
(
self
):
self
.
correct_hits
=
self
.
get
(
'
correct_hits
'
,
default
=
True
)
self
.
correct_mchits
=
self
.
get
(
'
correct_mchits
'
,
default
=
True
)
def
process
(
self
,
blob
):
blob
=
time_preproc
(
blob
,
self
.
correct_hits
,
self
.
correct_mchits
)
return
blob
def
time_preproc
(
blob
,
correct_hits
=
True
,
correct_mchits
=
True
):
"""
Preprocess the time in the blob.
t0 will be added to the time for real data, but not simulations.
Time hits and mchits will be shifted by the time of the first triggered hit.
"""
hits_time
=
blob
[
"
Hits
"
].
time
if
"
McHits
"
not
in
blob
:
# add t0 only for real data, not sims
hits_t0
=
blob
[
"
Hits
"
].
t0
hits_time
=
np
.
add
(
hits_time
,
hits_t0
)
hits_triggered
=
blob
[
"
Hits
"
].
triggered
t_first_trigger
=
np
.
min
(
hits_time
[
hits_triggered
==
1
])
if
correct_hits
:
blob
[
"
Hits
"
].
time
=
np
.
subtract
(
hits_time
,
t_first_trigger
)
if
correct_mchits
:
mchits_time
=
blob
[
"
McHits
"
].
time
blob
[
"
McHits
"
].
time
=
np
.
subtract
(
mchits_time
,
t_first_trigger
)
return
blob
class
TimePlotter
(
FieldPlotter
):
"""
For plotting the time.
...
...
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