From 3a0c79e189c9065bacb2484bd68f86c09180b16c Mon Sep 17 00:00:00 2001
From: Jure Bericic <jure.bericic@gmail.com>
Date: Tue, 13 Dec 2016 22:02:33 -0500
Subject: [PATCH] Fixed two bugs in merge_maps.py.

---
 MAPS/merge_maps.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/MAPS/merge_maps.py b/MAPS/merge_maps.py
index 3bb9cd72..6f0fab76 100644
--- a/MAPS/merge_maps.py
+++ b/MAPS/merge_maps.py
@@ -58,6 +58,7 @@ class Slot:
         string = 'SLOT={0.ID}'.format(self)
         if self.comment != '':
             string += '  ! {0.comment}'.format(self)
+        string += '\n'
         for k, v in self.KWs.items():
             if v > -1:
                 string += '{}={}\n'.format(k, v)
@@ -107,12 +108,13 @@ header = {
     "signals": [],
 }
 
-detectors = [Detector()]
+detectors = []
 
 
 for fileName in fileNames:
     # Track detector IDs in current file.
     currentIDs = []
+    detectors.append(Detector())
 
     with open(fileName, 'r') as fi:
         for line in fi:
@@ -246,7 +248,7 @@ with open(mergedName, 'w') as fo:
                     fo.write('\n{}\n'.format(roc))
 
                     for slot in roc.slots:
-                        fo.write('\n{}\n'.format(slot))
+                        fo.write('\n{}'.format(slot))
 
                         for channel in slot.channels:
                             fo.write('{}\n'.format(channel))
-- 
GitLab