Skip to content

Commit 109fded

Browse files
committed
AD_FillWaves: Fix edge case with sweeps from different experiments
In ff131df (AD_FillWaves: Handle sweeps without analysis functions better, 2022-08-08) we added better support for detecting ongoing sweeps which don't have analysis functions attached. That commit failed to see that when we are loading sweeps from different experiments the last sweep from experiment B can not be found in the labnotebook of the first experiment. And then lastSweepStimsetCycleIDs is correctly an invalid wave ref. Stepping back makes us realize that we only need to perform that check when we are a databrowser as DAQ is never ongoing in the sweepbrowser. While at it we also move fetching the SCI of the last sweep out of the for loop.
1 parent 4fd6439 commit 109fded

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

Packages/MIES/MIES_AnalysisFunctions_Dashboard.ipf

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,14 @@ static Function AD_FillWaves(string win, WAVE/T list, WAVE/T info)
219219
if(isDataBrowser)
220220
device = BSP_GetDevice(win)
221221
acqState = ROVar(GetAcquisitionState(device))
222-
DFREF sweepDFR = GetDeviceDataPath(device)
222+
DFREF sweepDFR = GetDeviceDataPath(device)
223+
WAVE lastSweepStimsetCycleIDs = GetLastSetting(numericalValuesWave[0], WaveMax(totalSweepsPresent), STIMSET_ACQ_CYCLE_ID_KEY, DATA_ACQUISITION_MODE)
224+
ASSERT(WaveExists(lastSweepStimsetCycleIDs), "Missing last sweep SCIs")
223225
else
224226
acqState = AS_INACTIVE
225227
DFREF sweepBrowserDFR = SB_GetSweepBrowserFolder(win)
226228
WAVE/T sweepMap = GetSweepBrowserMap(sweepBrowserDFR)
229+
WAVE/ZZ lastSweepStimsetCycleIDs
227230

228231
WAVE totalMapIndizes = SB_GetMapIndizes(win)
229232
ASSERT(DimSize(totalSweepsPresent, ROWS) == DimSize(totalMapIndizes, ROWS), "Expected equal number of sweeps and map indizes")
@@ -257,8 +260,6 @@ static Function AD_FillWaves(string win, WAVE/T list, WAVE/T info)
257260
continue
258261
endif
259262

260-
WAVE/Z lastSweepStimsetCycleIDs = GetLastSetting(numericalValues, WaveMax(totalSweepsPresent), STIMSET_ACQ_CYCLE_ID_KEY, DATA_ACQUISITION_MODE)
261-
262263
key = StringFromList(GENERIC_EVENT, EVENT_NAME_LIST_LBN)
263264
WAVE/Z/T anaFuncs = GetLastSetting(textualValues, sweepNo, key, DATA_ACQUISITION_MODE)
264265

@@ -305,9 +306,13 @@ static Function AD_FillWaves(string win, WAVE/T list, WAVE/T info)
305306

306307
if(anaFuncType == INVALID_ANALYSIS_FUNCTION)
307308
passed = NaN
308-
// current sweep is from the same SCI than the last acquired sweep and DAQ is not inactive
309-
ASSERT(WaveExists(lastSweepStimsetCycleIDs), "Missing last sweep SCIs")
310-
ongoingDAQ = (lastSweepStimsetCycleIDs[headstage] == stimsetCycleID) && (acqState != AS_INACTIVE)
309+
310+
if(isDataBrowser)
311+
// current sweep is from the same SCI than the last acquired sweep and DAQ is not inactive
312+
ongoingDAQ = (lastSweepStimsetCycleIDs[headstage] == stimsetCycleID) && (acqState != AS_INACTIVE)
313+
else
314+
ongoingDAQ = 0
315+
endif
311316
else
312317
key = CreateAnaFuncLBNKey(anaFuncType, PSQ_FMT_LBN_SET_PASS, query = 1, waMode = waMode)
313318
passed = GetLastSettingIndepSCI(numericalValues, sweepNo, key, headstage, UNKNOWN_MODE)

Packages/tests/HistoricData/UTF_HistoricDashboard.ipf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,21 @@ Function TestDashboardSelections()
201201
WAVE/Z sweeps = OVS_GetSelectedSweeps(bsPanel, OVS_SWEEP_SELECTION_SWEEPNO)
202202
CHECK_EQUAL_WAVES(sweeps, {4, 8, 9, 10, 11, 20, 21}, mode = WAVE_DATA)
203203
End
204+
205+
static Function TestOngoingDAQBugWithoutAnalysisFunction()
206+
207+
string sweepBrowsers, sweepBrowser, bsPanel, abWin
208+
209+
Make/FREE/T files = {"input:H22.03.311.11.08.01.06.nwb", "input:NWB_V1_single_device.nwb"}
210+
DownloadFilesIfRequired(files)
211+
[abWin, sweepBrowsers] = OpenAnalysisBrowser(files, loadSweeps = 1, multipleSweepBrowser = 0)
212+
CHECK_NO_RTE()
213+
214+
sweepBrowser = StringFromList(0, sweepBrowsers)
215+
216+
bsPanel = BSP_GetPanel(sweepBrowser)
217+
CHECK(WindowExists(bsPanel))
218+
219+
PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_DS", val = CHECKBOX_SELECTED)
220+
PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_DB_Passed", val = CHECKBOX_SELECTED)
221+
End

0 commit comments

Comments
 (0)