From 6188068541c86bd5606b23f4310ad05a70317528 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 21 Dec 2021 01:18:14 -0500 Subject: added load of TraceXY --- qolab/data/trace.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'qolab') diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 0a16ab2..4a96691 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -35,6 +35,9 @@ def loadTraceRawHeaderAndData(fname): def loadTrace(fname): (header, data) = loadTraceRawHeaderAndData(fname) + return traceFromHeaderAndData(header, data) + +def traceFromHeaderAndData(header, data=None): label = None model = None tr = None @@ -53,10 +56,20 @@ def loadTrace(fname): tr = Trace(label) if data is not None: tr.values = data - elif 'model' == 'TraceXY': + elif model == 'TraceXY': + tx = traceFromHeaderAndData(header['TraceX']) + ty = traceFromHeaderAndData(header['TraceY']) + if data is not None: + tx.values=data[:,0] + ty.values=data[:,1] tr = TraceXY(label) - elif 'model' == 'TraceSetSameX': + tr.x = tx + tr.y = ty + elif model == 'TraceSetSameX': tr = TraceSetSameX(label) + else: + print(f'Error: unknown trace model: {model}') + return None tr.config = header['config'] return tr -- cgit v1.2.3