diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-18 15:18:36 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-18 15:18:36 -0500 |
commit | ba289500ab460d2f60e88956ff525c11f40e2f14 (patch) | |
tree | 4824c285d3b9329ffa7afbc558c5156f6b14fe82 /qolab/data/trace.py | |
parent | cace8baf915676ba999e01902147aef5050c706f (diff) | |
download | pyExpControl-ba289500ab460d2f60e88956ff525c11f40e2f14.tar.gz pyExpControl-ba289500ab460d2f60e88956ff525c11f40e2f14.zip |
clear_data method for traces
Diffstat (limited to 'qolab/data/trace.py')
-rw-r--r-- | qolab/data/trace.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 15711f6..f6c6e68 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -17,7 +17,12 @@ class Trace: self.config['unit'] = None self.config['tags'] = {} self.values = np.empty(0) + self.clear_data() + + def clear_data(self): self.last_saved_pos = 0 + if self.values is not None: + self.values = np.empty(0, dtype=self.values.dtype) def plot(self): import matplotlib.pyplot as plt @@ -57,7 +62,14 @@ class TraceXY(Trace): self.config['tags'] = {} self.x = None self.y = None + self.clear_data() + + def clear_data(self): self.last_saved_pos = 0 + if self.x is not None: + self.x.clear_data() + if self.y is not None: + self.y.clear_data() def plot(self): import matplotlib.pyplot as plt @@ -97,7 +109,15 @@ class TraceSetSameX(Trace): self.config['tags'] = {} self.x = None self.traces={} + self.clear_data() + + def clear_data(self): self.last_saved_pos = 0 + if self.x is not None: + self.x.clear_data() + for k, tr in self.traces.items(): + tr.clear_data() + def addTrace(self, tr): if len(self.traces) == 0: |