Skip to content

Commit

Permalink
Merge pull request #929 from AllenInstitute/feature/929-new-release
Browse files Browse the repository at this point in the history
Prepare for release 2.2
  • Loading branch information
t-b authored May 3, 2021
2 parents 9fef787 + bdd985a commit 66b4b3c
Show file tree
Hide file tree
Showing 7 changed files with 498 additions and 11 deletions.
13 changes: 13 additions & 0 deletions Packages/MIES/MIES_AnalysisBrowser.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,19 @@ static Function AB_LoadFromFile(AB_LoadType, [sweepBrowserDFR])
return oneValidLoad
End

Function AB_LoadStimsetForSweep(string device, variable index, variable sweep)

string dataFolder, discLocation, fileType

WAVE/T map = GetAnalysisBrowserMap()

dataFolder = map[index][%DataFolder]
discLocation = map[index][%DiscLocation]
fileType = map[index][%FileType]

return AB_LoadStimsetFromFile(discLocation, dataFolder, fileType, device, sweep, overwrite = 0)
End

// @brief common ASSERT statements for AB_LoadSweepFromFile and AB_LoadStimsetFromFile
static Function AB_LoadFromFileASSERT(discLocation, dataFolder, fileType, device, sweep, overwrite)
string discLocation, dataFolder, fileType, device
Expand Down
12 changes: 12 additions & 0 deletions Packages/MIES/MIES_AnalysisBrowser_SweepBrowser.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ Function/DF SB_GetSweepBrowserFolder(win)
return BSP_GetFolder(win, MIES_BSP_PANEL_FOLDER)
End

Function SB_TranslateSBMapIndexToABMapIndex(string win, variable sbIndex)

WAVE/T sweepMap = SB_GetSweepBrowserMapFromGraph(win)
WAVE/T analysisMap = GetAnalysisBrowserMap()

// now search the DataFolder from sweepMap in the analyisMap
FindValue/TXOP=4/RMD=[][FindDimLabel(analysisMap, COLS, "DataFolder")]/TEXT=(sweepMap[sbIndex][%DataFolder]) analysisMap
ASSERT(V_Value >= 0, "Inconsistent AnalysisBrowserMap and SweepBrowserMap")

return V_row
End

static Function/DF SB_GetSweepDataPathFromIndex(sweepBrowserDFR, mapIndex)
DFREF sweepBrowserDFR
variable mapIndex
Expand Down
38 changes: 33 additions & 5 deletions Packages/MIES/MIES_WaveBuilderPanel.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ static Constant FROM_WAVE_TO_PANEL = 0x2

Function WB_OpenStimulusSetInWaveBuilder()

string graph, trace, extPanel, waveBuilder
variable sweepNo, headstage
string graph, trace, extPanel, waveBuilder, stimset, device
variable sweepNo, headstage, abIndex, sbIndex

GetLastUserMenuInfo
graph = S_graphName
Expand All @@ -57,16 +57,44 @@ Function WB_OpenStimulusSetInWaveBuilder()
headstage = str2num(TUD_GetUserData(graph, trace, "headstage"))
WAVE/T textualValues = $TUD_GetUserData(graph, trace, "textualValues")

WAVE/T/Z stimset = GetLastSetting(textualValues, sweepNo, STIM_WAVE_NAME_KEY, DATA_ACQUISITION_MODE)
WAVE/T/Z stimsetLBN = GetLastSetting(textualValues, sweepNo, STIM_WAVE_NAME_KEY, DATA_ACQUISITION_MODE)

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

stimset = stimsetLBN[headstage]

WAVE/Z stimsetWave = WB_CreateAndGetStimSet(stimset)

if(!WaveExists(stimsetWave))
if(BSP_IsDataBrowser(graph))
printf "Context menu option \"%s\" could not be find the stimulus set %s.", S_Value, stimset
ControlWindowToFront()
return NaN
else
// we might need to load the stimset
WAVE traceWave = $TUD_GetUserData(graph, trace, "fullPath")
DFREF sweepDataDFR = GetWavesDataFolderDFR(traceWave)
sbIndex = SB_GetIndexFromSweepDataPath(graph, sweepDataDFR)

DFREF sweepBrowserDFR = SB_GetSweepBrowserFolder(graph)
WAVE/T sweepMap = GetSweepBrowserMap(sweepBrowserDFR)

abIndex = SB_TranslateSBMapIndexToABMapIndex(graph, sbIndex)
device = sweepMap[sbIndex][%Device]
if(AB_LoadStimsetForSweep(device, abIndex, sweepNo))
printf "Context menu option \"%s\" could not load the stimulus set %s.", S_Value, stimset
ControlWindowToFront()
return NaN
endif
endif
endif

waveBuilder = WBP_CreateWaveBuilderPanel()
PGC_SetAndActivateControl(waveBuilder, "popup_WaveBuilder_SetList", str = stimset[headstage])
PGC_SetAndActivateControl(waveBuilder, "popup_WaveBuilder_SetList", str = stimset)
End

Function/S WBP_CreateWaveBuilderPanel()
Expand Down
Loading

0 comments on commit 66b4b3c

Please sign in to comment.