aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-21 00:25:15 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-21 00:25:15 -0500
commiteaa022cbb56575c3b6d882c503402685644743d4 (patch)
treebeff75238a09928bf5507a1dab5c1fa715e8bebe
parentba557369ac09888cbebe63a7a07ef7c660b6853e (diff)
downloadqolab-eaa022cbb56575c3b6d882c503402685644743d4.tar.gz
qolab-eaa022cbb56575c3b6d882c503402685644743d4.zip
redone trace configuration
-rw-r--r--qolab/data/trace.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py
index 009ce2d..5fbaaf9 100644
--- a/qolab/data/trace.py
+++ b/qolab/data/trace.py
@@ -19,12 +19,14 @@ class Trace:
def __init__(self, label):
self.config = {}
self.config['label'] = label
+ self.config['model'] = 'Trace'
+ self.config['version'] = '0.1'
# 'type' is useful to indicate way of representation, make sense on y_vs_x traces
# if set to none we have normal y vs x
# if set to 'timestamp' x will be converted to datetime dates
self.config['type'] = None
+ self.config['item_format']='.15e'
self.config['tags'] = {}
- self.item_format='.15e'
self.last_saved_pos = 0
self._trace_specific_init()
self.clear_data()
@@ -57,7 +59,9 @@ class Trace:
return( self.values )
def getHeader(self, prefix=''):
- return headerFromDictionary(self.getConfig(), prefix='')
+ d ={}
+ d['config'] = self.getConfig()
+ return headerFromDictionary(d, prefix='')
def save(self, fname, last_saved_pos=None, skip_headers_if_file_exist=False, **kwargs):
if last_saved_pos is None:
@@ -65,7 +69,7 @@ class Trace:
data = self.getData()
if last_saved_pos > 0:
skip_headers_if_file_exist=True
- fname = save_table_with_header(fname, data[last_saved_pos:,:], self.getHeader(), item_format=self.item_format, skip_headers_if_file_exist=skip_headers_if_file_exist, **kwargs)
+ fname = save_table_with_header(fname, data[last_saved_pos:,:], self.getHeader(), item_format=self.config['item_format'], skip_headers_if_file_exist=skip_headers_if_file_exist, **kwargs)
self.last_saved_pos = data.shape[0]
return(fname)
@@ -76,6 +80,7 @@ class Trace:
class TraceXY(Trace):
def __init__(self, label):
super().__init__(label)
+ self.config['model'] = 'TraceXY'
def _trace_specific_init(self):
self.x = None
@@ -126,6 +131,7 @@ class TraceXY(Trace):
class TraceSetSameX(Trace):
def __init__(self, label):
super().__init__(label)
+ self.config['model'] = 'TraceSetSameX'
def _trace_specific_init(self):
self.x = None