Skip to content

Commit

Permalink
PA_SpikePositionsForNonVC: Fix error in execution
Browse files Browse the repository at this point in the history
In 2bc24da (PA_SpikePositionsForNonVC: Add missing /Q, 2024-08-01) we
added a plain /Q  to FindPeak. But the author did not realize that for
this operation the /Q implies not erroring out (other operations do that
with /Z).

So the function currently always bugs out when it finds a peak.

By dropping the RTE error handling we can use it correctly.
  • Loading branch information
t-b committed Nov 5, 2024
1 parent 3d2acf3 commit 7bd2189
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Packages/MIES/MIES_PulseAveraging.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -2493,7 +2493,7 @@ End
threadsafe Function/WAVE PA_SpikePositionsForNonVC(WAVE wv, variable failedPulsesLevel)

variable numLevels, maxNumLevels, numSpikes
variable first, last, i, err, idx
variable first, last, i, idx

// allow at most 1 pulse per ms, but at least 1
maxNumLevels = max(1, round(DimSize(wv, ROWS) * DimDelta(wv, ROWS)) * 2)
Expand Down Expand Up @@ -2525,11 +2525,9 @@ threadsafe Function/WAVE PA_SpikePositionsForNonVC(WAVE wv, variable failedPulse
continue
endif

AssertOnAndClearRTError()
FindPeak/B=(PA_PEAK_BOX_AVERAGE)/M=(failedPulsesLevel)/R=(first, last)/Q wv; err = GetRTError(1) // see developer docu section Preventing Debugger Popup
FindPeak/B=(PA_PEAK_BOX_AVERAGE)/M=(failedPulsesLevel)/R=(first, last)/Q wv

if(!err)
ASSERT_TS(!V_Flag, "Could not find peak but FindLevelWrapper was successfull, this is unexpected.")
if(!V_Flag)
spikePositions[idx++] = V_PeakLoc
endif
endfor
Expand Down

0 comments on commit 7bd2189

Please sign in to comment.