Skip to content

Commit

Permalink
Merge pull request #2052 from AllenInstitute/bugfix/2051-fix_ABLoadSt…
Browse files Browse the repository at this point in the history
…imsetFromFile

AB: fix AB_LoadStimsetFromFile was not updating the stimset list
  • Loading branch information
t-b authored Mar 13, 2024
2 parents 55ca3c1 + f926fef commit fd19553
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Packages/MIES/MIES_AnalysisBrowser.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1883,6 +1883,8 @@ static Function AB_LoadStimsetFromFile(discLocation, dataFolder, fileType, devic
sprintf msg, "Loaded stimsets %s of device %s and %s\r", stimsets, device, discLocation
DEBUGPRINT(msg)

WB_UpdateChangedStimsets()

return 0
End

Expand Down
2 changes: 1 addition & 1 deletion Packages/MIES/MIES_WaveBuilder.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -2313,7 +2313,7 @@ static Function/S WB_StimsetChildren([stimset])
// search for stimsets in all formula-epochs by a regex pattern
for(i = 0; i < numEpochs; i += 1)
if(SegWvType[i] == 8)
formula = WPT[6][i][EPOCH_TYPE_CUSTOM]
formula = WPT[6][i][EPOCH_TYPE_COMBINE]
numStimsets = CountSubstrings(formula, "?")
for(j = 0; j < numStimsets; j += 1)
WAVE/T/Z wv = SearchStringBase(formula, "(.*)\\b(\\w+)\\b\\?(.*)")
Expand Down
26 changes: 26 additions & 0 deletions Packages/tests/Basic/UTF_AnalysisBrowserTest.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

static StrConstant PXP_FILENAME = "input:AB_LoadSweepsFromIgorData.pxp"
static StrConstant PXP2_FILENAME = "input:AB_SweepsFromMultipleDevices.pxp"
static StrConstant PXP3_FILENAME = "input:SourceOfDependentStimset.pxp"
static StrConstant NWB1_FILENAME = "input:AB_SweepsFromMultipleDevices-compressed-V1.nwb"
static StrConstant NWB2_FILENAME = "input:AB_SweepsFromMultipleDevices-compressed-V2.nwb"
static StrConstant NWB3_FILENAME = ":_2017_09_01_192934-compressed.nwb"

static Function LoadSweepsFromIgor()

Expand Down Expand Up @@ -138,3 +140,27 @@ static Function TestABLoadWave()
CHECK_WAVE(wv, NUMERIC_WAVE)

End

static Function LoadStimsetsFromNWB()

string abWin, sweepBrowsers

WBP_CreateWaveBuilderPanel()
[abWin, sweepBrowsers] = OpenAnalysisBrowser({NWB3_FILENAME}, loadStimsets = 1)
WAVE/T epochCombineList = GetWBEpochCombineList(CHANNEL_TYPE_DAC)
CHECK_WAVE(epochCombineList, TEXT_WAVE)
CHECK_GT_VAR(DimSize(epochCombineList, ROWS), 0)

KillWindow $abWin
End

static Function LoadDependentStimsetsFromPXP()

string abWin, sweepBrowsers, formulaSet

[abWin, sweepBrowsers] = OpenAnalysisBrowser({PXP3_FILENAME}, loadStimsets = 1)
formulaSet = MIES_WB#WB_StimsetChildren(stimset="baseset_DA_0")
CHECK_EQUAL_STR(formulaSet, "formula_da_0;")

KillWindow $abWin
End
Binary file not shown.
27 changes: 19 additions & 8 deletions Packages/tests/UTF_HelperFunctions.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ Function/S LoadSweeps(string winAB)
End

/// @brief Open the given files, located relative to the symbolic path `home`, into an analysis browser
Function [string abWin, string sweepBrowsers] OpenAnalysisBrowser(WAVE/T files, [variable loadSweeps])
Function [string abWin, string sweepBrowsers] OpenAnalysisBrowser(WAVE/T files, [variable loadSweeps, variable loadStimsets])

variable idx
string filePath, fullFilePath
Expand All @@ -975,6 +975,7 @@ Function [string abWin, string sweepBrowsers] OpenAnalysisBrowser(WAVE/T files,
else
loadSweeps = !!loadSweeps
endif
loadStimsets = ParamIsDefault(loadStimsets) ? 0 : !!loadStimsets

PathInfo home
REQUIRE_EQUAL_VAR(V_flag, 1)
Expand All @@ -992,24 +993,34 @@ Function [string abWin, string sweepBrowsers] OpenAnalysisBrowser(WAVE/T files,

PGC_SetAndActivateControl(abWin, "button_AB_refresh")

if(!loadSweeps)
if(!loadSweeps && !loadStimsets)
return [abWin, ""]
endif

sweepBrowsers = ""
WAVE/T expBrowserList = GetExperimentBrowserGUIList()
WAVE expBrowserSel = GetExperimentBrowserGUISel()

WAVE/Z indizes = FindIndizes(expBrowserList, colLabel = "file", prop = PROP_NON_EMPTY)
INFO("Trying to load files @%s", s = files)
CHECK_WAVE(indizes, NUMERIC_WAVE)

for(idx : indizes)
expBrowserSel[idx][0][0] = LISTBOX_TREEVIEW | LISTBOX_SELECTED
PGC_SetAndActivateControl(abWin, "button_load_sweeps")
endfor
if(loadSweeps)
for(idx : indizes)
expBrowserSel[idx][0][0] = LISTBOX_TREEVIEW | LISTBOX_SELECTED
PGC_SetAndActivateControl(abWin, "button_load_sweeps")
endfor

sweepBrowsers = WinList("*", ";", "WIN:" + num2istr(WINTYPE_GRAPH))
CHECK_PROPER_STR(sweepBrowsers)
endif

sweepBrowsers = WinList("*", ";", "WIN:" + num2istr(WINTYPE_GRAPH))
CHECK_PROPER_STR(sweepBrowsers)
if(loadStimsets)
for(idx : indizes)
expBrowserSel[idx][0][0] = LISTBOX_TREEVIEW | LISTBOX_SELECTED
PGC_SetAndActivateControl(abWin, "button_load_stimsets")
endfor
endif

return [abWin, sweepBrowsers]
End
Expand Down

0 comments on commit fd19553

Please sign in to comment.