From 5e0362ae906980d7992c8a7d043078637b3ed5ec Mon Sep 17 00:00:00 2001
From: Tamas Gal <tgal@km3net.de>
Date: Mon, 3 Jun 2019 16:50:06 +0200
Subject: [PATCH] Use DU in filename

---
 scripts/pmt_hrv.py   | 27 +++++++++++++--------------
 scripts/pmt_rates.py |  2 +-
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/scripts/pmt_hrv.py b/scripts/pmt_hrv.py
index feb22bd..2ba5f8a 100755
--- a/scripts/pmt_hrv.py
+++ b/scripts/pmt_hrv.py
@@ -50,7 +50,8 @@ class PMTHRV(kp.Module):
         self.du = self.require("du")
         self.interval = self.get("interval", default=10)
         self.plot_path = self.get("plot_path", default="plots")
-        self.filename = self.get("filename", default="pmt_hrv.png")
+        self.filename = self.get("filename",
+                                 default=f"pmt_hrv_du{self.du}.png")
         self.max_x = 800
         self.index = 0
         self.hrv = defaultdict(list)
@@ -166,19 +167,17 @@ def main():
     detector = kp.hardware.Detector(det_id=det_id)
 
     pipe = kp.Pipeline(timeit=True)
-    pipe.attach(
-        kp.io.ch.CHPump,
-        host=ligier_ip,
-        port=ligier_port,
-        tags='IO_MONIT',
-        timeout=60 * 60 * 24 * 7,
-        max_queue=2000)
-    pipe.attach(
-        PMTHRV,
-        detector=detector,
-        du=du,
-        interval=interval,
-        plot_path=plot_path)
+    pipe.attach(kp.io.ch.CHPump,
+                host=ligier_ip,
+                port=ligier_port,
+                tags='IO_MONIT',
+                timeout=60 * 60 * 24 * 7,
+                max_queue=2000)
+    pipe.attach(PMTHRV,
+                detector=detector,
+                du=du,
+                interval=interval,
+                plot_path=plot_path)
     pipe.drain()
 
 
diff --git a/scripts/pmt_rates.py b/scripts/pmt_rates.py
index e1b4406..ff9c9e4 100755
--- a/scripts/pmt_rates.py
+++ b/scripts/pmt_rates.py
@@ -51,7 +51,7 @@ class PMTRates(kp.Module):
         self.interval = self.get("interval", default=10)
         self.plot_path = self.get("plot_path", default="plots")
         self.filename = self.get("filename",
-                                 default=f"pmt_rates_{self.du}.png")
+                                 default=f"pmt_rates_du{self.du}.png")
         self.lowest_rate = self.get("lowest_rate", default=5000)
         self.highest_rate = self.get("highest_rate", default=15000)
         self.max_x = 800
-- 
GitLab