From eaa022cbb56575c3b6d882c503402685644743d4 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 21 Dec 2021 00:25:15 -0500 Subject: redone trace configuration --- qolab/data/trace.py | 12 +++++++++--- 1 file 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 -- cgit v1.2.3