@@ -68,20 +68,19 @@ Function AD_Update(win)
6868 selWave[][][ % foreColors] = AD_GetColorForResultMessage ( listWave[ p][ % Result])
6969
7070 helpWave[] = "Result:\r " + listWave[ p][ % Result]
71-
72- EnableControls ( mainPanel, "check_BrowserSettings_DB_Failed;check_BrowserSettings_DB_Passed" )
7371 else
7472 SetNumberInWaveNote ( listWave, NOTE_INDEX, 0 )
75- DisableControls ( mainPanel, "check_BrowserSettings_DB_Failed;check_BrowserSettings_DB_Passed" )
7673 endif
7774
7875 DEBUGPRINT_ELAPSED ( refTime)
7976End
8077
81- static Function/S AD_GetResultMessage ( variable anaFuncType, variable passed, WAVE numericalValues, WAVE /T textualValues, variable sweepNo, variable headstage)
78+ static Function/S AD_GetResultMessage ( variable anaFuncType, variable passed, WAVE numericalValues, WAVE /T textualValues, variable sweepNo, variable headstage, variable ongoingDAQ )
8279
8380 if ( passed)
8481 return "Pass"
82+ elseif ( ongoingDAQ)
83+ return "Sweep not yet finished"
8584 endif
8685
8786 // MSQ_DA
@@ -149,7 +148,7 @@ static Function AD_FillWaves(win, list, info)
149148 string win
150149 WAVE /T list, info
151150
152- variable i , j, headstage, passed, sweepNo, numEntries
151+ variable i , j, headstage, passed, sweepNo, numEntries, ongoingDAQ
153152 variable index, anaFuncType, stimsetCycleID, firstValid, lastValid
154153 string key, anaFunc, stimset, msg
155154
@@ -209,26 +208,32 @@ static Function AD_FillWaves(win, list, info)
209208 stimsetCycleID = stimsetCycleIDs[ headstage]
210209
211210 FindValue / RMD= [][ 0 ] / TXOP=4/ TEXT= AD_FormatListKey ( stimsetCycleID, headstage) info
212- if ( V_Value >= 0 ) // already included
213- continue
211+ if ( V_Value >= 0 )
212+ if ( ! cmpstr ( info[ V_Value][ %$ "Ongoing DAQ" ] , "1" ))
213+ // if DAQ was ongoing we want to overwrite this entry and all later entries
214+ index = V_Value
215+ info[ index, inf ][] = ""
216+ else
217+ // otherwise we want to keep it
218+ continue
219+ endif
214220 endif
215221
216222 WAVE /Z/ T stimsets = GetLastSetting ( textualValues, sweepNo, STIM_WAVE_NAME_KEY, DATA_ACQUISITION_MODE)
217223 ASSERT ( WaveExists ( stimsets) , "No stimsets found" )
218224
219225 stimset = stimsets[ headstage]
220226
221- if ( anaFuncType != INVALID_ANALYSIS_FUNCTION)
227+ if ( anaFuncType == INVALID_ANALYSIS_FUNCTION)
228+ passed = NaN
229+ ongoingDAQ = 0
230+ else
222231 key = CreateAnaFuncLBNKey ( anaFuncType, PSQ_FMT_LBN_SET_PASS, query = 1 )
223232 passed = GetLastSettingIndepSCI ( numericalValues, sweepNo, key, headstage, UNKNOWN_MODE)
224-
225- if ( isNaN ( passed))
226- // the set is not yet finished
227- continue
228- endif
233+ ongoingDAQ = IsNaN ( passed)
229234 endif
230235
231- msg = AD_GetResultMessage ( anaFuncType, passed, numericalValues, textualValues, sweepNo, headstage)
236+ msg = AD_GetResultMessage ( anaFuncType, passed, numericalValues, textualValues, sweepNo, headstage, ongoingDAQ )
232237
233238 EnsureLargeEnoughWave ( list, dimension = ROWS, minimumSize = index)
234239 EnsureLargeEnoughWave ( info, dimension = ROWS, minimumSize = index)
@@ -254,8 +259,14 @@ static Function AD_FillWaves(win, list, info)
254259 case MSQ_FAST_RHEO_EST:
255260 case SC_SPIKE_CONTROL:
256261 key = CreateAnaFuncLBNKey ( anaFuncType, PSQ_FMT_LBN_SWEEP_PASS, query = 1 )
257- WAVE sweepPass = GetLastSettingIndepEachSCI ( numericalValues, sweepNo, key, headstage, UNKNOWN_MODE)
258- ASSERT ( DimSize ( sweeps, ROWS) == DimSize ( sweepPass, ROWS) , "Unexpected wave sizes" )
262+ WAVE /Z sweepPass = GetLastSettingIndepEachSCI ( numericalValues, sweepNo, key, headstage, UNKNOWN_MODE, defValue = 0 )
263+
264+ if ( ! WaveExists ( sweepPass))
265+ Duplicate / FREE sweeps, sweepPass
266+ sweepPass = 0
267+ else
268+ ASSERT ( DimSize ( sweeps, ROWS) == DimSize ( sweepPass, ROWS) , "Unexpected wave sizes" )
269+ endif
259270
260271 Duplicate / FREE sweeps, passingSweepsAll, failingSweepsAll
261272 passingSweepsAll[] = sweepPass[ p] ? sweeps[ p] : NaN
@@ -294,6 +305,7 @@ static Function AD_FillWaves(win, list, info)
294305 info[ index][ %$ STIMSET_ACQ_CYCLE_ID_KEY] = AD_FormatListKey ( stimsetCycleID, headstage)
295306 info[ index][ %$ "Passing Sweeps" ] = NumericWaveToList ( passingSweeps, ";" )
296307 info[ index][ %$ "Failing Sweeps" ] = NumericWaveToList ( failingSweeps, ";" )
308+ info[ index][ %$ "Ongoing DAQ" ] = num2str ( ongoingDAQ)
297309
298310 SetNumberInWaveNote ( list, NOTE_INDEX, ++ index)
299311 endfor
@@ -543,7 +555,10 @@ static Function/S AD_GetBaselineFailMsg(anaFuncType, numericalValues, sweepNo, h
543555 return ""
544556 endif
545557
546- ASSERT ( WaveExists ( baselineQC) , "Missing baseline QC LBN entry" )
558+ if ( ! WaveExists ( baselineQC))
559+ BUG ( "Missing baseline QC LBN entry" )
560+ return ""
561+ endif
547562
548563 if ( ! baselineQC[ headstage])
549564 for ( i = 0; ; i += 1 )
839854Function AD_CheckProc_Toggle ( cba) : CheckBoxControl
840855 STRUCT WMCheckboxAction & cba
841856
857+ string win
858+
842859 switch ( cba. eventCode)
843860 case 2: // mouse up
844- AD_Update ( cba. win)
861+ win = cba. win
862+ AD_Update ( win)
863+
864+ if ( cba. checked)
865+ EnableControls ( win, "check_BrowserSettings_DB_Failed;check_BrowserSettings_DB_Passed" )
866+ else
867+ DisableControls ( win, "check_BrowserSettings_DB_Failed;check_BrowserSettings_DB_Passed" )
868+ endif
869+
845870 break
846871 endswitch
847872
0 commit comments