diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-04 22:46:20 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-04 22:46:20 -0500 |
commit | 6e7d8cddcee48def6e5c7e3b27386f4ebda7f96d (patch) | |
tree | 48cbea76ff7dabee3810c8a5f838155a601f338f /qolab/data/trace.py | |
parent | c2d9c4ae0f59f848abc71c59866181fbf45f552b (diff) | |
download | qolab-6e7d8cddcee48def6e5c7e3b27386f4ebda7f96d.tar.gz qolab-6e7d8cddcee48def6e5c7e3b27386f4ebda7f96d.zip |
added header for trace
Diffstat (limited to 'qolab/data/trace.py')
-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 |