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 = []; 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, ...