diff options
Diffstat (limited to 'qolab/data')
-rw-r--r-- | qolab/data/trace.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 5b75fc1..bf7e54f 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -1,16 +1,31 @@ +from qolab.file_utils import save_table_with_header class Trace: def __init__(self, label): self.label = label self.values = None self.unit = None - self.attributes = {} + self.tags = {} def plot(self): import matplotlib.pyplot as plt plt.plot(self.values, label=self.descr) plt.legend() + + def header(self): + header = [] + if self.label is not None: + header.append(f'label = {self.label}') + if self.unit is not None: + header.append(f'unit = {self.unit}') + for k, v in self.tags.items(): + header.append(f'{k} = {v}') + return header + + def write(self, fname): + pass + class TraceXY: def __init__(self, label): self.label = label |