Skip to content
Snippets Groups Projects
Commit 8a9b3e57 authored by Johannes Schumann's avatar Johannes Schumann
Browse files

Fix type and add jobcard tests

parent a346e2a3
No related branches found
No related tags found
1 merge request!10Single energy runs
Pipeline #20576 passed
This commit is part of merge request !10. Comments created here will be created in the context of that merge request.
......@@ -150,7 +150,7 @@ def generate_neutrino_jobcard(events,
jc["nl_neutrino_energyflux"]["eflux_min"] = energy[0]
jc["nl_neutrino_energyflux"]["eflux_max"] = energy[1]
else:
jc["nl_sigmanc"]["enu"] = energy
jc["nl_sigmamc"]["enu"] = energy
# DECAY
if do_decay:
for i in DECAYED_HADRONS:
......
......@@ -45,7 +45,7 @@ class TestJobcard(unittest.TestCase):
assert ctnt.find(expected_line) == -1
class TestNeutrinoJobcard(unittest.TestCase):
class TestNeutrinoEnergyRangeJobcard(unittest.TestCase):
def setUp(self):
self.test_fluxfile = TemporaryFile()
self.test_Z = np.random.randint(1, 100)
......@@ -93,3 +93,37 @@ class TestNeutrinoJobcard(unittest.TestCase):
def test_photon_propagation_flag(self):
self.assertEqual(self.test_jobcard["insertion"]["propagateNoPhoton"],
not self.photon_propagation_flag)
class TestNeutrinoSingleEnergyJobcard(unittest.TestCase):
def setUp(self):
self.test_fluxfile = TemporaryFile()
self.test_Z = np.random.randint(1, 100)
self.test_A = np.random.randint(self.test_Z, 100)
self.test_energy = np.random.uniform(0.0, 100.0)
self.photon_propagation_flag = np.random.choice([True, False])
self.do_decay = np.random.choice([True, False])
self.test_jobcard = generate_neutrino_jobcard(
1000,
"CC",
"electron",
self.test_energy, (self.test_Z, self.test_A),
do_decay=self.do_decay,
photon_propagation=self.photon_propagation_flag,
fluxfile=self.test_fluxfile.name,
input_path="/test")
def test_input_path(self):
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"])
def test_energy(self):
self.assertAlmostEqual(self.test_energy,
self.test_jobcard["nl_sigmamc"]["enu"])
def test_photon_propagation_flag(self):
self.assertEqual(self.test_jobcard["insertion"]["propagateNoPhoton"],
not self.photon_propagation_flag)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment