diff options
Diffstat (limited to 'qolab/data/trace.py')
-rw-r--r-- | qolab/data/trace.py | 17 |
1 files changed, 15 insertions, 2 deletions
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 |