From 2a29e9145ccc4cc2f37c29d70a756a903bfc494a Mon Sep 17 00:00:00 2001
From: Yngve Inntjore Levinsen <Yngve.Levinsen@esss.se>
Date: Fri, 17 Nov 2017 14:43:20 +0100
Subject: [PATCH] Fix for version 10 PAR_Tot files

---
 ess/TraceWin.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ess/TraceWin.py b/ess/TraceWin.py
index 758d281..45ddf39 100644
--- a/ess/TraceWin.py
+++ b/ess/TraceWin.py
@@ -628,6 +628,8 @@ class density_file:
         while self.i<counter:
             self._getFullContent()
             self.i+=1
+            if sys.flags.debug and self.i%100 == 0:
+                print('Read status',self.i)
 
 
     def _getHeader(self):
@@ -669,15 +671,20 @@ class density_file:
                 numpy.fromfile(self.fin, dtype=numpy.int16, count=356//2)
             else:
                 raise TypeError("It is not possible to read this format..")
+        elif self.Nrun>1:
+            #WARN not 100% sure if this is correct..
+            if self.version<=9:
+                numpy.fromfile(self.fin, dtype=numpy.int16, count=((5588+self.Nrun*12)//2))
+            elif self.version==10:
+                numpy.fromfile(self.fin, dtype=numpy.int16, count=((20796+self.Nrun*12)//2))
+            else:
+                raise TypeError("It is not possible to read this format..")
         elif self.version==8:
             numpy.fromfile(self.fin, dtype=numpy.int16, count=12344//2)
         elif self.version==9:
             numpy.fromfile(self.fin, dtype=numpy.int16, count=12352//2)
         elif self.version==10:
             numpy.fromfile(self.fin, dtype=numpy.int16, count=12408//2)
-        elif self.Nrun>1:
-            #WARN not 100% sure if this is correct..
-            numpy.fromfile(self.fin, dtype=numpy.int16, count=((5588+self.Nrun*12)/2))
         else:
             raise TypeError("It is not possible to read this format..")
 
-- 
GitLab