From acd00b90cb69293f511751d0996ce95291c1eb70 Mon Sep 17 00:00:00 2001
From: Tamas Gal <tgal@km3net.de>
Date: Wed, 27 May 2020 14:53:47 +0200
Subject: [PATCH] Unify sample file naming

---
 examples/plot_offline_hits.py                 |   2 +-
 examples/plot_offline_tracks.py               |   2 +-
 examples/plot_online_example.py               |   4 +--
 ...{aanet_v2.0.0.root => km3net_offline.root} | Bin
 .../{daq_v1.0.0.root => km3net_online.root}   | Bin
 tests/test_gseagen.py                         |   2 +-
 tests/test_offline.py                         |   4 +--
 tests/test_online.py                          |  27 +++++++-----------
 8 files changed, 17 insertions(+), 24 deletions(-)
 rename tests/samples/{aanet_v2.0.0.root => km3net_offline.root} (100%)
 rename tests/samples/{daq_v1.0.0.root => km3net_online.root} (100%)

diff --git a/examples/plot_offline_hits.py b/examples/plot_offline_hits.py
index 6e20ac6..a6f1c38 100644
--- a/examples/plot_offline_hits.py
+++ b/examples/plot_offline_hits.py
@@ -14,7 +14,7 @@ import km3io as ki
 # To access offline hits/mc_hits data:
 
 mc_hits = ki.OfflineReader("samples/numucc.root").events.mc_hits
-hits = ki.OfflineReader("samples/aanet_v2.0.0.root").events.hits
+hits = ki.OfflineReader("samples/km3net_offline.root").events.hits
 
 
 #####################################################
diff --git a/examples/plot_offline_tracks.py b/examples/plot_offline_tracks.py
index 16d9ee1..d5bf656 100644
--- a/examples/plot_offline_tracks.py
+++ b/examples/plot_offline_tracks.py
@@ -13,7 +13,7 @@ import km3io as ki
 # To access offline tracks/mc_tracks data:
 
 mc_tracks = ki.OfflineReader("samples/numucc.root").events.mc_tracks
-tracks = ki.OfflineReader("samples/aanet_v2.0.0.root").events.tracks
+tracks = ki.OfflineReader("samples/km3net_offline.root").events.tracks
 
 
 #####################################################
diff --git a/examples/plot_online_example.py b/examples/plot_online_example.py
index e9a4575..2a1db9b 100644
--- a/examples/plot_online_example.py
+++ b/examples/plot_online_example.py
@@ -17,7 +17,7 @@ import km3io as ki
 # with:
 
 
-f = ki.OnlineReader("samples/daq_v1.0.0.root")
+f = ki.OnlineReader("samples/km3net_online.root")
 
 #####################################################
 # Note that only some meta information is read into memory.
@@ -64,4 +64,4 @@ print(f.summaryslices.headers.frame_index)
 # Reading TimeSlices
 # ------------------
 # To be continued.
-#
\ No newline at end of file
+#
diff --git a/tests/samples/aanet_v2.0.0.root b/tests/samples/km3net_offline.root
similarity index 100%
rename from tests/samples/aanet_v2.0.0.root
rename to tests/samples/km3net_offline.root
diff --git a/tests/samples/daq_v1.0.0.root b/tests/samples/km3net_online.root
similarity index 100%
rename from tests/samples/daq_v1.0.0.root
rename to tests/samples/km3net_online.root
diff --git a/tests/test_gseagen.py b/tests/test_gseagen.py
index 8a2c9bd..9063c5f 100644
--- a/tests/test_gseagen.py
+++ b/tests/test_gseagen.py
@@ -56,7 +56,7 @@ class TestGSGHeader(unittest.TestCase):
         self.assertListEqual(self.header["NuList"].tolist(), [-14, 14])
 
     def test_unsupported_header(self):
-        f = GSGReader(os.path.join(SAMPLES_DIR, "daq_v1.0.0.root"))
+        f = GSGReader(os.path.join(SAMPLES_DIR, "km3net_online.root"))
         with self.assertWarns(UserWarning):
             f.header
 
diff --git a/tests/test_offline.py b/tests/test_offline.py
index 3ccc074..0f4f42b 100644
--- a/tests/test_offline.py
+++ b/tests/test_offline.py
@@ -7,7 +7,7 @@ from km3io import OfflineReader
 from km3io.offline import _nested_mapper, Header, fitinf, fitparams, count_nested, _find, mask, best_track, rec_types
 
 SAMPLES_DIR = Path(__file__).parent / 'samples'
