From f55a255f303dcef8254beb4f9afbea1a3ae088e8 Mon Sep 17 00:00:00 2001 From: Yngve Levinsen <yngve@pm.me> Date: Tue, 8 Jan 2019 13:38:29 +0100 Subject: [PATCH] ess.TraceWin.density_file can now read version 11 as well --- ess/TraceWin.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ess/TraceWin.py b/ess/TraceWin.py index d0b6501..f9c913d 100644 --- a/ess/TraceWin.py +++ b/ess/TraceWin.py @@ -625,6 +625,10 @@ class density_file: self._max = numpy.zeros((counter, 7)) self._min = numpy.zeros((counter, 7)) + if self.version >= 11: + self.phaseF = numpy.zeros((counter)) + self.phaseG = numpy.zeros((counter)) + if self.version >= 10: self.maxR = numpy.zeros((counter, 7)) self.minR = numpy.zeros((counter, 7)) @@ -714,6 +718,8 @@ class density_file: 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.version == 11: + numpy.fromfile(self.fin, dtype=numpy.int16, count=12416 // 2) else: raise TypeError("It is not possible to read this format..") @@ -737,7 +743,8 @@ class density_file: # self._getHeader() # no need to read the header again: # (though only if we are SURE about content!) - numpy.fromfile(self.fin, dtype=numpy.int16, count=5) + ver,year,vlong = numpy.fromfile(self.fin, dtype=numpy.int16, count=3) + Nrun = numpy.fromfile(self.fin, dtype=numpy.int32, count=1)[0] self.nelp[self.i] = numpy.fromfile(self.fin, dtype=numpy.int32, count=1)[0] self.ib[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0] @@ -758,6 +765,10 @@ class density_file: self._max[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:] self._min[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:] + if self.version >= 11: + self.phaseF[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0] + self.phaseG[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0] + if self.version >= 10: self.maxR[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:] self.minR[self.i] = numpy.fromfile(self.fin, dtype=numpy.float32, count=n)[:] -- GitLab