diff options
-rw-r--r-- | qolab/data/trace.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 4c42cd0..d187575 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -14,12 +14,17 @@ class Trace: def __init__(self, label): self.config = {} self.config['label'] = label - self.config['unit'] = None self.config['tags'] = {} self.item_format='.15e' - self.values = np.empty(0) + self.last_saved_pos = 0 + self._trace_specific_init() self.clear_data() + def _trace_specific_init(self): + self.config['unit'] = None + self.values = np.empty(0) + self.last_saved_pos = 0 + def clear_last_saved_pos(self): self.last_saved_pos = 0 @@ -61,13 +66,11 @@ class Trace: class TraceXY(Trace): def __init__(self, label): - self.config = {} - self.config['label'] = label - self.item_format='.15e' - self.config['tags'] = {} + super().__init__(label) + + def _trace_specific_init(self): self.x = None self.y = None - self.clear_data() def clear_data(self): self.clear_last_saved_pos() @@ -109,13 +112,11 @@ class TraceXY(Trace): class TraceSetSameX(Trace): def __init__(self, label): - self.config = {} - self.config['label'] = label - self.item_format='.15e' - self.config['tags'] = {} + super().__init__(label) + + def _trace_specific_init(self): self.x = None self.traces={} - self.clear_data() def clear_data(self): self.clear_last_saved_pos() |