From 3a5f4f4d517e854fb9b4e0f723c9f6de91f812b5 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Sat, 18 Dec 2021 22:15:38 -0500 Subject: united trace initialization --- qolab/data/trace.py | 25 +++++++++++++------------ 1 file 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() -- cgit v1.2.3