From 30c26d68457a529d755bd0d5da8f355930f4c6e3 Mon Sep 17 00:00:00 2001 From: Michael Huth Date: Thu, 7 Sep 2023 15:04:55 +0200 Subject: [PATCH] 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