26 lines
694 B
Matlab

function output = spiketimes(obj, varargin)
%SPIKETIMES Spiketimes from pricklypear simulation
% spiketimes(PP)
% spiketimes(PP, thr)
% spiketimes(PP, thr, chan)
% Handle input
p = inputParser();
p.addOptional('threshold', 0);
p.addOptional('channel', 'ap', @ischar);
p.parse(varargin{:});
p = p.Results;
% The object must be a specific run
assert(~isempty(experiment(obj)), 'Please specify an experiment');
assert(~isempty(irec(obj)), 'Please specify a specific run');
% Get the raw recording
ad = anadata(obj, p.channel, 'vm');
% Detect peaks
output = peakpicker(obj.dt, ad, p.threshold);
output = output{1};
end