Skip to content
Snippets Groups Projects
Commit 19b0043f authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

made gtsdf similar to other formats in hawc2io and chaned htcFile to add...

made gtsdf similar to other formats in hawc2io and chaned htcFile to add OutputSection if name is output
parent c3f3b167
No related branches found
No related tags found
No related merge requests found
......@@ -159,7 +159,7 @@ class ReadHawc2(object):
self._ReadSensorFile()
elif FileName.lower().endswith('.hdf5') or os.path.isfile(self.FileName + ".hdf5"):
self.FileFormat = 'GTSDF'
self.ReadAll()
self.ReadGtsdf()
else:
print ("unknown file: " + FileName)
################################################################################
......@@ -197,14 +197,15 @@ class ReadHawc2(object):
def ReadGtsdf(self):
self.t, data, info = gtsdf.load(self.FileName + '.hdf5')
self.Time = self.t
self.ChInfo = [info['attribute_names'],
info['attribute_units'],
info['attribute_descriptions']]
self.NrCh = data.shape[1]
self.ChInfo = [['Time'] + info['attribute_names'],
['s'] + info['attribute_units'],
['Time'] + info['attribute_descriptions']]
self.NrCh = data.shape[1] + 1
self.NrSc = data.shape[0]
self.Freq = self.NrSc / self.Time
self.FileFormat = 'GTSDF'
self.gtsdf_description = info['description']
data = np.hstack([self.Time[:,np.newaxis], data])
return data
################################################################################
# One stop call for reading all data formats
......
......@@ -131,7 +131,12 @@ class HTCContents(object):
def add_section(self, name, allow_duplicate=False):
if name in self and allow_duplicate is False:
return self[name]
section = HTCSection(name)
if name == "output":
section = HTCOutputSection(name)
elif name.startswith("output_at_time"):
section = HTCOutputAtTimeSection(name)
else:
section = HTCSection(name)
self._add_contents(section)
return section
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment