From fdee1cca6101f12f63259c9197de4bd3b17f1c9a Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 22 Oct 2024 19:36:37 +0200 Subject: [PATCH] PA_SpikePositionsForNonVC: Fix error in execution In 2bc24dac1 (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. --- Packages/MIES/MIES_PulseAveraging.ipf | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Packages/MIES/MIES_PulseAveraging.ipf b/Packages/MIES/MIES_PulseAveraging.ipf index bfe019d5fb..b866ffaae9 100644 --- a/Packages/MIES/MIES_PulseAveraging.ipf +++ b/Packages/MIES/MIES_PulseAveraging.ipf @@ -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) @@ -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