Commit 24495cb0 authored by David GEISSBUHLER's avatar David GEISSBUHLER
Browse files

save dataset

parent 98a46371
......@@ -127,6 +127,20 @@ stream1 = stream0.filter(process_frame = lambda data: data)
stream2 = stream1.filter(process_frame = test)
stream0.put(data_a[0])
# test saving
fo = StreamFile('api_test2.h5', mode='w')
stream = Stream('test')
stream.save(fo)
for i in range(data_a.shape[0]):
stream.put(data_a[i])
# test written file
fi = StreamFile('api_test2.h5', mode='r')
stream = Stream('test', fi)
data = stream.load()
print(data.shape)
###########
......
......@@ -439,7 +439,7 @@ class StreamAdjust(StreamFilter):
self.file = file
def put(self, data, timestamp=None):
if self.file is not None and isinstance(file, StreamFile):
if self.file is not None and isinstance(self.file, StreamFile):
self.file.put_frame(self.name, data)
else:
raise(Exception('save: file is not defined'))
......
......@@ -131,3 +131,7 @@ class StreamFile:
# TODO rotate if requested
return data
# write frame data
def put_frame(self, name, data):
self.hdf5_file.append(name, data)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment