Skip to content
Snippets Groups Projects
Commit 91a156ef authored by Zineb Aly's avatar Zineb Aly
Browse files

make yapf

parent 70e12780
No related branches found
No related tags found
No related merge requests found
...@@ -336,7 +336,7 @@ class OnlineEvents: ...@@ -336,7 +336,7 @@ class OnlineEvents:
def __getitem__(self, item): def __getitem__(self, item):
return OnlineEvent(self.headers[item], self.snapshot_hits[item], return OnlineEvent(self.headers[item], self.snapshot_hits[item],
self.triggered_hits[item]) self.triggered_hits[item])
def __len__(self): def __len__(self):
return len(self.headers) return len(self.headers)
......
...@@ -36,17 +36,16 @@ def _unfold_indices(obj, indices): ...@@ -36,17 +36,16 @@ def _unfold_indices(obj, indices):
class BranchMapper: class BranchMapper:
def __init__( def __init__(self,
self, name,
name, key,
key, extra=None,
extra=None, exclude=None,
exclude=None, update=None,
update=None, attrparser=None,
attrparser=None, flat=True,
flat=True, interpretations=None,
interpretations=None, toawkward=None):
toawkward=None):
""" """
Mapper helper for keys in a ROOT branch. Mapper helper for keys in a ROOT branch.
...@@ -191,8 +190,8 @@ class Branch: ...@@ -191,8 +190,8 @@ class Branch:
def __str__(self): def __str__(self):
length = len(self) length = len(self)
return "{} ({}) with {} element{}".format(self.__class__.__name__, return "{} ({}) with {} element{}".format(self.__class__.__name__,
self._mapper.name, length, self._mapper.name, length,
's' if length > 1 else '') 's' if length > 1 else '')
def __repr__(self): def __repr__(self):
length = len(self) length = len(self)
......
...@@ -47,7 +47,7 @@ class TestGSGHeader(unittest.TestCase): ...@@ -47,7 +47,7 @@ class TestGSGHeader(unittest.TestCase):
self.assertAlmostEqual(self.header["SiteLatitude"], 0.747) self.assertAlmostEqual(self.header["SiteLatitude"], 0.747)
self.assertAlmostEqual(self.header["SiteLongitude"], 0.10763) self.assertAlmostEqual(self.header["SiteLongitude"], 0.10763)
self.assertAlmostEqual(self.header["SeaBottomRadius"], 6368000.) self.assertAlmostEqual(self.header["SeaBottomRadius"], 6368000.)
assert round(self.header["GlobalGenWeight"]-6.26910765e+08, 0) == 0 assert round(self.header["GlobalGenWeight"] - 6.26910765e+08, 0) == 0
self.assertAlmostEqual(self.header["RhoSW"], 1.03975) self.assertAlmostEqual(self.header["RhoSW"], 1.03975)
self.assertAlmostEqual(self.header["RhoSR"], 2.65) self.assertAlmostEqual(self.header["RhoSR"], 2.65)
self.assertAlmostEqual(self.header["TGen"], 31556926.) self.assertAlmostEqual(self.header["TGen"], 31556926.)
......
...@@ -10,7 +10,7 @@ SAMPLES_DIR = os.path.join(os.path.dirname(__file__), "samples") ...@@ -10,7 +10,7 @@ SAMPLES_DIR = os.path.join(os.path.dirname(__file__), "samples")
class TestOnlineEvents(unittest.TestCase): class TestOnlineEvents(unittest.TestCase):
def setUp(self): def setUp(self):
self.events = OnlineReader(os.path.join(SAMPLES_DIR, self.events = OnlineReader(os.path.join(SAMPLES_DIR,
"daq_v1.0.0.root")).events "daq_v1.0.0.root")).events
def test_index_lookup(self): def test_index_lookup(self):
assert 3 == len(self.events) assert 3 == len(self.events)
...@@ -25,7 +25,7 @@ class TestOnlineEvents(unittest.TestCase): ...@@ -25,7 +25,7 @@ class TestOnlineEvents(unittest.TestCase):
class TestOnlineEvent(unittest.TestCase): class TestOnlineEvent(unittest.TestCase):
def setUp(self): def setUp(self):
self.event = OnlineReader(os.path.join(SAMPLES_DIR, self.event = OnlineReader(os.path.join(SAMPLES_DIR,
"daq_v1.0.0.root")).events[0] "daq_v1.0.0.root")).events[0]
def test_str(self): def test_str(self):
assert re.match(".*event.*96.*snapshot.*18.*triggered", assert re.match(".*event.*96.*snapshot.*18.*triggered",
...@@ -39,7 +39,7 @@ class TestOnlineEvent(unittest.TestCase): ...@@ -39,7 +39,7 @@ class TestOnlineEvent(unittest.TestCase):
class TestOnlineEventsSnapshotHits(unittest.TestCase): class TestOnlineEventsSnapshotHits(unittest.TestCase):
def setUp(self): def setUp(self):
self.events = OnlineReader(os.path.join(SAMPLES_DIR, self.events = OnlineReader(os.path.join(SAMPLES_DIR,
"daq_v1.0.0.root")).events "daq_v1.0.0.root")).events
self.lengths = {0: 96, 1: 124, -1: 78} self.lengths = {0: 96, 1: 124, -1: 78}
self.total_item_count = 298 self.total_item_count = 298
...@@ -78,7 +78,7 @@ class TestOnlineEventsSnapshotHits(unittest.TestCase): ...@@ -78,7 +78,7 @@ class TestOnlineEventsSnapshotHits(unittest.TestCase):
class TestOnlineEventsTriggeredHits(unittest.TestCase): class TestOnlineEventsTriggeredHits(unittest.TestCase):
def setUp(self): def setUp(self):
self.events = OnlineReader(os.path.join(SAMPLES_DIR, self.events = OnlineReader(os.path.join(SAMPLES_DIR,
"daq_v1.0.0.root")).events "daq_v1.0.0.root")).events
self.lengths = {0: 18, 1: 53, -1: 9} self.lengths = {0: 18, 1: 53, -1: 9}
self.total_item_count = 80 self.total_item_count = 80
...@@ -119,7 +119,7 @@ class TestOnlineEventsTriggeredHits(unittest.TestCase): ...@@ -119,7 +119,7 @@ class TestOnlineEventsTriggeredHits(unittest.TestCase):
class TestTimeslices(unittest.TestCase): class TestTimeslices(unittest.TestCase):
def setUp(self): def setUp(self):
self.ts = OnlineReader(os.path.join(SAMPLES_DIR, self.ts = OnlineReader(os.path.join(SAMPLES_DIR,
"daq_v1.0.0.root")).timeslices "daq_v1.0.0.root")).timeslices
def test_data_lengths(self): def test_data_lengths(self):
assert 3 == len(self.ts._timeslices["L1"][0]) assert 3 == len(self.ts._timeslices["L1"][0])
...@@ -145,7 +145,7 @@ class TestTimeslices(unittest.TestCase): ...@@ -145,7 +145,7 @@ class TestTimeslices(unittest.TestCase):
class TestTimeslice(unittest.TestCase): class TestTimeslice(unittest.TestCase):
def setUp(self): def setUp(self):
self.ts = OnlineReader(os.path.join(SAMPLES_DIR, self.ts = OnlineReader(os.path.join(SAMPLES_DIR,
"daq_v1.0.0.root")).timeslices "daq_v1.0.0.root")).timeslices
self.n_frames = {"L1": [69, 69, 69], "SN": [64, 66, 68]} self.n_frames = {"L1": [69, 69, 69], "SN": [64, 66, 68]}
def test_str(self): def test_str(self):
...@@ -159,7 +159,7 @@ class TestTimeslice(unittest.TestCase): ...@@ -159,7 +159,7 @@ class TestTimeslice(unittest.TestCase):
class TestSummaryslices(unittest.TestCase): class TestSummaryslices(unittest.TestCase):
def setUp(self): def setUp(self):
self.ss = OnlineReader(os.path.join(SAMPLES_DIR, self.ss = OnlineReader(os.path.join(SAMPLES_DIR,
"daq_v1.0.0.root")).summaryslices "daq_v1.0.0.root")).summaryslices
def test_headers(self): def test_headers(self):
assert 3 == len(self.ss.headers) assert 3 == len(self.ss.headers)
......
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