Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3BUU
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
simulation
KM3BUU
Commits
18fdac66
Commit
18fdac66
authored
8 months ago
by
Johannes Schumann
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_min_max_energy_field' into 'master'
Fix energy min/max fields See merge request
!90
parents
15e5a283
832fe942
No related branches found
No related tags found
1 merge request
!90
Fix energy min/max fields
Pipeline
#53331
passed
8 months ago
Stage: test
Stage: coverage
Stage: doc
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.rst
+2
-0
2 additions, 0 deletions
CHANGELOG.rst
km3buu/output.py
+12
-10
12 additions, 10 deletions
km3buu/output.py
km3buu/tests/test_output.py
+7
-1
7 additions, 1 deletion
km3buu/tests/test_output.py
with
21 additions
and
11 deletions
CHANGELOG.rst
+
2
−
0
View file @
18fdac66
Unreleased changes
Unreleased changes
------------------
------------------
* Use LRU in particle mass lookup
* Use LRU in particle mass lookup
* Increase tolerance for free particle cut as GiBUU uses 938MeV for proton and neutron
* Fix energy limit fields of GiBUUOutput
v1.8.1
v1.8.1
----------------------------
----------------------------
...
...
This diff is collapsed.
Click to expand it.
km3buu/output.py
+
12
−
10
View file @
18fdac66
...
@@ -54,7 +54,7 @@ XSECTION_FILENAMES = {"all": "neutrino_absorption_cross_section_ALL.dat"}
...
@@ -54,7 +54,7 @@ XSECTION_FILENAMES = {"all": "neutrino_absorption_cross_section_ALL.dat"}
SECONDS_PER_YEAR
=
365.25
*
24
*
60
*
60
SECONDS_PER_YEAR
=
365.25
*
24
*
60
*
60
SECONDS_WEIGHT_TIMESPAN
=
1
SECONDS_WEIGHT_TIMESPAN
=
1
FREE_PARTICLE_TOLERANCE
=
1
# tolerance of the particle restmass for free particle cuts [
k
eV]
FREE_PARTICLE_TOLERANCE
=
3
# tolerance of the particle restmass for free particle cuts [
M
eV]
PARTICLE_COLUMNS
=
[
"
E
"
,
"
Px
"
,
"
Py
"
,
"
Pz
"
,
"
x
"
,
"
y
"
,
"
z
"
,
"
barcode
"
]
PARTICLE_COLUMNS
=
[
"
E
"
,
"
Px
"
,
"
Py
"
,
"
Pz
"
,
"
x
"
,
"
y
"
,
"
z
"
,
"
barcode
"
]
EVENTINFO_COLUMNS
=
[
EVENTINFO_COLUMNS
=
[
...
@@ -236,8 +236,8 @@ class GiBUUOutput:
...
@@ -236,8 +236,8 @@ class GiBUUOutput:
self
.
_read_jobcard
()
self
.
_read_jobcard
()
self
.
flux_data
=
None
self
.
flux_data
=
None
self
.
_
min_
energy
=
np
.
nan
self
.
_energy
_min
=
np
.
nan
self
.
_
max_
energy
=
np
.
nan
self
.
_energy
_max
=
np
.
nan
self
.
_written_events
=
len
(
self
.
_get_raw_arrays
())
self
.
_written_events
=
len
(
self
.
_get_raw_arrays
())
self
.
_generated_events
=
-
1
self
.
_generated_events
=
-
1
self
.
_flux_index
=
np
.
nan
self
.
_flux_index
=
np
.
nan
...
@@ -283,8 +283,8 @@ class GiBUUOutput:
...
@@ -283,8 +283,8 @@ class GiBUUOutput:
if
np
.
std
(
energies
)
>
1e-10
:
if
np
.
std
(
energies
)
>
1e-10
:
raise
NotImplementedError
(
raise
NotImplementedError
(
"
Energy not constant; run data cannot be interpreted
"
)
"
Energy not constant; run data cannot be interpreted
"
)
self
.
_
min_
energy
=
np
.
mean
(
energies
)
self
.
_energy
_min
=
np
.
mean
(
energies
)
self
.
_
max_
energy
=
self
.
_max_energy
self
.
_energy
_max
=
self
.
_max_energy
num_ensembles
=
int
(
self
.
jobcard
[
"
input
"
][
"
numensembles
"
])
num_ensembles
=
int
(
self
.
jobcard
[
"
input
"
][
"
numensembles
"
])
num_runs
=
int
(
self
.
jobcard
[
"
input
"
][
"
num_runs_sameenergy
"
])
num_runs
=
int
(
self
.
jobcard
[
"
input
"
][
"
num_runs_sameenergy
"
])
self
.
_generated_events
=
num_ensembles
*
num_runs
self
.
_generated_events
=
num_ensembles
*
num_runs
...
@@ -303,8 +303,10 @@ class GiBUUOutput:
...
@@ -303,8 +303,10 @@ class GiBUUOutput:
self
.
flux_interpolation
=
UnivariateSpline
(
self
.
flux_data
[
"
energy
"
],
self
.
flux_interpolation
=
UnivariateSpline
(
self
.
flux_data
[
"
energy
"
],
self
.
flux_data
[
"
events
"
],
self
.
flux_data
[
"
events
"
],
s
=
0
)
s
=
0
)
self
.
_energy_min
=
np
.
min
(
self
.
flux_data
[
"
energy
"
])
self
.
_energy_min
=
np
.
min
(
self
.
_energy_max
=
np
.
max
(
self
.
flux_data
[
"
energy
"
])
self
.
flux_data
[
"
energy
"
][
self
.
flux_data
[
"
events
"
]
>
0
])
self
.
_energy_max
=
np
.
max
(
self
.
flux_data
[
"
energy
"
][
self
.
flux_data
[
"
events
"
]
>
0
])
self
.
_generated_events
=
int
(
np
.
sum
(
self
.
flux_data
[
"
events
"
]))
self
.
_generated_events
=
int
(
np
.
sum
(
self
.
flux_data
[
"
events
"
]))
return
True
return
True
...
@@ -590,11 +592,11 @@ class GiBUUOutput:
...
@@ -590,11 +592,11 @@ class GiBUUOutput:
@property
@property
def
energy_min
(
self
):
def
energy_min
(
self
):
return
self
.
_
min_
energy
return
self
.
_energy
_min
@property
@property
def
energy_max
(
self
):
def
energy_max
(
self
):
return
self
.
_
max_
energy
return
self
.
_energy
_max
@property
@property
def
generated_events
(
self
):
def
generated_events
(
self
):
...
@@ -869,7 +871,7 @@ def write_detector_file(gibuu_output,
...
@@ -869,7 +871,7 @@ def write_detector_file(gibuu_output,
####################
####################
# Target
# Target
####################
####################
nucleonpdgid
=
2112
+
100
*
event
.
nuc_charge
nucleonpdgid
=
2112
+
100
*
int
(
event
.
nuc_charge
)
# Nucleus
# Nucleus
tgt_trk
=
ROOT
.
Trk
()
tgt_trk
=
ROOT
.
Trk
()
tgt_trk
.
id
=
mc_trk_id
tgt_trk
.
id
=
mc_trk_id
...
...
This diff is collapsed.
Click to expand it.
km3buu/tests/test_output.py
+
7
−
1
View file @
18fdac66
...
@@ -94,7 +94,7 @@ class TestGiBUUOutput(unittest.TestCase):
...
@@ -94,7 +94,7 @@ class TestGiBUUOutput(unittest.TestCase):
def
test_global_generation_weight
(
self
):
def
test_global_generation_weight
(
self
):
self
.
assertAlmostEqual
(
self
.
output
.
global_generation_weight
(
4
*
np
.
pi
),
self
.
assertAlmostEqual
(
self
.
output
.
global_generation_weight
(
4
*
np
.
pi
),
251
3.2765713094464
,
251
1.9430994057193
,
places
=
2
)
places
=
2
)
def
test_event_values
(
self
):
def
test_event_values
(
self
):
...
@@ -117,6 +117,12 @@ class TestGiBUUOutput(unittest.TestCase):
...
@@ -117,6 +117,12 @@ class TestGiBUUOutput(unittest.TestCase):
rh_prob
=
GiBUUOutput
.
right_helicity_probability
(
arr
)
rh_prob
=
GiBUUOutput
.
right_helicity_probability
(
arr
)
np
.
testing
.
assert_array_almost_equal
(
rh_prob
[:
3
],
[
0.0
,
0.0
,
0.0
])
np
.
testing
.
assert_array_almost_equal
(
rh_prob
[:
3
],
[
0.0
,
0.0
,
0.0
])
def
test_min_max_energy
(
self
):
assert
not
np
.
isnan
(
self
.
output
.
energy_min
)
assert
not
np
.
isnan
(
self
.
output
.
energy_max
)
np
.
testing
.
assert_array_almost_equal
(
self
.
output
.
energy_min
,
0.11
)
np
.
testing
.
assert_array_almost_equal
(
self
.
output
.
energy_max
,
49.99
)
@pytest.mark.skipif
(
not
KM3NET_LIB_AVAILABLE
,
@pytest.mark.skipif
(
not
KM3NET_LIB_AVAILABLE
,
reason
=
"
KM3NeT dataformat required
"
)
reason
=
"
KM3NeT dataformat required
"
)
...
...
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