diff --git a/Packages/MIES/MIES_MiesUtilities.ipf b/Packages/MIES/MIES_MiesUtilities.ipf index fd4411049f..4029080471 100644 --- a/Packages/MIES/MIES_MiesUtilities.ipf +++ b/Packages/MIES/MIES_MiesUtilities.ipf @@ -2652,7 +2652,7 @@ Function CreateTiledChannelGraph(string graph, WAVE config, variable sweepNo, WA variable axisIndex, numChannels variable numDACs, numADCs, numTTLs, i, j, k, hasPhysUnit, hardwareType - variable moreData, chan, numHorizWaves, numVertWaves, idx + variable moreData, chan, guiChannelNumber, numHorizWaves, numVertWaves, idx variable numTTLBits, headstage, channelType variable delayOnsetUser, delayOnsetAuto, delayTermination, delaydDAQ, dDAQEnabled, oodDAQEnabled variable stimSetLength, samplingInt, xRangeStart, xRangeEnd, first, last, count, ttlBit @@ -2667,7 +2667,7 @@ Function CreateTiledChannelGraph(string graph, WAVE config, variable sweepNo, WA Make/T/FREE userDataKeys = {"fullPath", "channelType", "channelNumber", "sweepNumber", "headstage", \ "textualValues", "numericalValues", "clampMode", "TTLBit", "experiment", "traceType", \ - "occurence", "XAXIS", "YAXIS", "YRANGE", "TRACECOLOR", "AssociatedHeadstage"} + "occurence", "XAXIS", "YAXIS", "YRANGE", "TRACECOLOR", "AssociatedHeadstage", "GUIChannelNumber"} WAVE ADCs = GetADCListFromConfig(config) WAVE DACs = GetDACListFromConfig(config) @@ -2693,6 +2693,10 @@ Function CreateTiledChannelGraph(string graph, WAVE config, variable sweepNo, WA numDACs = DimSize(DACs, ROWS) numADCs = DimSize(ADCs, ROWS) numTTLs = DimSize(TTLs, ROWS) + if(numTTLs > 0) + WAVE/Z channelMapHWToGUI = GetActiveChannels(numericalValues, textualValues, sweepNo, XOP_CHANNEL_TYPE_TTL, TTLmode = TTL_HWTOGUI_CHANNEL) + ASSERT(WaveExists(channelMapHWToGUI), "Can not find LNB entries for active TTL channels from config wave.") + endif hardwareType = GetUsedHWDACFromLNB(numericalValues, sweepNo) WAVE/Z ttlRackZeroBits = GetLastSetting(numericalValues, sweepNo, "TTL rack zero bits", DATA_ACQUISITION_MODE) @@ -2939,6 +2943,12 @@ Function CreateTiledChannelGraph(string graph, WAVE config, variable sweepNo, WA name = channelID + num2str(chan) endif + if(channelType == XOP_CHANNEL_TYPE_TTL) + guiChannelNumber = channelMapHWToGUI[chan][IsNaN(ttlBit) ? 0 : ttlBit] + else + guiChannelNumber = chan + endif + DFREF singleSweepDFR = GetSingleSweepFolder(sweepDFR, sweepNo) ASSERT(DataFolderExistsDFR(singleSweepDFR), "Missing singleSweepDFR") @@ -3114,7 +3124,8 @@ Function CreateTiledChannelGraph(string graph, WAVE config, variable sweepNo, WA {GetWavesDataFolder(wv, 2), channelID, num2str(chan), num2str(sweepNo), num2str(headstage), \ GetWavesDataFolder(textualValues, 2), GetWavesDataFolder(numericalValues, 2), \ num2str(IsFinite(headstage) ? clampModes[headstage] : NaN), num2str(ttlBit), experiment, "Sweep", \ - num2str(k), horizAxis, vertAxis, traceRange, traceColor, num2istr(IsFinite(headstage))}) + num2str(k), horizAxis, vertAxis, traceRange, traceColor, num2istr(IsFinite(headstage)), \ + num2istr(guiChannelNumber)}) endfor endfor diff --git a/Packages/tests/Basic/UTF_SweepFormula.ipf b/Packages/tests/Basic/UTF_SweepFormula.ipf index f1bb2f0759..5b516eb9f9 100644 --- a/Packages/tests/Basic/UTF_SweepFormula.ipf +++ b/Packages/tests/Basic/UTF_SweepFormula.ipf @@ -103,8 +103,8 @@ static Function [variable numSweeps, variable numChannels, WAVE/U/I channels] Fi WAVE wv = $name AppendToGraph/W=$win wv/TN=$trace channelNumber = channels[i][j] - TUD_SetUserDataFromWaves(win, trace, {"experiment", "fullPath", "traceType", "occurence", "channelType", "channelNumber", "sweepNumber"}, \ - {"blah", GetWavesDataFolder(wv, 2), "Sweep", "0", channelType, num2str(channelNumber), num2str(sweepNumber)}) + TUD_SetUserDataFromWaves(win, trace, {"experiment", "fullPath", "traceType", "occurence", "channelType", "channelNumber", "sweepNumber", "GUIChannelNumber"}, \ + {"blah", GetWavesDataFolder(wv, 2), "Sweep", "0", channelType, num2str(channelNumber), num2str(sweepNumber), num2istr(channelNumber)}) values[connections[j]] = channelNumber config[j][%ChannelType] = XOP_CHANNEL_TYPE_ADC config[j][%ChannelNumber] = channelNumber @@ -2517,8 +2517,8 @@ static Function TestOperationData() Extract input, $name, q == i && r == j WAVE wv = $name AppendToGraph/W=$win wv/TN=$trace - TUD_SetUserDataFromWaves(win, trace, {"experiment", "fullPath", "traceType", "occurence", "channelType", "channelNumber", "sweepNumber"}, \ - {"blah", GetWavesDataFolder(wv, 2), "Sweep", "0", StringFromList(j, channelTypeList), StringFromList(j, channelNumberList), num2istr(sweepNo)}) + TUD_SetUserDataFromWaves(win, trace, {"experiment", "fullPath", "traceType", "occurence", "channelType", "channelNumber", "sweepNumber", "GUIChannelNumber"}, \ + {"blah", GetWavesDataFolder(wv, 2), "Sweep", "0", StringFromList(j, channelTypeList), StringFromList(j, channelNumberList), num2istr(sweepNo), StringFromList(j, channelNumberList)}) endfor endfor