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
46f0976c
Commit
46f0976c
authored
3 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Add minimal run example in jupyter notebook
parent
101d3a50
No related branches found
No related tags found
No related merge requests found
Pipeline
#19838
passed
3 years ago
Stage: test
Stage: coverage
Stage: doc
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notebooks/RunExample.ipynb
+130
-0
130 additions, 0 deletions
notebooks/RunExample.ipynb
with
130 additions
and
0 deletions
notebooks/RunExample.ipynb
0 → 100644
+
130
−
0
View file @
46f0976c
{
"cells": [
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"from tempfile import TemporaryDirectory\n",
"\n",
"from km3buu.jobcard import generate_neutrino_jobcard\n",
"from km3buu.jobcard import XSECTIONMODE_LOOKUP, PROCESS_LOOKUP, FLAVOR_LOOKUP\n",
"from km3buu.ctrl import run_jobcard\n",
"from km3buu.geometry import CanVolume, SphericalVolume\n",
"\n",
"from km3buu.output import GiBUUOutput, write_detector_file"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Jobcard"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"events = 1000\n",
"energy_min = 0.1\n",
"energy_max = 50\n",
"interaction = \"cc\"\n",
"flavor = \"electron\"\n",
"target_z = 8\n",
"target_a = 16\n",
"fluxfile = None\n",
"jc = generate_neutrino_jobcard(events, interaction, flavor, (energy_min,energy_max), (target_z,target_a),fluxfile=fluxfile)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Run"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2021-05-04 12:16:12 \u001b[31mERROR \u001b[0m ++ ctrl.py\u001b[31m: GiBUU stacktrace:\n",
"/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)\n",
"\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"outdir = TemporaryDirectory()\n",
"run_jobcard(jc, outdir.name)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Output"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"fobj = GiBUUOutput(outdir.name)\n",
"\n",
"volume = CanVolume()\n",
"# volume = SphericalVolume(100)\n",
"\n",
"write_detector_file(fobj, geometry=volume)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
%% Cell type:code id: tags:
```
python
from
tempfile
import
TemporaryDirectory
from
km3buu.jobcard
import
generate_neutrino_jobcard
from
km3buu.jobcard
import
XSECTIONMODE_LOOKUP
,
PROCESS_LOOKUP
,
FLAVOR_LOOKUP
from
km3buu.ctrl
import
run_jobcard
from
km3buu.geometry
import
CanVolume
,
SphericalVolume
from
km3buu.output
import
GiBUUOutput
,
write_detector_file
```
%% Cell type:markdown id: tags:
### Jobcard
%% Cell type:code id: tags:
```
python
events
=
1000
energy_min
=
0.1
energy_max
=
50
interaction
=
"
cc
"
flavor
=
"
electron
"
target_z
=
8
target_a
=
16
fluxfile
=
None
jc
=
generate_neutrino_jobcard
(
events
,
interaction
,
flavor
,
(
energy_min
,
energy_max
),
(
target_z
,
target_a
),
fluxfile
=
fluxfile
)
```
%% Cell type:markdown id: tags:
### Run
%% Cell type:code id: tags:
```
python
outdir
=
TemporaryDirectory
()
run_jobcard
(
jc
,
outdir
.
name
)
```
%% Output
2021-05-04 12:16:12 [31mERROR [0m ++ ctrl.py[31m: GiBUU stacktrace:
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
[0m
0
%% Cell type:markdown id: tags:
### Output
%% Cell type:code id: tags:
```
python
fobj
=
GiBUUOutput
(
outdir
.
name
)
volume
=
CanVolume
()
# volume = SphericalVolume(100)
write_detector_file
(
fobj
,
geometry
=
volume
)
```
%% Cell type:code id: tags:
```
python
```
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