Skip to content

Commit 66b4b3c

Browse files
authored
Merge pull request #929 from AllenInstitute/feature/929-new-release
Prepare for release 2.2
2 parents 9fef787 + bdd985a commit 66b4b3c

7 files changed

+498
-11
lines changed

Packages/MIES/MIES_AnalysisBrowser.ipf

+13
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,19 @@ static Function AB_LoadFromFile(AB_LoadType, [sweepBrowserDFR])
14521452
return oneValidLoad
14531453
End
14541454

1455+
Function AB_LoadStimsetForSweep(string device, variable index, variable sweep)
1456+
1457+
string dataFolder, discLocation, fileType
1458+
1459+
WAVE/T map = GetAnalysisBrowserMap()
1460+
1461+
dataFolder = map[index][%DataFolder]
1462+
discLocation = map[index][%DiscLocation]
1463+
fileType = map[index][%FileType]
1464+
1465+
return AB_LoadStimsetFromFile(discLocation, dataFolder, fileType, device, sweep, overwrite = 0)
1466+
End
1467+
14551468
// @brief common ASSERT statements for AB_LoadSweepFromFile and AB_LoadStimsetFromFile
14561469
static Function AB_LoadFromFileASSERT(discLocation, dataFolder, fileType, device, sweep, overwrite)
14571470
string discLocation, dataFolder, fileType, device

Packages/MIES/MIES_AnalysisBrowser_SweepBrowser.ipf

+12
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ Function/DF SB_GetSweepBrowserFolder(win)
2121
return BSP_GetFolder(win, MIES_BSP_PANEL_FOLDER)
2222
End
2323

24+
Function SB_TranslateSBMapIndexToABMapIndex(string win, variable sbIndex)
25+
26+
WAVE/T sweepMap = SB_GetSweepBrowserMapFromGraph(win)
27+
WAVE/T analysisMap = GetAnalysisBrowserMap()
28+
29+
// now search the DataFolder from sweepMap in the analyisMap
30+
FindValue/TXOP=4/RMD=[][FindDimLabel(analysisMap, COLS, "DataFolder")]/TEXT=(sweepMap[sbIndex][%DataFolder]) analysisMap
31+
ASSERT(V_Value >= 0, "Inconsistent AnalysisBrowserMap and SweepBrowserMap")
32+
33+
return V_row
34+
End
35+
2436
static Function/DF SB_GetSweepDataPathFromIndex(sweepBrowserDFR, mapIndex)
2537
DFREF sweepBrowserDFR
2638
variable mapIndex

Packages/MIES/MIES_WaveBuilderPanel.ipf

+33-5
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ static Constant FROM_WAVE_TO_PANEL = 0x2
3838

3939
Function WB_OpenStimulusSetInWaveBuilder()
4040

41-
string graph, trace, extPanel, waveBuilder
42-
variable sweepNo, headstage
41+
string graph, trace, extPanel, waveBuilder, stimset, device
42+
variable sweepNo, headstage, abIndex, sbIndex
4343

4444
GetLastUserMenuInfo
4545
graph = S_graphName
@@ -57,16 +57,44 @@ Function WB_OpenStimulusSetInWaveBuilder()
5757
headstage = str2num(TUD_GetUserData(graph, trace, "headstage"))
5858
WAVE/T textualValues = $TUD_GetUserData(graph, trace, "textualValues")
5959

60-
WAVE/T/Z stimset = GetLastSetting(textualValues, sweepNo, STIM_WAVE_NAME_KEY, DATA_ACQUISITION_MODE)
60+
WAVE/T/Z stimsetLBN = GetLastSetting(textualValues, sweepNo, STIM_WAVE_NAME_KEY, DATA_ACQUISITION_MODE)
6161

62-
if(!WaveExists(stimset))
62+
if(!WaveExists(stimsetLBN) || IsNaN(headstage))
6363
printf "Context menu option \"%s\" could not find the stimulus set of the trace %s.\r", S_Value, trace
6464
ControlWindowToFront()
6565
return NaN
6666
endif
6767

68+
stimset = stimsetLBN[headstage]
69+
70+
WAVE/Z stimsetWave = WB_CreateAndGetStimSet(stimset)
71+
72+
if(!WaveExists(stimsetWave))
73+
if(BSP_IsDataBrowser(graph))
74+
printf "Context menu option \"%s\" could not be find the stimulus set %s.", S_Value, stimset
75+
ControlWindowToFront()
76+
return NaN
77+
else
78+
// we might need to load the stimset
79+
WAVE traceWave = $TUD_GetUserData(graph, trace, "fullPath")
80+
DFREF sweepDataDFR = GetWavesDataFolderDFR(traceWave)
81+
sbIndex = SB_GetIndexFromSweepDataPath(graph, sweepDataDFR)
82+
83+
DFREF sweepBrowserDFR = SB_GetSweepBrowserFolder(graph)
84+
WAVE/T sweepMap = GetSweepBrowserMap(sweepBrowserDFR)
85+
86+
abIndex = SB_TranslateSBMapIndexToABMapIndex(graph, sbIndex)
87+
device = sweepMap[sbIndex][%Device]
88+
if(AB_LoadStimsetForSweep(device, abIndex, sweepNo))
89+
printf "Context menu option \"%s\" could not load the stimulus set %s.", S_Value, stimset
90+
ControlWindowToFront()
91+
return NaN
92+
endif
93+
endif
94+
endif
95+
6896
waveBuilder = WBP_CreateWaveBuilderPanel()
69-
PGC_SetAndActivateControl(waveBuilder, "popup_WaveBuilder_SetList", str = stimset[headstage])
97+
PGC_SetAndActivateControl(waveBuilder, "popup_WaveBuilder_SetList", str = stimset)
7098
End
7199

72100
Function/S WBP_CreateWaveBuilderPanel()

0 commit comments

Comments
 (0)