From d3bccac33d4b974cb3ccda5e0c661b19537c012f Mon Sep 17 00:00:00 2001 From: Michael Huth Date: Thu, 7 Sep 2023 15:04:55 +0200 Subject: [PATCH 1/2] DB: Fix assertion on unchecking sep.TTL with ITC hardware since 31e201b9 (Util: Add GUI channel number to TUD in CreateTiledChannelGraph, 2023-07-15) When unchecking sep.TTL when using ITC hardware always the first TTL channel of the current rack range was referred as GUI channel. But actually it should be the first active GUI channel. Thus, if the first channel of a rack range was not used, then the current GUI channel was set NaN. This lead to a follow up ASSERTion when determining the correct trace color after the color index was calculated with a NaN result from the NaN GUI channelnumber. The fix is to use the first active GUI channel in the current rack range. Directly related, the axis naming for composite TTL traces was wrong as it originally referred to the hardware channel and after 31e201b9 referred to the first GUI channel in the rack range. This was wrong as a composite trace does not represent this channel (unless its the only one enabled). The name is now set to "TTLC" followed by a underscore separated list of active GUI channels, e.g. TTLC1_3 if TTL GUI channel 1 and 3 are enabled. Add historic data test for DataBrowser Channel Checkboxes - integrative test that checks if switching the channel checkboxes of the data browser (ADC, DAC, TTL and related) causes in some combination or transition a RTE. --- Packages/MIES/MIES_MiesUtilities.ipf | 15 ++++- .../tests/HistoricData/UTF_HistoricData.ipf | 6 +- ...F_HistoricDatabrowserChannelCheckboxes.ipf | 65 +++++++++++++++++++ 3 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 Packages/tests/HistoricData/UTF_HistoricDatabrowserChannelCheckboxes.ipf diff --git a/Packages/MIES/MIES_MiesUtilities.ipf b/Packages/MIES/MIES_MiesUtilities.ipf index ba3f3ce31c..5d65c533b9 100644 --- a/Packages/MIES/MIES_MiesUtilities.ipf +++ b/Packages/MIES/MIES_MiesUtilities.ipf @@ -2971,14 +2971,23 @@ Function CreateTiledChannelGraph(string graph, WAVE config, variable sweepNo, WA // waves per channel type for(j = 0; j < numVertWaves; j += 1) - ttlBit = channelType == XOP_CHANNEL_TYPE_TTL && tgs.splitTTLBits ? j : NaN + ttlBit = channelType == XOP_CHANNEL_TYPE_TTL && isTTLSplitted ? j : NaN if(channelType == XOP_CHANNEL_TYPE_TTL) - guiChannelNumber = channelMapHWToGUI[chan][IsNaN(ttlBit) ? 0 : ttlBit] + if(isTTLSplitted) + guiChannelNumber = channelMapHWToGUI[chan][ttlBit] + name = channelID + num2istr(guiChannelNumber) + else + Duplicate/FREE/RMD=[chan][] channelMapHWToGUI, channelMapSingle + WAVE channelMapSingleZapped = ZapNaNs(channelMapSingle) + ASSERT(DimSize(channelMapSingleZapped, ROWS), "No GUI channel found for HW channel " + num2istr(chan)) + guiChannelNumber = channelMapSingleZapped[0] + name = channelID + "C" + RemoveEnding(NumericWaveToList(channelMapSingleZapped, "_"), "_") + endif else guiChannelNumber = chan + name = channelID + num2istr(guiChannelNumber) endif - name = channelID + num2istr(guiChannelNumber) DFREF singleSweepDFR = GetSingleSweepFolder(sweepDFR, sweepNo) diff --git a/Packages/tests/HistoricData/UTF_HistoricData.ipf b/Packages/tests/HistoricData/UTF_HistoricData.ipf index 492287380a..395e237ae6 100644 --- a/Packages/tests/HistoricData/UTF_HistoricData.ipf +++ b/Packages/tests/HistoricData/UTF_HistoricData.ipf @@ -20,6 +20,7 @@ static StrConstant HTTP_FOLDER_URL = "https://www.byte-physics.de/Downloads/alle // keep sorted #include "UTF_HistoricDashboard" +#include "UTF_HistoricDatabrowserChannelCheckboxes" #include "UTF_HistoricEpochClipping" // Entry point for UTF @@ -83,6 +84,7 @@ Function RunWithOpts([string testcase, string testsuite, variable allowdebug, va // sorted list list = AddListItem("UTF_HistoricDashboard.ipf", list, ";", inf) list = AddListItem("UTF_HistoricEpochClipping.ipf", list, ";", inf) + list = AddListItem("UTF_HistoricDatabrowserChannelCheckboxes.ipf", list, ";", inf) if(ParamIsDefault(testsuite)) testsuite = list @@ -178,7 +180,9 @@ Function/WAVE GetHistoricDataFiles() "Pvalb-IRES-Cre;Ai14-646904.13.03.02.pxp", \ "Sst-IRES-Cre;Ai14-554002.08.06.02.pxp", \ "Sst-IRES-Cre;Th-P2A-FlpO;Ai65-561491.09.09.02.pxp", \ - "epoch_clipping_2022_03_08_140256.pxp"} + "epoch_clipping_2022_03_08_140256.pxp", \ + "DB_ChannelTypeCheckboxes.pxp" \ + } /// @TODO use hashes to verify files once IP supports strings > 2GB diff --git a/Packages/tests/HistoricData/UTF_HistoricDatabrowserChannelCheckboxes.ipf b/Packages/tests/HistoricData/UTF_HistoricDatabrowserChannelCheckboxes.ipf new file mode 100644 index 0000000000..1031914cbb --- /dev/null +++ b/Packages/tests/HistoricData/UTF_HistoricDatabrowserChannelCheckboxes.ipf @@ -0,0 +1,65 @@ +#pragma TextEncoding = "UTF-8" +#pragma rtGlobals=3 // Use modern global access method and strict wave access. +#pragma rtFunctionErrors=1 +#pragma ModuleName=DatabrowserChannelCheckboxes + +/// UTF_TD_GENERATOR GetHistoricDataFiles +static Function TestChannelCheckboxes([string str]) + + string abWin, sweepBrowsers, file, bsPanel, sbWin + variable jsonId + + file = "input:" + str + + [abWin, sweepBrowsers] = OpenAnalysisBrowser({file}, loadSweeps = 1) + sbWin = StringFromList(0, sweepBrowsers) + CHECK_PROPER_STR(sbWin) + bsPanel = BSP_GetPanel(sbWin) + + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_ADC", val = 0) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_ADC", val = 1) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_ADC", val = 0) + CHECK_NO_RTE() + + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_DAC", val = 0) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_DAC", val = 1) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_DAC", val = 0) + CHECK_NO_RTE() + + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_TTL", val = 0) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_TTL", val = 1) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_TTL", val = 0) + CHECK_NO_RTE() + + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_TTL", val = 1) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_splitTTL", val = 0) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_splitTTL", val = 1) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_splitTTL", val = 0) + CHECK_NO_RTE() + + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_DAC", val = 1) + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_ADC", val = 1) + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_TTL", val = 1) + + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_VisEpochs", val = 0) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_VisEpochs", val = 1) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_VisEpochs", val = 0) + CHECK_NO_RTE() + + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_splitTTL", val = 1) + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_VisEpochs", val = 1) + CHECK_NO_RTE() + PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_VisEpochs", val = 0) + CHECK_NO_RTE() +End From 253ba98421115e18e96fcecfd4b065cda4cda8cb Mon Sep 17 00:00:00 2001 From: Michael Huth Date: Thu, 7 Sep 2023 15:18:12 +0200 Subject: [PATCH 2/2] Util: Extend desc of GetHeadstageColor - make it clear what channel number has to be give if isSplitted is zero (composite TTL traces) --- Packages/MIES/MIES_MiesUtilities.ipf | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/MIES/MIES_MiesUtilities.ipf b/Packages/MIES/MIES_MiesUtilities.ipf index 5d65c533b9..c7bd6114d7 100644 --- a/Packages/MIES/MIES_MiesUtilities.ipf +++ b/Packages/MIES/MIES_MiesUtilities.ipf @@ -3350,6 +3350,7 @@ End /// @param channelType [optional, empty by default] The channel type for non-associated channels, currently only XOP_CHANNEL_TYPE_TTL is evaluated /// @param channelNumber [optional, empty by default] For plotting "TTL" channels only, GUI channel number /// @param isSplitted [optional, default 1] For plotting "TTL" channels only, Flag if the color for a splitted or unsplitted channel should be returned +/// For the case isSplitted == 0, then channelNumber must be a GUI channel number from the specific TTL rack range Function [STRUCT RGBColor s] GetHeadstageColor(variable headstage, [variable channelType, variable channelNumber, variable isSplitted]) string str