From 012df28894710c36bc24623fd48f93b45b6a0611 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 14 Dec 2021 12:27:06 -0500 Subject: added incremental save capability --- qolab/data/trace.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qolab/data/trace.py b/qolab/data/trace.py index e81cced..d0d069f 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -35,8 +35,15 @@ class Trace: def getHeader(self, prefix=''): return headerFronDictionary(self.getConfig(), prefix='') - def save(self, fname, item_format='e', **kwargs): - fname = save_table_with_header(fname, self.getData(), self.getHeader(), item_format=item_format, **kwargs) + def save(self, fname, item_format='e', last_saved_pos=None, skip_headers_if_file_exist=False, **kwargs): + if last_saved_pos is None: + last_saved_pos = self.last_saved_pos + data = self.getData() + if last_saved_pos > 0: + skip_headers_if_file_exist=True + print(skip_headers_if_file_exist) + fname = save_table_with_header(fname, data[last_saved_pos:,:], self.getHeader(), item_format=item_format, skip_headers_if_file_exist=skip_headers_if_file_exist, **kwargs) + self.last_saved_pos = data.shape[0] return(fname) def addPoint(self, val): -- cgit v1.2.3