From fa6956b00aaed1ad18780064c52bdc937b161876 Mon Sep 17 00:00:00 2001 From: Johannes Schumann <johannes.schumann@fau.de> Date: Tue, 14 Mar 2023 23:55:56 +0000 Subject: [PATCH] GiBUU 2021 Patch 3 --- km3buu/jobcard.py | 4 ++-- km3buu/output.py | 12 ++++++++++-- km3buu/tests/test_ctrl.py | 4 ++-- km3buu/tests/test_jobcard.py | 8 ++++---- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/km3buu/jobcard.py b/km3buu/jobcard.py index 6cb7e0f..2077aaf 100644 --- a/km3buu/jobcard.py +++ b/km3buu/jobcard.py @@ -147,8 +147,8 @@ def generate_neutrino_jobcard(events, jc["neutrino_induced"]["process_ID"] = PROCESS_LOOKUP[process.lower()] jc["neutrino_induced"]["flavor_ID"] = FLAVOR_LOOKUP[flavour.lower()] # TARGET - jc["target"]["target_Z"] = target[1] - jc["target"]["target_A"] = target[0] + jc["target"]["z"] = target[1] + jc["target"]["a"] = target[0] # EVENTS run_events = int(100000 / target[1]) if events < run_events: diff --git a/km3buu/output.py b/km3buu/output.py index 152d896..9e34538 100644 --- a/km3buu/output.py +++ b/km3buu/output.py @@ -536,11 +536,19 @@ class GiBUUOutput: @property def A(self): - return self.jobcard["target"]["target_a"] + grp = self.jobcard["target"] + if "a" in grp.keys(): + return grp["a"] + elif "target_a" in grp.keys(): + return grp["target_a"] @property def Z(self): - return self.jobcard["target"]["target_z"] + grp = self.jobcard["target"] + if "z" in grp.keys(): + return grp["z"] + elif "target_z" in grp.keys(): + return grp["target_z"] @property def data_path(self): diff --git a/km3buu/tests/test_ctrl.py b/km3buu/tests/test_ctrl.py index 6ed8493..d12ef47 100644 --- a/km3buu/tests/test_ctrl.py +++ b/km3buu/tests/test_ctrl.py @@ -78,8 +78,8 @@ class TestCTRLbyJobcardObject(unittest.TestCase): self.test_jobcard["input"]["num_runs_SameEnergy"] = 1 self.test_jobcard["input"]["LRF_equals_CALC_frame"] = True # TARGET - self.test_jobcard["target"]["target_Z"] = 1 - self.test_jobcard["target"]["target_A"] = 1 + self.test_jobcard["target"]["z"] = 1 + self.test_jobcard["target"]["a"] = 1 # MISC # self.test_jobcard["nl_neutrinoxsection"]["DISmassless"] = True self.test_jobcard["neutrinoAnalysis"]["outputEvents"] = True diff --git a/km3buu/tests/test_jobcard.py b/km3buu/tests/test_jobcard.py index 2885a63..da62075 100644 --- a/km3buu/tests/test_jobcard.py +++ b/km3buu/tests/test_jobcard.py @@ -79,8 +79,8 @@ class TestNeutrinoEnergyRangeJobcard(unittest.TestCase): 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"]) + self.assertEqual(self.test_Z, self.test_jobcard["target"]["Z"]) + self.assertEqual(self.test_A, self.test_jobcard["target"]["A"]) def test_energy(self): self.assertAlmostEqual( @@ -129,8 +129,8 @@ class TestNeutrinoSingleEnergyJobcard(unittest.TestCase): 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"]) + self.assertEqual(self.test_Z, self.test_jobcard["target"]["z"]) + self.assertEqual(self.test_A, self.test_jobcard["target"]["a"]) def test_energy(self): self.assertAlmostEqual(self.test_energy, -- GitLab