aboutsummaryrefslogtreecommitdiff
path: root/qolab/data/trace.py
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-14 12:27:06 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-14 12:27:06 -0500
commit012df28894710c36bc24623fd48f93b45b6a0611 (patch)
treeab3a312d56725a6c867f69f476a3b773369457cb /qolab/data/trace.py
parentb490617894a5259653d466c2a1a3f88f91dec55d (diff)
downloadpyExpControl-012df28894710c36bc24623fd48f93b45b6a0611.tar.gz
pyExpControl-012df28894710c36bc24623fd48f93b45b6a0611.zip
added incremental save capability
Diffstat (limited to 'qolab/data/trace.py')
-rw-r--r--qolab/data/trace.py11
1 files 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):