From 811d3a6350dfd32e6c5e886e7b045cfa1f0126b8 Mon Sep 17 00:00:00 2001 From: Carlo Tibaldi <tlbl@dtu.dk> Date: Fri, 1 Apr 2016 11:34:27 +0200 Subject: [PATCH] some fixes to pass tests :) --- wetb/hawc2/Hawc2io.py | 4 ++-- wetb/prepost/windIO.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/wetb/hawc2/Hawc2io.py b/wetb/hawc2/Hawc2io.py index 2ec8def..ac8d28c 100644 --- a/wetb/hawc2/Hawc2io.py +++ b/wetb/hawc2/Hawc2io.py @@ -90,8 +90,8 @@ class ReadHawc2(object): Name = []; Unit = []; Description = []; for i in range(0, self.NrCh): temp = str(Lines[i + 12][12:43]); Name.append(temp.strip()) - temp = str(Lines[i + 12][43:48]); Unit.append(temp.strip()) - temp = str(Lines[i + 12][49:]); Description.append(temp.strip()) + temp = str(Lines[i + 12][43:54]); Unit.append(temp.strip()) + temp = str(Lines[i + 12][54:-1]); Description.append(temp.strip()) self.ChInfo = [Name, Unit, Description] # if binary file format, scaling factors are read if Format.lower() == 'binary': diff --git a/wetb/prepost/windIO.py b/wetb/prepost/windIO.py index 84f022c..942f8df 100755 --- a/wetb/prepost/windIO.py +++ b/wetb/prepost/windIO.py @@ -129,13 +129,26 @@ class LoadResults(ReadHawc2): ReadOnly = 0 if readdata else 1 super(LoadResults, self).__init__(FileName, ReadOnly=ReadOnly) + self.FileType = self.FileFormat[6:] + self.N = int(self.NrSc) + self.Nch = int(self.NrCh) + self.ch_details = np.ndarray(shape=(self.Nch,3),dtype='<U100') + for ic in range(self.Nch): + self.ch_details[ic, 0] = self.ChInfo[0][ic] + self.ch_details[ic, 1] = self.ChInfo[1][ic] + self.ch_details[ic, 2] = self.ChInfo[2][ic] + ChVec = [] if usecols is None else usecols - self.sig = super(LoadResults, self).__call__(ChVec=ChVec) + + self._unified_channel_names() + if readdata: + self.sig = super(LoadResults, self).__call__(ChVec=ChVec) if self.debug: stop = time() - start print('time to load HAWC2 file:', stop, 's') + def reformat_sig_details(self): """Change HAWC2 output description of the channels short descriptive strings, usable in plots -- GitLab