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
598fa4f0
Commit
598fa4f0
authored
5 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Work on the jobcard properties
parent
a70c27dd
No related branches found
No related tags found
1 merge request
!1
Merge python environment
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3buu/jobcard.py
+71
-6
71 additions, 6 deletions
km3buu/jobcard.py
with
71 additions
and
6 deletions
km3buu/jobcard.py
+
71
−
6
View file @
598fa4f0
...
...
@@ -16,18 +16,73 @@ INPUT_PATH = "/opt/buuinput2019/"
class
Jobcard
(
object
):
"""
A object to manage GiBUU jobcard properties and format them
Parameters
----------
input_path: str
The input path pointing to the GiBUU lookup data which should be used
"""
def
__init__
(
self
,
input_path
=
INPUT_PATH
):
self
.
input_path
=
input_path
self
.
_groups
=
{
"
input
"
:
{
"
path_to_input
"
:
input_path
}
}
self
.
_groups
=
{}
# Default [input]
self
.
add_property
(
"
input
"
,
"
path_to_input
"
,
input_path
)
self
.
add_property
(
"
input
"
,
"
numTimeSteps
"
,
0
)
self
.
add_property
(
"
input
"
,
"
numEnsembles
"
,
100000
)
self
.
add_property
(
"
input
"
,
"
delta_T
"
,
0.2
)
self
.
add_property
(
"
input
"
,
"
num_runs_SameEnergy
"
,
1
)
# Default [target]
self
.
add_property
(
"
target
"
,
"
Z
"
,
1
)
self
.
add_property
(
"
target
"
,
"
A
"
,
1
)
def
set_target
(
self
,
Z
,
A
):
"""
Set the interaction target nucleus
Parameters
----------
A: int
Number of nucleons in the nucleus
Z: int
Number of protons in the nucleus
"""
self
.
add_property
(
"
target
"
,
"
Z
"
,
Z
)
self
.
add_property
(
"
target
"
,
"
A
"
,
A
)
@property
def
timesteps
(
self
):
"""
input/numTimeSteps property
"""
return
self
.
_groups
[
"
input
"
][
"
numTimeSteps
"
]
def
add_property
(
self
,
group
,
name
,
value
)
@timesteps.setter
def
timesteps
(
self
,
timesteps
):
self
.
_groups
[
"
input
"
][
"
numTimeSteps
"
]
=
timesteps
def
add_property
(
self
,
group
,
name
,
value
):
"""
Add a property to the jobcard
Parameters
----------
group: str
The parameter group where the property is incorporated
name: str
The property name
value:
The property value
"""
if
not
group
in
self
.
_groups
.
keys
():
self
.
_groups
[
group
]
=
{}
self
.
_groups
[
group
][
name
]
=
value
def
__str__
(
self
):
retval
=
""
for
group
,
attrs
in
self
.
_groups
.
items
():
if
len
(
self
.
_groups
[
group
])
==
0
:
continue
retval
+=
"
&%s
\n
"
%
group
for
attr
,
value
in
attrs
.
items
():
if
type
(
value
)
is
str
:
...
...
@@ -36,11 +91,21 @@ class Jobcard(object):
retval
+=
"
\t
%s = .%s.
\n
"
%
(
attr
,
value
)
else
:
retval
+=
"
\t
%s = %s
\n
"
%
(
attr
,
value
)
retval
+=
"
/
\n
"
retval
+=
"
/
\n
\n
"
return
retval
class
NeutrinoJobcard
(
Jobcard
):
"""
Jobcard object for neutrino interactions
Parameters
----------
input_path: str
The input path pointing to the GiBUU lookup data which should be used
"""
def
__init__
(
self
,
input_path
=
INPUT_PATH
):
super
(
NeutrinoJobcard
,
self
).
__init__
(
input_path
)
## Default [input]
self
.
add_property
(
"
input
"
,
"
eventtype
"
,
5
)
self
.
add_property
(
"
input
"
,
"
localEnsemble
"
,
True
)
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