diff --git a/ess/TraceWin.py b/ess/TraceWin.py index 4eaf6dddb47ed03b1c8b6a704ae3cc7fa80eeb51..fdfe8e6dd2e516e4edddf87747f7fea780788521 100644 --- a/ess/TraceWin.py +++ b/ess/TraceWin.py @@ -42,15 +42,20 @@ class dst: self.Ib=Header['Ib'][0] self.freq=Header['freq'][0] - Table=numpy.fromfile(fin, dtype=numpy.float64, count=self.Np*6) - self._data=Table.reshape(self.Np,6) + # Some toutatis distributions has an undocumented 7th line of 0's + Table=numpy.fromfile(fin, dtype=numpy.float64, count=self.Np*7+1) + if len(Table)==self.Np*7+1: + self._data=Table[:-1].reshape(self.Np,7) + elif len(Table)==self.Np*6+1: # this is true in most cases + self._data=Table[:-1].reshape(self.Np,6) + else: + raise ValueError("Incorrect table dimensions found:",len(Table)) # convert x,y from cm to m: self._data[:,0]*=1e-2 self._data[:,2]*=1e-2 - Footer=numpy.fromfile(fin, dtype=numpy.float64, count=1) - self.mass=Footer[0] + self.mass=Table[-1] def keys(self): return self._columns[:]