aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2022-01-07 21:21:38 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2022-01-07 21:21:38 -0500
commit7f60f4f4ad6bf4ed523e70ee7bd4a70c4dc22bb4 (patch)
tree71bc2ef4b085b455be7da92def4800375174d119
parentc89373ef2759d398459848eab30fbb0be5206408 (diff)
downloadpyExpControl-7f60f4f4ad6bf4ed523e70ee7bd4a70c4dc22bb4.tar.gz
pyExpControl-7f60f4f4ad6bf4ed523e70ee7bd4a70c4dc22bb4.zip
added repr for Trace TraceXY and improve SameXSetTrace
-rw-r--r--qolab/data/trace.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py
index 6519c05..0b0a163 100644
--- a/qolab/data/trace.py
+++ b/qolab/data/trace.py
@@ -117,6 +117,11 @@ class Trace:
if self.values is not None:
self.values = np.empty(0, dtype=self.values.dtype)
+ def __repr__(self):
+ lbl = self.config['label']
+ cls_name = f"{self.__class__.__name__}('{lbl}'"
+ return "".join([cls_name, f', N={self.values.size}', ')'])
+
def plot(self):
import matplotlib.pyplot as plt
x=self.values
@@ -171,6 +176,14 @@ class TraceXY(Trace):
if self.y is not None:
self.y.clear_data()
+ def __repr__(self):
+ lbl = self.config['label']
+ cls_name = f"{self.__class__.__name__}('{lbl}'"
+ xlabel= f"{self.x.config['label']}"
+ xparam= f", {self.x}"
+ yparam= f", {self.y}"
+ return "".join([cls_name, xparam, yparam, ')'])
+
def plot(self):
import matplotlib.pyplot as plt
x=self.x.values
@@ -224,11 +237,11 @@ class TraceSetSameX(Trace):
tr.clear_data()
def __repr__(self):
- cls_name = f'{self.__class__.__name__}('
- xlabel= f"{self.x.config['label']}"
- xparam= f"x: '{xlabel}'"
- yparam = f"traces: {list(self.traces.keys())}"
- return "".join([cls_name, xparam, ', ', yparam, f', N={self.x.values.size}', ')'])
+ lbl = self.config['label']
+ cls_name = f"{self.__class__.__name__}('{lbl}'"
+ xparam= f", x: {self.x}"
+ yparam = f", traces: {list(self.traces.keys())}"
+ return "".join([cls_name, xparam, yparam, ')'])
def addTraceX(self, tr):
self.x = tr