diff options
Diffstat (limited to 'qolab/data')
-rw-r--r-- | qolab/data/trace.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 1c9e1d8..dccc2f7 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -1,4 +1,5 @@ from qolab.file_utils import save_table_with_header + class Trace: def __init__(self, label): self.label = label @@ -22,9 +23,8 @@ class Trace: prefixed_header = [prefix+l for l in header] return prefixed_header - def write(self, fname): - pass - + def write(self, fname, item_format='e'): + save_table_with_header(fname, self.values, self.header(), item_format=item_format) class TraceXY: @@ -97,11 +97,16 @@ class TraceSetSameX: if __name__ == '__main__': + import numpy as np + print("Testing trace") x=Trace('x trace') + x.values = np.random.normal(2,2,(4,2)) x.unit='s' x.tags['x_tag'] = 'xxxx' x.tags['x_tag2'] = 'xxxx' + x.write('xtrace.dat') y=Trace('y trace') + y.values = np.random.normal(2,2,(4,2)) y.unit='V' y.tags['y_tag'] = 'yyyy' xy=TraceXY('xy trace') |