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
b739c0b2
Commit
b739c0b2
authored
3 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Fix type and add jobcard tests
parent
9b00218e
No related branches found
No related tags found
1 merge request
!10
Single energy runs
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3buu/jobcard.py
+1
-1
1 addition, 1 deletion
km3buu/jobcard.py
km3buu/tests/test_jobcard.py
+35
-1
35 additions, 1 deletion
km3buu/tests/test_jobcard.py
with
36 additions
and
2 deletions
km3buu/jobcard.py
+
1
−
1
View file @
b739c0b2
...
...
@@ -150,7 +150,7 @@ def generate_neutrino_jobcard(events,
jc
[
"
nl_neutrino_energyflux
"
][
"
eflux_min
"
]
=
energy
[
0
]
jc
[
"
nl_neutrino_energyflux
"
][
"
eflux_max
"
]
=
energy
[
1
]
else
:
jc
[
"
nl_sigma
n
c
"
][
"
enu
"
]
=
energy
jc
[
"
nl_sigma
m
c
"
][
"
enu
"
]
=
energy
# DECAY
if
do_decay
:
for
i
in
DECAYED_HADRONS
:
...
...
This diff is collapsed.
Click to expand it.
km3buu/tests/test_jobcard.py
+
35
−
1
View file @
b739c0b2
...
...
@@ -45,7 +45,7 @@ class TestJobcard(unittest.TestCase):
assert
ctnt
.
find
(
expected_line
)
==
-
1
class
TestNeutrinoJobcard
(
unittest
.
TestCase
):
class
TestNeutrino
EnergyRange
Jobcard
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
test_fluxfile
=
TemporaryFile
()
self
.
test_Z
=
np
.
random
.
randint
(
1
,
100
)
...
...
@@ -93,3 +93,37 @@ class TestNeutrinoJobcard(unittest.TestCase):
def
test_photon_propagation_flag
(
self
):
self
.
assertEqual
(
self
.
test_jobcard
[
"
insertion
"
][
"
propagateNoPhoton
"
],
not
self
.
photon_propagation_flag
)
class
TestNeutrinoSingleEnergyJobcard
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
test_fluxfile
=
TemporaryFile
()
self
.
test_Z
=
np
.
random
.
randint
(
1
,
100
)
self
.
test_A
=
np
.
random
.
randint
(
self
.
test_Z
,
100
)
self
.
test_energy
=
np
.
random
.
uniform
(
0.0
,
100.0
)
self
.
photon_propagation_flag
=
np
.
random
.
choice
([
True
,
False
])
self
.
do_decay
=
np
.
random
.
choice
([
True
,
False
])
self
.
test_jobcard
=
generate_neutrino_jobcard
(
1000
,
"
CC
"
,
"
electron
"
,
self
.
test_energy
,
(
self
.
test_Z
,
self
.
test_A
),
do_decay
=
self
.
do_decay
,
photon_propagation
=
self
.
photon_propagation_flag
,
fluxfile
=
self
.
test_fluxfile
.
name
,
input_path
=
"
/test
"
)
def
test_input_path
(
self
):
self
.
assertEqual
(
"
/test
"
,
self
.
test_jobcard
[
"
input
"
][
"
path_to_input
"
])
def
test_target
(
self
):
self
.
assertEqual
(
self
.
test_Z
,
self
.
test_jobcard
[
"
target
"
][
"
target_Z
"
])
self
.
assertEqual
(
self
.
test_A
,
self
.
test_jobcard
[
"
target
"
][
"
target_A
"
])
def
test_energy
(
self
):
self
.
assertAlmostEqual
(
self
.
test_energy
,
self
.
test_jobcard
[
"
nl_sigmamc
"
][
"
enu
"
])
def
test_photon_propagation_flag
(
self
):
self
.
assertEqual
(
self
.
test_jobcard
[
"
insertion
"
][
"
propagateNoPhoton
"
],
not
self
.
photon_propagation_flag
)
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