diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-03 18:50:50 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-03 18:50:50 -0500 |
commit | d44e964463134d8fcc0d196a802269a9f02d76b6 (patch) | |
tree | 08820b9475dcfccc0de7f442dee802ce07ef5128 /qolab/data | |
parent | fb5a4261cf9d108a6bac1220e5a395f3176bdd4b (diff) | |
download | qolab-d44e964463134d8fcc0d196a802269a9f02d76b6.tar.gz qolab-d44e964463134d8fcc0d196a802269a9f02d76b6.zip |
get rid of descr attribute
Diffstat (limited to 'qolab/data')
-rw-r--r-- | qolab/data/trace.py | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 488bcfd..5b75fc1 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -1,8 +1,7 @@ class Trace: - def __init__(self, descrStr): - self.descr = descrStr + def __init__(self, label): + self.label = label self.values = None - self.label = None self.unit = None self.attributes = {} @@ -13,33 +12,33 @@ class Trace: class TraceXY: - def __init__(self, descrStr): - self.descr = descrStr - self.x = Trace('x_values') - self.y = Trace('y_values') + def __init__(self, label): + self.label = label + self.x = None + self.y = None def plot(self): import matplotlib.pyplot as plt - plt.plot(self.x.values, self.y.values, label=self.descr) + plt.plot(self.x.values, self.y.values, label=self.label) plt.legend() plt.xlabel(self.x.label) class TraceSetSameX: - def __init__(self, descrStr): - self.descr = descrStr - self.x = Trace('x_values') + def __init__(self, label): + self.label = label + self.x = None self.traces={} def addTrace(self, tr): if len(self.traces) == 0: self.x = tr.x trY = tr.y - self.traces[tr.descr]=trY + self.traces[tr.label]=trY def plot(self): import matplotlib.pyplot as plt for k, tr in self.traces.items(): - plt.plot(self.x.values, tr.values, label=tr.descr) + plt.plot(self.x.values, tr.values, label=tr.label) plt.xlabel(self.x.label) plt.legend() @@ -49,9 +48,9 @@ class TraceSetSameX: def keys(self): return (self.traces.keys()) - def getTrace(self, name): - tr = TraceXY(name) + def getTrace(self, label): + tr = TraceXY(label) tr.x = self.x - tr.y = self.traces[name] + tr.y = self.traces[label] return (tr) |