Skip to content

Commit

Permalink
PSQ_DS_AdaptiveIsFinished: Fix requirement for multiple f-I slope QC …
Browse files Browse the repository at this point in the history
…matches

We actually want to ignore failing baseline QC in between. Broken since
b2fe42f (PSQ_DAScale: Revise adaptive suprathreshold mode, 2024-04-01).
  • Loading branch information
t-b committed Jul 16, 2024
1 parent 688415a commit 0873c5e
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions Packages/MIES/MIES_AnalysisFunctions_PatchSeq.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -2669,8 +2669,8 @@ End

static Function PSQ_DS_AdaptiveIsFinished(string device, variable sweepNo, variable headstage, variable numSweepsWithSaturation)

string key
variable measuredAllFutureDAScales
string key
variable measuredAllFutureDAScales, numFound, i, numSweeps

WAVE numericalValues = GetLBNumericalValues(device)

Expand Down Expand Up @@ -2702,12 +2702,28 @@ static Function PSQ_DS_AdaptiveIsFinished(string device, variable sweepNo, varia
return 0
endif

MatrixOP/FREE passedAndSlopeReached = sweepPassed && fISlopeReached
// we want numSweepsWithSaturation sweeps with passing f-I slope QC and sweep QC
// and there should not be sweeps with failing f-I slope QC in between
numSweeps = DimSize(sweepPassed, ROWS)
for(i = 0; i < numSweeps; i += 1)

if(!sweepPassed[i])
continue
endif

// sweeps have QC passing below

if(!fiSlopeReached[i])
numFound = 0
continue
endif

numFound += 1
endfor

Make/FREE/N=(numSweepsWithSaturation)/I/B match = 1
FindSequence/I=match passedAndSlopeReached
ASSERT(!(numFound > numSweepsWithSaturation), "Done too many sweeps")

return V_Value >= 0
return numFound == numSweepsWithSaturation
End

static Function [WAVE apfreqRhSuAd, WAVE DAScalesRhSuAd, WAVE/Z apfreqCurrentSCI, WAVE/Z DAScaleCurrentSCI] PSQ_DS_GetAPFreqAndDaScales(WAVE numericalValues, WAVE textualValues, variable sweepNo, variable headstage)
Expand Down

0 comments on commit 0873c5e

Please sign in to comment.