Skip to content

Commit

Permalink
DB: Fix assertion on unchecking sep.TTL with ITC hardware
Browse files Browse the repository at this point in the history
since
31e201b (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 31e201b 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.
  • Loading branch information
MichaelHuth committed Sep 8, 2023
1 parent 3640dfa commit 30c26d6
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 4 deletions.
15 changes: 12 additions & 3 deletions Packages/MIES/MIES_MiesUtilities.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 5 additions & 1 deletion Packages/tests/HistoricData/UTF_HistoricData.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 30c26d6

Please sign in to comment.