diff --git a/Packages/MIES/MIES_Oscilloscope.ipf b/Packages/MIES/MIES_Oscilloscope.ipf index 6d7c701c44..3e91a39bfe 100644 --- a/Packages/MIES/MIES_Oscilloscope.ipf +++ b/Packages/MIES/MIES_Oscilloscope.ipf @@ -479,7 +479,7 @@ Function SCOPE_UpdateOscilloscopeData(device, dataAcqOrTP, [chunk, fifoPos, devi STRUCT TPAnalysisInput tpInput variable i, j - variable tpChannels, numADCs, numDACs, tpLengthPoints, tpStart, tpEnd, tpStartPos + variable tpChannels, numADCs, numDACs, tpLengthPointsADC, tpStart, tpEnd, tpStartPos variable TPChanIndex, saveTP, clampAmp variable headstage, fifoLatest, channelIndex string hsList @@ -530,10 +530,10 @@ Function SCOPE_UpdateOscilloscopeData(device, dataAcqOrTP, [chunk, fifoPos, devi WAVE TPSettings = GetTPSettings(device) WAVE TPSettingsCalc = GetTPSettingsCalculated(device) - tpLengthPoints = (dataAcqOrTP == TEST_PULSE_MODE) ? TPSettingsCalc[%totalLengthPointsTP_ADC] : TPSettingsCalc[%totalLengthPointsDAQ_ADC] + tpLengthPointsADC = (dataAcqOrTP == TEST_PULSE_MODE) ? TPSettingsCalc[%totalLengthPointsTP_ADC] : TPSettingsCalc[%totalLengthPointsDAQ_ADC] // use a 'virtual' end position for fifoLatest for TP Mode since the input data contains one TP only - fifoLatest = (dataAcqOrTP == TEST_PULSE_MODE) ? tpLengthPoints : fifoPos + fifoLatest = (dataAcqOrTP == TEST_PULSE_MODE) ? tpLengthPointsADC : fifoPos WAVE ADCs = GetADCListFromConfig(config) WAVE DACs = GetDACListFromConfig(config) @@ -544,33 +544,40 @@ Function SCOPE_UpdateOscilloscopeData(device, dataAcqOrTP, [chunk, fifoPos, devi numADCs = DimSize(ADCs, ROWS) // note: currently this works for multiplier = 1 only, see DC_PlaceDataInDAQDataWave - Make/FREE/N=(tpLengthPoints) channelData + Make/FREE/N=(tpLengthPointsADC) channelData WAVE tpInput.data = channelData - tpInput.device = device - tpInput.duration = (dataAcqOrTP == TEST_PULSE_MODE) ? TPSettingsCalc[%pulseLengthPointsTP_ADC] : TPSettingsCalc[%pulseLengthPointsDAQ_ADC] - tpInput.baselineFrac = TPSettingsCalc[%baselineFrac] - tpInput.tpLengthPoints = tpLengthPoints - tpInput.readTimeStamp = ticks * TICKS_TO_SECONDS - tpInput.activeADCs = tpChannels - - tpStart = trunc(fifoPosGlobal / tpLengthPoints) - tpEnd = trunc(fifoLatest / tpLengthPoints) + tpInput.device = device + tpInput.tpLengthPointsADC = tpLengthPointsADC + tpInput.pulseLengthPointsADC = (dataAcqOrTP == TEST_PULSE_MODE) ? TPSettingsCalc[%pulseLengthPointsTP_ADC] : TPSettingsCalc[%pulseLengthPointsDAQ_ADC] + tpInput.pulseStartPointsADC = (dataAcqOrTP == TEST_PULSE_MODE) ? TPSettingsCalc[%pulseStartPointsTP_ADC] : TPSettingsCalc[%pulseStartPointsDAQ_ADC] + tpInput.samplingIntervalADC = DimDelta(scaledDataWave[numDACs], ROWS) + tpInput.tpLengthPointsDAC = (dataAcqOrTP == TEST_PULSE_MODE) ? TPSettingsCalc[%totalLengthPointsTP] : TPSettingsCalc[%totalLengthPointsDAQ] + tpInput.pulseLengthPointsDAC = (dataAcqOrTP == TEST_PULSE_MODE) ? TPSettingsCalc[%pulseLengthPointsTP] : TPSettingsCalc[%pulseLengthPointsDAQ] + tpInput.pulseStartPointsDAC = (dataAcqOrTP == TEST_PULSE_MODE) ? TPSettingsCalc[%pulseStartPointsTP] : TPSettingsCalc[%pulseStartPointsDAQ] + tpInput.samplingIntervalDAC = DimDelta(scaledDataWave[0], ROWS) + tpInput.baselineFrac = TPSettingsCalc[%baselineFrac] + tpInput.readTimeStamp = ticks * TICKS_TO_SECONDS + tpInput.activeADCs = tpChannels + tpInput.cycleId = ROVAR(GetTestpulseCycleID(device)) + + tpStart = trunc(fifoPosGlobal / tpLengthPointsADC) + tpEnd = trunc(fifoLatest / tpLengthPointsADC) ASSERT(tpStart <= tpEnd, "New fifopos is smaller than previous fifopos") Make/FREE/D/N=(tpEnd - tpStart) tpMarker NewRandomSeed() tpMarker[] = GetUniqueInteger() DEBUGPRINT("tpChannels: ", var = tpChannels) - DEBUGPRINT("tpLength: ", var = tpLengthPoints) + DEBUGPRINT("tpLength: ", var = tpLengthPointsADC) for(i = tpStart; i < tpEnd; i += 1) tpInput.measurementMarker = tpMarker[i - tpStart] - tpStartPos = i * tpLengthPoints + tpStartPos = i * tpLengthPointsADC if(saveTP) - Make/FREE/N=(tpLengthPoints, tpChannels) StoreTPWave + Make/FREE/N=(tpLengthPointsADC, tpChannels) StoreTPWave for(j = 0; j < tpChannels; j += 1) WAVE scaledChannel = scaledDataWave[numDACs + j] Multithread StoreTPWave[][j] = scaledChannel[tpStartPos + p] @@ -580,6 +587,10 @@ Function SCOPE_UpdateOscilloscopeData(device, dataAcqOrTP, [chunk, fifoPos, devi hsList = "" endif + // Use same time for all headstages + tpInput.timeStamp = DateTime + tpInput.timeStampUTC = DateTimeInUTC() + for(j = 0; j < numADCs; j += 1) if(ADCmode[j] == DAQ_CHANNEL_TYPE_TP) @@ -622,7 +633,7 @@ Function SCOPE_UpdateOscilloscopeData(device, dataAcqOrTP, [chunk, fifoPos, devi endfor if(dataAcqOrTP == DATA_ACQUISITION_MODE && tpEnd > tpStart) - tpStartPos = (tpEnd - 1) * tpLengthPoints + tpStartPos = (tpEnd - 1) * tpLengthPointsADC if(DAG_GetNumericalValue(device, "check_settings_show_power")) WAVE tpOsciForPowerSpectrum = GetScaledTPTempWave(device) Make/FREE/D/N=(numADCs) tpColumns diff --git a/Packages/MIES/MIES_Structures.ipf b/Packages/MIES/MIES_Structures.ipf index 5ef93391a7..7b86357123 100644 --- a/Packages/MIES/MIES_Structures.ipf +++ b/Packages/MIES/MIES_Structures.ipf @@ -306,14 +306,23 @@ Structure TPAnalysisInput WAVE data variable clampAmp variable clampMode - variable duration // [points] + variable tpLengthPointsADC + variable pulseLengthPointsADC + variable pulseStartPointsADC + variable samplingIntervalADC + variable tpLengthPointsDAC + variable pulseLengthPointsDAC + variable pulseStartPointsDAC + variable samplingIntervalDAC variable baselineFrac - variable tpLengthPoints variable readTimeStamp variable hsIndex string device variable measurementMarker variable activeADCs + variable timeStamp + variable timeStampUTC + variable cycleId EndStructure /// @brief Helper structure for GetPlotArea() diff --git a/Packages/MIES/MIES_TestPulse.ipf b/Packages/MIES/MIES_TestPulse.ipf index 575d11eea9..f3e1c629ac 100644 --- a/Packages/MIES/MIES_TestPulse.ipf +++ b/Packages/MIES/MIES_TestPulse.ipf @@ -1530,14 +1530,23 @@ Function/DF TP_PrepareAnalysisDF(string device, STRUCT TPAnalysisInput &tpInput) ASYNC_AddParam(threadDF, w = tpInput.data) ASYNC_AddParam(threadDF, var = tpInput.clampAmp) ASYNC_AddParam(threadDF, var = tpInput.clampMode) - ASYNC_AddParam(threadDF, var = tpInput.duration) + ASYNC_AddParam(threadDF, var = tpInput.pulseLengthPointsADC) ASYNC_AddParam(threadDF, var = tpInput.baselineFrac) - ASYNC_AddParam(threadDF, var = tpInput.tpLengthPoints) + ASYNC_AddParam(threadDF, var = tpInput.tpLengthPointsADC) ASYNC_AddParam(threadDF, var = tpInput.readTimeStamp) ASYNC_AddParam(threadDF, var = tpInput.hsIndex) ASYNC_AddParam(threadDF, str = tpInput.device) ASYNC_AddParam(threadDF, var = tpInput.measurementMarker) ASYNC_AddParam(threadDF, var = tpInput.activeADCs) + ASYNC_AddParam(threadDF, var = tpInput.timeStamp) + ASYNC_AddParam(threadDF, var = tpInput.timeStampUTC) + ASYNC_AddParam(threadDF, var = tpInput.cycleId) + ASYNC_AddParam(threadDF, var = tpInput.pulseStartPointsADC) + ASYNC_AddParam(threadDF, var = tpInput.samplingIntervalADC) + ASYNC_AddParam(threadDF, var = tpInput.tpLengthPointsDAC) + ASYNC_AddParam(threadDF, var = tpInput.pulseLengthPointsDAC) + ASYNC_AddParam(threadDF, var = tpInput.pulseStartPointsDAC) + ASYNC_AddParam(threadDF, var = tpInput.samplingIntervalDAC) return threadDF End