aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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