Merging Traces

From Elsys Wiki - Help and Recources for TranAX and TraNET DAQ
Revision as of 09:33, 13 November 2017 by Mmeier (talk | contribs)
Jump to: navigation, search

With the function MergeTraces you can merge multiple waveforms into one waveform. This can be useful if you want to separate specific events from your measured curve. You are also able to pick single events from a Multiblock measurement and put specific blocks into a new waveform.

Merge events from Continuous Measurement into another trace

If you have a continuous measurement which is fairly long and just have several events which are interesting then you can merge those events into a new trace (tpc5). The function MergeTraces will help you with this task.

; Don't close files
SetEnvironment(1, False)

; Don't save files
SetEnvironment(5, True)

filepath = "mergedTrace.tpc5"
trace0 = File("T1_1428_USS002_16kHz_anschleifen.tpc5", 0)
trace1 = File("T1_1428_USS002_16kHz_anschleifen.tpc5", 1)
trace2 = File("T1_1428_USS002_16kHz_anschleifen.tpc5", 2)
tstart = TBegin(trace2)
tstop = TEnd(trace2)
sliceLength[s] = 170e-6
countEvents = 0

for each timeVal in EnEvents(trace2, 0, tstart, tstop, 1, 0.25) 
    slicedTrace0 = Slice(trace0, timeVal, timeVal + sliceLength)
    slicedTrace1 = Slice(trace1, timeVal, timeVal + sliceLength)
    slicedTrace2 = Slice(trace2, timeVal, timeVal + sliceLength)
    MergeTraces(filepath, "Körperschall (0.A1)", 0, slicedTrace0)
    MergeTraces(filepath, "Körperschall Verst. (0.A2)", 1, slicedTrace1)
    MergeTraces(filepath, "Sync (0.A3)", 2, slicedTrace2)
    countEvents = countEvents + 1
next

CloseFile(filepath)

Graphical result in TranAX YT Waveform

MergedTraces WithoutDelays.png