function [index, spikes, thr, thrmax, noise_std_detect, noise_std_sorted] = DetectSpikes_Amp(Data, handles) % DetectSpikes_Amp Detect spikes based on amplitude thresholding. Adapted % from WaveClus % Detailed explanation goes here % index - spike times in ms % spikes - spike waveforms index_all=[]; spikes_all=[]; % SPIKE DETECTION WITH AMPLITUDE THRESHOLDING % korjaa sampleratella % julkaisun defaultit: 24000Hz, pre 20 events, post 44 events sr_factor = 24000; handles.w_pre = ceil(handles.w_pre/sr_factor*handles.sr); %number of pre-event data points stored (def. 20) handles.w_post = ceil(handles.w_post/sr_factor*handles.sr); %number of post-event data points stored (def. 44) handles.ref = floor(handles.min_ref_per*handles.sr/1000); %number of counts corresponding to the dead time [spikes,thr,thrmax, noise_std_detect, noise_std_sorted, index] = amp_detect(Data,handles); %detection with amp. thresh. --> voiko Data olla taulukkona? index = index'; index_all = [index_all index]; spikes_all = [spikes_all; spikes]; index = index_all/handles.sr; %spike times in ms --> now in s spikes = spikes_all; end