From b32a09c03fdaabd342f44f3356295cb9fb9b02f9 Mon Sep 17 00:00:00 2001
From: Yngve Levinsen <yngve@pm.me>
Date: Fri, 6 Jul 2018 10:10:18 +0200
Subject: [PATCH] fix dst file format

---
 scripts/ibsimu2tw | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
 mode change 100644 => 100755 scripts/ibsimu2tw

diff --git a/scripts/ibsimu2tw b/scripts/ibsimu2tw
old mode 100644
new mode 100755
index 4c628b8..16349f5
--- a/scripts/ibsimu2tw
+++ b/scripts/ibsimu2tw
@@ -81,14 +81,14 @@ def save_dst(file_name, x6, Ibeam, mc2=938.272, freq=352.21):
 
     x6 = numpy.reshape(x6, (numpy.size(x6)))    
     with open(file_name, 'wb') as file:
-        out  = struct.pack('b'             , 125        )
-        out += struct.pack('b'             , 100        )
-        out += struct.pack('i'             , len(x6) )
-        out += struct.pack('d'             , Ibeam      )
-        out += struct.pack('d'             , freq       )
-        out += struct.pack('b'             , 125        )  # Typo in the manual !!!!
-        out += struct.pack('%s'%len(x6)+'d', *x6        )
-        out += struct.pack('d'             , mc2        )
+        out  = struct.pack('b'                  , 125        )
+        out += struct.pack('b'                  , 100        )
+        out += struct.pack('i'                  , len(x6)//6 )
+        out += struct.pack('d'                  , Ibeam      )
+        out += struct.pack('d'                  , freq       )
+        out += struct.pack('b'                  , 125        )  # Typo in the manual !!!!
+        out += struct.pack('{}d'.format(len(x6)), *x6        )
+        out += struct.pack('d'                  , mc2        )
         file.write(out)
 
 #-- Parameters from the header
-- 
GitLab