-OFFLINE_FILE = OfflineReader(SAMPLES_DIR / 'aanet_v2.0.0.root')
+OFFLINE_FILE = OfflineReader(SAMPLES_DIR / 'km3net_offline.root')
 OFFLINE_USR = OfflineReader(SAMPLES_DIR / 'usr-sample.root')
 OFFLINE_MC_TRACK_USR = OfflineReader(
     SAMPLES_DIR /
@@ -113,7 +113,7 @@ class TestOfflineReader(unittest.TestCase):
         self.n_events = 10
 
     def test_context_manager(self):
-        filename = SAMPLES_DIR / 'aanet_v2.0.0.root'
+        filename = SAMPLES_DIR / 'km3net_offline.root'
         with OfflineReader(filename) as r:
             assert r._filename == filename
 
diff --git a/tests/test_online.py b/tests/test_online.py
index 7e0dfdf..45897b7 100644
--- a/tests/test_online.py
+++ b/tests/test_online.py
@@ -5,19 +5,18 @@ import unittest
 from km3io.online import OnlineReader, get_rate, has_udp_trailer, get_udp_max_sequence_number, get_channel_flags, get_number_udp_packets
 
 SAMPLES_DIR = os.path.join(os.path.dirname(__file__), "samples")
+ONLINE_FILE = os.path.join(SAMPLES_DIR, "km3net_online.root")
 
 
 class TestOnlineReaderContextManager(unittest.TestCase):
     def test_context_manager(self):
-        filename = os.path.join(SAMPLES_DIR, "daq_v1.0.0.root")
-        with OnlineReader(filename) as r:
-            assert r._filename == filename
+        with OnlineReader(ONLINE_FILE) as r:
+            assert r._filename == ONLINE_FILE
 
 
 class TestOnlineEvents(unittest.TestCase):
     def setUp(self):
-        self.events = OnlineReader(os.path.join(SAMPLES_DIR,
-                                                "daq_v1.0.0.root")).events
+        self.events = OnlineReader(ONLINE_FILE).events
 
     def test_index_lookup(self):
         assert 3 == len(self.events)
@@ -31,8 +30,7 @@ class TestOnlineEvents(unittest.TestCase):
 
 class TestOnlineEvent(unittest.TestCase):
     def setUp(self):
-        self.event = OnlineReader(os.path.join(SAMPLES_DIR,
-                                               "daq_v1.0.0.root")).events[0]
+        self.event = OnlineReader(ONLINE_FILE).events[0]
 
     def test_str(self):
         assert re.match(".*event.*96.*snapshot.*18.*triggered",
@@ -45,8 +43,7 @@ class TestOnlineEvent(unittest.TestCase):
 
 class TestOnlineEventsSnapshotHits(unittest.TestCase):
     def setUp(self):
-        self.events = OnlineReader(os.path.join(SAMPLES_DIR,
-                                                "daq_v1.0.0.root")).events
+        self.events = OnlineReader(ONLINE_FILE).events
         self.lengths = {0: 96, 1: 124, -1: 78}
         self.total_item_count = 298
 
@@ -84,8 +81,7 @@ class TestOnlineEventsSnapshotHits(unittest.TestCase):
 
 class TestOnlineEventsTriggeredHits(unittest.TestCase):
     def setUp(self):
-        self.events = OnlineReader(os.path.join(SAMPLES_DIR,
-                                                "daq_v1.0.0.root")).events
+        self.events = OnlineReader(ONLINE_FILE).events
         self.lengths = {0: 18, 1: 53, -1: 9}
         self.total_item_count = 80
 
@@ -125,8 +121,7 @@ class TestOnlineEventsTriggeredHits(unittest.TestCase):
 
 class TestTimeslices(unittest.TestCase):
     def setUp(self):
-        self.ts = OnlineReader(os.path.join(SAMPLES_DIR,
-                                            "daq_v1.0.0.root")).timeslices
+        self.ts = OnlineReader(ONLINE_FILE).timeslices
 
     def test_data_lengths(self):
         assert 3 == len(self.ts._timeslices["L1"][0])
@@ -151,8 +146,7 @@ class TestTimeslices(unittest.TestCase):
 
 class TestTimeslice(unittest.TestCase):
     def setUp(self):
-        self.ts = OnlineReader(os.path.join(SAMPLES_DIR,
-                                            "daq_v1.0.0.root")).timeslices
+        self.ts = OnlineReader(ONLINE_FILE).timeslices
         self.n_frames = {"L1": [69, 69, 69], "SN": [64, 66, 68]}
 
     def test_str(self):
@@ -165,8 +159,7 @@ class TestTimeslice(unittest.TestCase):
 
 class TestSummaryslices(unittest.TestCase):
     def setUp(self):
-        self.ss = OnlineReader(os.path.join(SAMPLES_DIR,
-                                            "daq_v1.0.0.root")).summaryslices
+        self.ss = OnlineReader(ONLINE_FILE).summaryslices
 
     def test_headers(self):
         assert 3 == len(self.ss.headers)
-- 
GitLab