Using a leaky integrate and fire neuron to generate spiking from fluctuating stimuli, but I wanted to generate data with different spike count variance. The problem came when two sources of variance worked to change other aspects of spike counts I didn't want. Increasing trial-by-trial noise promoted noise-driven activity, i.e., the rate went up, but the variance didn't increase that much. Increasing stimulus noise (which in truth shouldn't really be called noise, since it is these fluctuations that drive spiking), rapidly increased the firing rate and actually decreased spike variance.
These two forces needed to be balanced then. For future reference, muck about by decreasing stimulus noise, and increasing trial-by-trial noise.
A foray into electrophysiology and computational neuroscience. Lashings of whatever comes into mind on the way.
Friday, 21 June 2013
Time-Correlated Gaussian Noise
Short Matlab script for generated time-correlated gaussian noise thanks to my supervisor. It takes the previous sample and generated a new sample with sampling rate dt based on a gaussian with time constant tau, mean mu and sd sig.
function y = tcorr_randn(y_prev,mu, sig, tau, dt)
y = mu + (y_prev - mu)*exp(-dt/tau) + sig*sqrt(1-exp(-2*dt/tau))*randn;
end
Monday, 10 June 2013
Interspike intervals: The fast way?
A reminder for myself more than anything
For a set of spike data distributed across time, i.e., a N x T matrix, where N is number of cells, T is total time steps dt:
function [ints, spt] = isi(spikes, dt)
% Uses spike data to output interspike intervals and accompanying spike times.
[N, T] = size(spikes);
ints = []; % intervals
spt = []; % spiketimes
% Find isi for each cell
for n = 1:N
spiketime = find(spikes(n,:) == 1);
ints = [ints,spiketime(1),diff(spiketime)];
spt = [spt,spiketime];
end
if isempty(ints)
ints = inf;
end
ints = ints/(dt*T);
[spt col] = sort(spt, 'ascend'); spiketimes in ascending order
ints = ints(col); intervals sorted by spiketime
end
I would very much like to know if there is a faster way, particularly if it means I could find for all cells at once. Currently it isn't completely matlab efficient.
Subscribe to:
Posts (Atom)