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

Update format according to yapf

parent 6bbb81c3
No related branches found
No related tags found
1 merge request!19Resolve "ICHAN type"
Pipeline #24597 passed
This commit is part of merge request !19. Comments created here will be created in the context of that merge request.
...@@ -45,6 +45,7 @@ GSEAGEN_MEDIA_COMPOSITION_FILE = "MediaComposition.xml" ...@@ -45,6 +45,7 @@ GSEAGEN_MEDIA_COMPOSITION_FILE = "MediaComposition.xml"
class Config(object): class Config(object):
def __init__(self, config_path=CONFIG_PATH): def __init__(self, config_path=CONFIG_PATH):
self.config = ConfigParser() self.config = ConfigParser()
self._config_path = config_path self._config_path = config_path
......
...@@ -19,6 +19,7 @@ class DetectorVolume(ABC): ...@@ -19,6 +19,7 @@ class DetectorVolume(ABC):
""" """
Detector geometry class Detector geometry class
""" """
def __init__(self): def __init__(self):
self._volume = -1.0 self._volume = -1.0
self._coord_origin = (0., 0., 0.) self._coord_origin = (0., 0., 0.)
...@@ -82,6 +83,7 @@ class CanVolume(DetectorVolume): ...@@ -82,6 +83,7 @@ class CanVolume(DetectorVolume):
zmax: float [m] (default: 476.5) zmax: float [m] (default: 476.5)
Cylinder top z position Cylinder top z position
""" """
def __init__(self, radius=403.4, zmin=0.0, zmax=476.5): def __init__(self, radius=403.4, zmin=0.0, zmax=476.5):
super().__init__() super().__init__()
self._radius = radius self._radius = radius
...@@ -118,6 +120,7 @@ class SphericalVolume(DetectorVolume): ...@@ -118,6 +120,7 @@ class SphericalVolume(DetectorVolume):
Coordinate center of the sphere Coordinate center of the sphere
(x, y, z) (x, y, z)
""" """
def __init__(self, radius, coord_origin=(0, 0, 0)): def __init__(self, radius, coord_origin=(0, 0, 0)):
super().__init__() super().__init__()
self._radius = radius self._radius = radius
......
...@@ -58,6 +58,7 @@ class Jobcard(f90nml.Namelist): ...@@ -58,6 +58,7 @@ class Jobcard(f90nml.Namelist):
input_path: str input_path: str
The input path pointing to the GiBUU lookup data which should be used The input path pointing to the GiBUU lookup data which should be used
""" """
def __init__(self, def __init__(self,
*args, *args,
filename=DEFAULT_JOBCARD_FILENAME, filename=DEFAULT_JOBCARD_FILENAME,
......
...@@ -274,6 +274,7 @@ def read_nu_abs_xsection(filepath): ...@@ -274,6 +274,7 @@ def read_nu_abs_xsection(filepath):
class GiBUUOutput: class GiBUUOutput:
def __init__(self, data_dir): def __init__(self, data_dir):
""" """
Class for parsing GiBUU output files Class for parsing GiBUU output files
...@@ -580,6 +581,7 @@ class GiBUUOutput: ...@@ -580,6 +581,7 @@ class GiBUUOutput:
return self._generated_events return self._generated_events
def _determine_flux_index(self): def _determine_flux_index(self):
def fluxfunc(x, a, b): def fluxfunc(x, a, b):
return a * x**b return a * x**b
......
...@@ -32,6 +32,7 @@ path=/tmp/gseagen ...@@ -32,6 +32,7 @@ path=/tmp/gseagen
class TestConfig(unittest.TestCase): class TestConfig(unittest.TestCase):
def setUp(self): def setUp(self):
self.cfg_tmpfile = NamedTemporaryFile(delete=False) self.cfg_tmpfile = NamedTemporaryFile(delete=False)
self.mock_image_file = NamedTemporaryFile(delete=False) self.mock_image_file = NamedTemporaryFile(delete=False)
......
...@@ -25,6 +25,7 @@ TESTDATA_DIR = data_path("gibuu") ...@@ -25,6 +25,7 @@ TESTDATA_DIR = data_path("gibuu")
class TestCTRLbyJobcardFile(unittest.TestCase): class TestCTRLbyJobcardFile(unittest.TestCase):
def setUp(self): def setUp(self):
self.filename = join(TESTDATA_DIR, "km3net_testdata.job") self.filename = join(TESTDATA_DIR, "km3net_testdata.job")
self.output_dir = TemporaryDirectory() self.output_dir = TemporaryDirectory()
...@@ -48,6 +49,7 @@ class TestCTRLbyJobcardFile(unittest.TestCase): ...@@ -48,6 +49,7 @@ class TestCTRLbyJobcardFile(unittest.TestCase):
class TestCTRLbyJobcardObject(unittest.TestCase): class TestCTRLbyJobcardObject(unittest.TestCase):
def setUp(self): def setUp(self):
log = get_logger("ctrl.py") log = get_logger("ctrl.py")
log.setLevel("INFO") log.setLevel("INFO")
......
...@@ -19,6 +19,7 @@ from km3buu import DOCKER_URL, IMAGE_NAME ...@@ -19,6 +19,7 @@ from km3buu import DOCKER_URL, IMAGE_NAME
class TestBuild(unittest.TestCase): class TestBuild(unittest.TestCase):
def test_wrong_dir_path(self): def test_wrong_dir_path(self):
wrong_path = "foobar" wrong_path = "foobar"
try: try:
......
...@@ -17,12 +17,14 @@ import numpy as np ...@@ -17,12 +17,14 @@ import numpy as np
class TestGeneralGeometry(unittest.TestCase): class TestGeneralGeometry(unittest.TestCase):
def test_abstract_init(self): def test_abstract_init(self):
with self.assertRaises(TypeError) as ctx: with self.assertRaises(TypeError) as ctx:
d = DetectorVolume() d = DetectorVolume()
class TestSphere(unittest.TestCase): class TestSphere(unittest.TestCase):
def setUp(self): def setUp(self):
self.detector_geometry = SphericalVolume(20, (2, 2, 2)) self.detector_geometry = SphericalVolume(20, (2, 2, 2))
...@@ -44,6 +46,7 @@ class TestSphere(unittest.TestCase): ...@@ -44,6 +46,7 @@ class TestSphere(unittest.TestCase):
class TestCan(unittest.TestCase): class TestCan(unittest.TestCase):
def setUp(self): def setUp(self):
self.detector_geometry = CanVolume() self.detector_geometry = CanVolume()
......
...@@ -20,6 +20,7 @@ from tempfile import TemporaryFile, TemporaryDirectory ...@@ -20,6 +20,7 @@ from tempfile import TemporaryFile, TemporaryDirectory
class TestJobcard(unittest.TestCase): class TestJobcard(unittest.TestCase):
def setUp(self): def setUp(self):
self.test_jobcard = Jobcard() self.test_jobcard = Jobcard()
# Insert some test elements # Insert some test elements
...@@ -49,6 +50,7 @@ class TestJobcard(unittest.TestCase): ...@@ -49,6 +50,7 @@ class TestJobcard(unittest.TestCase):
class TestNeutrinoEnergyRangeJobcard(unittest.TestCase): class TestNeutrinoEnergyRangeJobcard(unittest.TestCase):
def setUp(self): def setUp(self):
self.test_fluxfile = TemporaryFile() self.test_fluxfile = TemporaryFile()
self.test_Z = np.random.randint(1, 100) self.test_Z = np.random.randint(1, 100)
...@@ -99,6 +101,7 @@ class TestNeutrinoEnergyRangeJobcard(unittest.TestCase): ...@@ -99,6 +101,7 @@ class TestNeutrinoEnergyRangeJobcard(unittest.TestCase):
class TestNeutrinoSingleEnergyJobcard(unittest.TestCase): class TestNeutrinoSingleEnergyJobcard(unittest.TestCase):
def setUp(self): def setUp(self):
self.test_fluxfile = TemporaryFile() self.test_fluxfile = TemporaryFile()
self.test_Z = np.random.randint(1, 100) self.test_Z = np.random.randint(1, 100)
...@@ -133,6 +136,7 @@ class TestNeutrinoSingleEnergyJobcard(unittest.TestCase): ...@@ -133,6 +136,7 @@ class TestNeutrinoSingleEnergyJobcard(unittest.TestCase):
class TestJobcardSeed(unittest.TestCase): class TestJobcardSeed(unittest.TestCase):
def setUp(self): def setUp(self):
jc = generate_neutrino_jobcard(100, jc = generate_neutrino_jobcard(100,
"CC", "CC",
......
...@@ -37,6 +37,7 @@ except ModuleNotFoundError: ...@@ -37,6 +37,7 @@ except ModuleNotFoundError:
class TestXSection(unittest.TestCase): class TestXSection(unittest.TestCase):
def test_xsection_all(self): def test_xsection_all(self):
filename = join(TESTDATA_DIR, XSECTION_FILENAMES["all"]) filename = join(TESTDATA_DIR, XSECTION_FILENAMES["all"])
xsection = read_nu_abs_xsection(filename) xsection = read_nu_abs_xsection(filename)
...@@ -47,6 +48,7 @@ class TestXSection(unittest.TestCase): ...@@ -47,6 +48,7 @@ class TestXSection(unittest.TestCase):
class TestGiBUUOutput(unittest.TestCase): class TestGiBUUOutput(unittest.TestCase):
def setup_class(self): def setup_class(self):
self.output = GiBUUOutput(TESTDATA_DIR) self.output = GiBUUOutput(TESTDATA_DIR)
...@@ -91,6 +93,7 @@ class TestGiBUUOutput(unittest.TestCase): ...@@ -91,6 +93,7 @@ class TestGiBUUOutput(unittest.TestCase):
@pytest.mark.skipif(not KM3NET_LIB_AVAILABLE, @pytest.mark.skipif(not KM3NET_LIB_AVAILABLE,
reason="KM3NeT dataformat required") reason="KM3NeT dataformat required")
class TestAANET(unittest.TestCase): class TestAANET(unittest.TestCase):
def setUp(self): def setUp(self):
output = GiBUUOutput(TESTDATA_DIR) output = GiBUUOutput(TESTDATA_DIR)
datafile = NamedTemporaryFile(suffix=".root") datafile = NamedTemporaryFile(suffix=".root")
......
...@@ -28,6 +28,7 @@ pp.RandomGenerator.get().set_seed(1234) ...@@ -28,6 +28,7 @@ pp.RandomGenerator.get().set_seed(1234)
@pytest.mark.skip(reason="CI boost lib problem") @pytest.mark.skip(reason="CI boost lib problem")
class TestTauPropagation(unittest.TestCase): class TestTauPropagation(unittest.TestCase):
def setUp(self): def setUp(self):
data = ak.Array({ data = ak.Array({
"lepOut_E": [ "lepOut_E": [
......
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