Skip to content

Commit bc2d6e9

Browse files
committed
SCOPE: Use precise timestamp per TP for tpInput data
In our TP data we used until now only simply DateTime of the moment the data was sent into analysis for the timestamp. This resulted in multiple TPs (all from the same new FIFO data) having nearly the same timestamp. Now the timestamp of each TP based on the acquisition start and TP position in the acquisition is determined. Note regarding the calculation: (tpCounter + i) * tpInput.samplingIntervalDAC * tpInput.tpLengthPointsDAC * MILLI_TO_ONE tpCounter originates from NI devices in TP acquisition mode. There the acquisition with a single TP repeats itself in hardware. The TPs are counted based on the FIFO data and each TP is sent to SCOPE_UpdateOscilloscopeData separately. Thus, i is always zero and tpCounter the number of the TP since acquisition start. For all other hardware devices and acquisition modes tpCounter is zero and i counts the absolute TP number based on the position of the data in the FIFO.
1 parent 07992b0 commit bc2d6e9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Packages/MIES/MIES_Oscilloscope.ipf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ Function SCOPE_UpdateOscilloscopeData(string device, variable dataAcqOrTP, [vari
466466
STRUCT TPAnalysisInput tpInput
467467
variable i, j
468468
variable tpChannels, numADCs, numDACs, tpLengthPointsADC, tpStart, tpEnd, tpStartPos
469-
variable TPChanIndex, saveTP, clampAmp
469+
variable TPChanIndex, saveTP, clampAmp, timeSinceAcqStart, timeOfAcqStartUTC, tpCounter
470470
variable headstage, fifoLatest, channelIndex
471471
string hsList
472472

@@ -489,6 +489,9 @@ Function SCOPE_UpdateOscilloscopeData(string device, variable dataAcqOrTP, [vari
489489
case HARDWARE_NI_DAC:
490490
ASSERT(!ParamIsDefault(deviceID), "optional parameter deviceID missing (required for NI devices in TP mode)")
491491
SCOPE_NI_UpdateOscilloscope(device, dataAcqOrTP, deviceID, fifoPos)
492+
if(dataAcqOrTP == TEST_PULSE_MODE)
493+
tpCounter = ROVar(GetNITestPulseCounter(device))
494+
endif
492495
break
493496
case HARDWARE_SUTTER_DAC:
494497
if(dataAcqOrTP == TEST_PULSE_MODE)
@@ -529,6 +532,8 @@ Function SCOPE_UpdateOscilloscopeData(string device, variable dataAcqOrTP, [vari
529532
numDACs = DimSize(DACs, ROWS)
530533
numADCs = DimSize(ADCs, ROWS)
531534

535+
timeOfAcqStartUTC = ParseISO8601TimeStamp(ROStr(GetLastAcquisitionStartTime(device)))
536+
532537
// note: currently this works for multiplier = 1 only, see DC_PlaceDataInDAQDataWave
533538
Make/FREE/N=(tpLengthPointsADC) channelData
534539
WAVE tpInput.data = channelData
@@ -577,8 +582,9 @@ Function SCOPE_UpdateOscilloscopeData(string device, variable dataAcqOrTP, [vari
577582
endif
578583

579584
// Use same time for all headstages
580-
tpInput.timeStamp = DateTime
581-
tpInput.timeStampUTC = DateTimeInUTC()
585+
timeSinceAcqStart = (tpCounter + i) * tpInput.samplingIntervalDAC * tpInput.tpLengthPointsDAC * MILLI_TO_ONE
586+
tpInput.timeStampUTC = timeOfAcqStartUTC + timeSinceAcqStart
587+
tpInput.timeStamp = UTCTimeToLocal(tpInput.timeStampUTC)
582588
tpInput.sendTPMessage = 1
583589

584590
for(j = 0; j < numADCs; j += 1)

0 commit comments

Comments
 (0)