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
f1e6744c
Commit
f1e6744c
authored
3 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Plain Diff
Merge branch 'randomseed' into 'master'
Random Generator Seed See merge request
!13
parents
159590d2
6bd94feb
No related branches found
No related tags found
1 merge request
!13
Random Generator Seed
Pipeline
#22417
passed with warnings
3 years ago
Stage: test
Stage: coverage
Stage: doc
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3buu/jobcard.py
+5
-0
5 additions, 0 deletions
km3buu/jobcard.py
km3buu/tests/test_jobcard.py
+23
-1
23 additions, 1 deletion
km3buu/tests/test_jobcard.py
with
28 additions
and
1 deletion
km3buu/jobcard.py
+
5
−
0
View file @
f1e6744c
...
@@ -104,6 +104,7 @@ def generate_neutrino_jobcard(events,
...
@@ -104,6 +104,7 @@ def generate_neutrino_jobcard(events,
do_decay
=
False
,
do_decay
=
False
,
photon_propagation
=
True
,
photon_propagation
=
True
,
fluxfile
=
None
,
fluxfile
=
None
,
seed
=
0
,
input_path
=
INPUT_PATH
):
# pragma: no cover
input_path
=
INPUT_PATH
):
# pragma: no cover
"""
"""
Generate a jobcard for neutrino interaction
Generate a jobcard for neutrino interaction
...
@@ -130,6 +131,9 @@ def generate_neutrino_jobcard(events,
...
@@ -130,6 +131,9 @@ def generate_neutrino_jobcard(events,
Propagate photons and write it out
Propagate photons and write it out
fluxfile: str (default: None)
fluxfile: str (default: None)
Fluxfile, 1st col energy [GeV] and 2nd col flux [A.U.]
Fluxfile, 1st col energy [GeV] and 2nd col flux [A.U.]
seed: int (default: 0)
Input seed for the random number generator in GiBUU
(0: some seed will be drawn based on system time)
input_path: str
input_path: str
The input path pointing to the GiBUU lookup data which should be used
The input path pointing to the GiBUU lookup data which should be used
"""
"""
...
@@ -175,6 +179,7 @@ def generate_neutrino_jobcard(events,
...
@@ -175,6 +179,7 @@ def generate_neutrino_jobcard(events,
jc
[
"
eventoutput
"
][
"
writeperturbativeparticles
"
]
=
write_pert
jc
[
"
eventoutput
"
][
"
writeperturbativeparticles
"
]
=
write_pert
jc
[
"
eventoutput
"
][
"
writerealparticles
"
]
=
write_real
jc
[
"
eventoutput
"
][
"
writerealparticles
"
]
=
write_real
# MISC
# MISC
jc
[
"
initRandom
"
][
"
Seed
"
]
=
seed
jc
[
"
insertion
"
][
"
propagateNoPhoton
"
]
=
not
photon_propagation
jc
[
"
insertion
"
][
"
propagateNoPhoton
"
]
=
not
photon_propagation
return
jc
return
jc
This diff is collapsed.
Click to expand it.
km3buu/tests/test_jobcard.py
+
23
−
1
View file @
f1e6744c
...
@@ -12,8 +12,11 @@ __status__ = "Development"
...
@@ -12,8 +12,11 @@ __status__ = "Development"
import
unittest
import
unittest
import
numpy
as
np
import
numpy
as
np
from
itertools
import
combinations
from
km3buu.jobcard
import
*
from
km3buu.jobcard
import
*
from
tempfile
import
TemporaryFile
from
km3buu.ctrl
import
run_jobcard
from
km3buu.output
import
GiBUUOutput
from
tempfile
import
TemporaryFile
,
TemporaryDirectory
class
TestJobcard
(
unittest
.
TestCase
):
class
TestJobcard
(
unittest
.
TestCase
):
...
@@ -127,3 +130,22 @@ class TestNeutrinoSingleEnergyJobcard(unittest.TestCase):
...
@@ -127,3 +130,22 @@ class TestNeutrinoSingleEnergyJobcard(unittest.TestCase):
def
test_photon_propagation_flag
(
self
):
def
test_photon_propagation_flag
(
self
):
self
.
assertEqual
(
self
.
test_jobcard
[
"
insertion
"
][
"
propagateNoPhoton
"
],
self
.
assertEqual
(
self
.
test_jobcard
[
"
insertion
"
][
"
propagateNoPhoton
"
],
not
self
.
photon_propagation_flag
)
not
self
.
photon_propagation_flag
)
class
TestJobcardSeed
(
unittest
.
TestCase
):
def
setUp
(
self
):
jc
=
generate_neutrino_jobcard
(
100
,
"
CC
"
,
"
electron
"
,
(
1.0
,
2.0
),
(
1
,
1
),
do_decay
=
False
,
photon_propagation
=
False
,
seed
=
1234
)
self
.
dfs
=
[]
for
i
in
range
(
2
):
output_dir
=
TemporaryDirectory
()
run_jobcard
(
jc
,
output_dir
.
name
,
container
=
True
)
self
.
dfs
.
append
(
GiBUUOutput
(
output_dir
.
name
).
df
)
def
test_output
(
self
):
for
a
,
b
in
combinations
(
self
.
dfs
,
2
):
assert
all
((
a
==
b
).
all
(
1
))
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