Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unchecking sep. TTL in DB causes ASSERTion on ITC hardware if first TTL rack channel is not active #1881

Merged
merged 2 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 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 Expand Up @@ -3341,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
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