- Notifications
You must be signed in to change notification settings - Fork0
Python GiBUU wrapper for KM3NeT
License
KM3NeT/km3buu
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is NOT an official KM3NeT software package.
The KM3BUU project is an integrated python framework for wrapping the GiBUU particle interaction simulationhttps://gibuu.hepforge.org/trac/wiki . It is specifically designed for studies within the KM3NeT experiment and focuses on the neutrino simulation functionality of GiBUU.
The main code repository can be found at:https://git.km3net.de/simulation/km3buu
The framework covers all parts of the GiBUU workflow, which includes setting up the simulation configuarion inside a so-called jobcarb, running GiBUU and parsing the output files.
The main KM3BUU project is a python based framework, which can be used with alocal GiBUU installation or used within a docker container. In order to install the km3buu python module the repository has to be retreived from the Git server first.
From KM3NeT GitLab:
git clone https://git.km3net.de/simulation/km3buucd km3buu
From GitHub:
git clone https://github.com/KM3NeT/km3buucd km3buu
After downloading the repository the package can be installed via:
pip install -e
(Up to now KM3BUU is not provided via python package manager.)
If working inside a docker environment is recommended, the KM3BUU image can be copied&run directly from the KM3NeT docker server:
docker run -it --rm docker.km3net.de/simulation/km3buu:latest /bin/bash
or built locally:
cd km3buudocker build .
The docker image contains the latest release of km3buu as well as the GiBUU 2021 Patch 4 (release from 2023-03-23) including RootTuple extension is installed (km3buu v1.0.0).
The GiBUU workflow starts from a jobcard which contains the configuration which should be simulated. The jobcards are technically FORTRAN namelists and can be created using a Jobcard object. In the example this is done via loading an existing jobcard:
>>>fromkm3buu.jobcardimportJobcard,read_jobcard>>>jc=read_jobcard("jobcards/examples/example.job")
Alternatively a neutrino jobcard can be generated from scratch via
>>>fromkm3buu.jobcardimportJobcard,generate_neutrino_jobcard>>>generate_neutrino_jobcard(1000,1,"CC","muon", (1,10))
This jobcard is subsequently forwarded to GiBUU via the run_jobcard function. The second argument takes a directory which should be used to write out all the output files generated by GiBUU.
>>>fromkm3buu.ctrlimportrun_jobcard>>>run_jobcard(jc,"./output")0
Finally, the output can be parsed using a GiBUUOutput object:
>>>fromkm3buu.outputimportGiBUUOutput>>>data=GiBUUOutput("./output")
The event data can further be converted to a pandas dataframe
>>>df=data.df
or an awkward array
>>>arr=data.arrays
About
Python GiBUU wrapper for KM3NeT