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
d9c2d4d6
Commit
d9c2d4d6
authored
1 year ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Flux Index Fit
parent
0ece0087
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!63
Flux Index Fit
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.rst
+1
-0
1 addition, 0 deletions
CHANGELOG.rst
km3buu/output.py
+19
-13
19 additions, 13 deletions
km3buu/output.py
km3buu/tests/test_output.py
+1
-1
1 addition, 1 deletion
km3buu/tests/test_output.py
with
21 additions
and
14 deletions
CHANGELOG.rst
+
1
−
0
View file @
d9c2d4d6
Unreleased changes
------------------
* Improved curve for flux index
v1.1.2
----------------------------
...
...
This diff is collapsed.
Click to expand it.
km3buu/output.py
+
19
−
13
View file @
d9c2d4d6
...
...
@@ -16,7 +16,7 @@ import re
import
numpy
as
np
from
io
import
StringIO
from
os
import
listdir
,
environ
from
os.path
import
isfile
,
join
,
abspath
from
os.path
import
isfile
,
join
,
abspath
,
exists
from
tempfile
import
TemporaryDirectory
import
awkward
as
ak
import
uproot
...
...
@@ -237,10 +237,9 @@ class GiBUUOutput:
self
.
_generated_events
=
-
1
self
.
_flux_index
=
np
.
nan
try
:
self
.
_read_flux_file
()
if
self
.
_read_flux_file
():
self
.
_determine_flux_index
()
e
xcept
OSError
:
e
lse
:
self
.
_read_single_energy
()
def
_read_root_output
(
self
):
...
...
@@ -285,6 +284,8 @@ class GiBUUOutput:
def
_read_flux_file
(
self
):
fpath
=
join
(
self
.
_data_path
,
FLUXDESCR_FILENAME
)
if
not
exists
(
fpath
):
return
False
self
.
flux_data
=
np
.
loadtxt
(
fpath
,
dtype
=
FLUX_INFORMATION_DTYPE
,
usecols
=
(
...
...
@@ -297,6 +298,7 @@ class GiBUUOutput:
self
.
_energy_min
=
np
.
min
(
self
.
flux_data
[
"
energy
"
])
self
.
_energy_max
=
np
.
max
(
self
.
flux_data
[
"
energy
"
])
self
.
_generated_events
=
int
(
np
.
sum
(
self
.
flux_data
[
"
events
"
]))
return
True
def
_event_xsec
(
self
,
root_tupledata
):
weights
=
np
.
array
(
root_tupledata
.
weight
)
...
...
@@ -550,15 +552,19 @@ class GiBUUOutput:
def
fluxfunc
(
x
,
a
,
b
):
return
a
*
x
**
b
lower_limit
=
np
.
exp
(
np
.
log
(
np
.
max
(
self
.
flux_data
[
"
flux
"
]))
*
0.2
)
upper_limit
=
np
.
exp
(
np
.
log
(
np
.
max
(
self
.
flux_data
[
"
flux
"
]))
*
0.8
)
mask
=
(
self
.
flux_data
[
"
flux
"
]
>
lower_limit
)
&
(
self
.
flux_data
[
"
flux
"
]
<
upper_limit
)
popt
,
pcov
=
curve_fit
(
fluxfunc
,
self
.
flux_data
[
"
energy
"
][
mask
],
self
.
flux_data
[
"
flux
"
][
mask
],
p0
=
[
1
,
-
1
])
self
.
_flux_index
=
popt
[
1
]
energy_mask
=
self
.
flux_data
[
"
flux
"
]
>
0
lower_limit
=
np
.
min
(
self
.
flux_data
[
"
energy
"
][
energy_mask
])
*
1.2
upper_limit
=
np
.
max
(
self
.
flux_data
[
"
energy
"
][
energy_mask
])
*
0.8
mask
=
(
self
.
flux_data
[
"
energy
"
]
>
lower_limit
)
&
(
self
.
flux_data
[
"
energy
"
]
<
upper_limit
)
try
:
popt
,
pcov
=
curve_fit
(
fluxfunc
,
self
.
flux_data
[
"
energy
"
][
mask
],
self
.
flux_data
[
"
flux
"
][
mask
],
p0
=
[
1
,
-
1
])
self
.
_flux_index
=
popt
[
1
]
except
:
self
.
_flux_index
=
np
.
nan
@property
def
flux_index
(
self
):
...
...
This diff is collapsed.
Click to expand it.
km3buu/tests/test_output.py
+
1
−
1
View file @
d9c2d4d6
...
...
@@ -77,7 +77,7 @@ class TestGiBUUOutput(unittest.TestCase):
assert
self
.
output
.
A
==
16
def
test_flux_index
(
self
):
assert
np
.
isclose
(
self
.
output
.
flux_index
,
-
0.00
4812255
,
rtol
=
1e-3
)
assert
np
.
isclose
(
self
.
output
.
flux_index
,
-
0.00
576924
,
rtol
=
1e-3
)
def
test_w2weights
(
self
):
w2
=
self
.
output
.
w2weights
(
123.0
,
2.6e28
,
4
*
np
.
pi
)
...
...
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