From 92ceb73db10914102a996b536d45b3239f558c90 Mon Sep 17 00:00:00 2001 From: beccawhitaker Date: Fri, 27 Feb 2026 10:59:10 -0500 Subject: [PATCH 1/2] Update batchDetectSpikes.m allow negative absolute thresholds to be read as a string (hyphen to underscore) --- Functions/WATERS-master/batchDetectSpikes.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Functions/WATERS-master/batchDetectSpikes.m b/Functions/WATERS-master/batchDetectSpikes.m index 5d645ed..6d27452 100644 --- a/Functions/WATERS-master/batchDetectSpikes.m +++ b/Functions/WATERS-master/batchDetectSpikes.m @@ -282,6 +282,9 @@ function batchDetectSpikes(dataPath, savePath, option, files, Params, MEANAPapp) wname = char(wnameList{wname}); valid_wname = strrep(wname, '.', 'p'); actual_wname = strrep(wname, 'p', '.'); + if contains(wname, '-') + valid_wname = strrep(wname, '-', '_'); + end spikeWaves = []; spikeFrames = []; From b510469b3e968fe208aa83b78fbfcfae5130a055 Mon Sep 17 00:00:00 2001 From: beccawhitaker Date: Fri, 27 Feb 2026 11:03:45 -0500 Subject: [PATCH 2/2] Update detectSpikesCWT.m absthr edits --- Functions/WATERS-master/detectSpikesCWT.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Functions/WATERS-master/detectSpikesCWT.m b/Functions/WATERS-master/detectSpikesCWT.m index 5d357f7..be6b08d 100644 --- a/Functions/WATERS-master/detectSpikesCWT.m +++ b/Functions/WATERS-master/detectSpikesCWT.m @@ -157,11 +157,18 @@ elseif startsWith(wname, 'absthr') absThreshold = strrep(wname, 'p', '.'); - absThreshold = strrep(absThreshold, 'thr', ''); - absThreshold = str2num(absThreshold); + absThreshold = strrep(absThreshold, 'absthr', ''); + absThreshold = str2double(absThreshold); [spikeTrain, ~, ~] = detectSpikesThreshold(trace, 0, refPeriod, fs, 0, absThreshold, threshold_calculation_window); spikeTimes = find(spikeTrain == 1); threshold = absThreshold; + + % Align spikes by negative peak & remove artifacts by amplitude + [spikeTimes, spikeWaveforms] = alignPeaks(spikeTimes, trace, win, remove_artifacts,... + minPeakThrMultiplier,... + maxPeakThrMultiplier,... + posPeakThrMultiplier); + elseif startsWith(wname, 'customAbs') multiplier = 0; [spikeTrain, ~, ~] = detectSpikesThreshold(trace, multiplier, ...