Skip to content

Commit

Permalink
MAJOR: removed mex and spline support, rewrote to use spikehist.m ins…
Browse files Browse the repository at this point in the history
…tead of spikehist_mex.m
  • Loading branch information
Jonathan Pillow committed Jan 25, 2016
1 parent 987d1b7 commit 47b10ab
Show file tree
Hide file tree
Showing 30 changed files with 26 additions and 1,328 deletions.
78 changes: 0 additions & 78 deletions glmtools_fitting/Loss_splineNlin_GLMlogli.m

This file was deleted.

44 changes: 0 additions & 44 deletions glmtools_fitting/MLfit_GLMspline.m

This file was deleted.

68 changes: 0 additions & 68 deletions glmtools_fitting/MLfit_splineNlin_GLM.m

This file was deleted.

10 changes: 4 additions & 6 deletions glmtools_fitting/initfit_sphistDesignMat.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,21 @@
else Xstruct.ihflag = 1;
end

% Compute vector binary (logical) spike times
% Vector of binary (0 or 1) spike counts
Xstruct.bsps = sparse(gg.sps>0);

% ---- Create Spike-history Design Matrix ------------------------
Xsp = zeros(Xstruct.rlen,nh+nh2*nCoupled); % allocate
twin = [1 Xstruct.rlen]; % time window for convolution (entire length)

% Design matrix for self-coupling filter
if nh>0
Xsp(:,1:nh) = spikefilt_mex(find(Xstruct.bsps),gg.ihbas,twin);
Xsp(:,1:nh) = spikefilt(full(double(gg.sps>0)),gg.ihbas);
end

% Design matrix fo cross-coupling filters
% Design matrix for cross-coupling filters
for jcpl = 1:nCoupled
spInds_jcpl = find(gg.sps2(:,jcpl)); % spike times of coupled neuron
inds = nh+nh2*(jcpl-1)+1:nh+nh2*jcpl; % column indices
Xsp(:,inds) = spikefilt_mex(spInds_jcpl,gg.ihbas2,twin); % insert into design matrix
Xsp(:,inds) = spikefilt(full(double(gg.sps2(:,jcpl))),gg.ihbas2); % insert into design matrix
end

% ---- Set fields of Xstruct -------------------------------------
Expand Down
9 changes: 4 additions & 5 deletions glmtools_fitting/neglogli_GLM.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
Itot = kron(I0,ones(upsampfactor,1)) + dc;

% -------------- Compute net h current --------------------------------
spInds = find(gg.sps);

% Check if post-spike filters are present
if isempty(gg.ihw), gg.ihbas = []; end
Expand All @@ -48,9 +47,9 @@
% Compute convolution of post-spike filters with spike history
nCoupled = length(gg.couplednums); % # cells coupled to this one
if ~isempty(ih)
Itot = Itot + spikefilt_mex(spInds,ih(:,1),[1,rlen]); % self-coupling filter
Itot = Itot + spikefilt(gg.sps,ih(:,1)); % self-coupling filter
for j = 1:nCoupled % coupling filters from other neurons
Itot = Itot + spikefilt_mex(find(gg.sps2(:,j)),ih(:,j+1),[1,rlen]);
Itot = Itot + spikefilt(gg.sps2(:,j),ih(:,j+1));
end
end

Expand All @@ -75,7 +74,7 @@
% Spike-history filter output
if nargout > 5
Ih = zeros(length(Itot),1);
if ~isempty(ih), Ih = spikefilt_mex(spInds,ih(:,1),[1,rlen]);
if ~isempty(ih), Ih = spikefilt(gg.sps,ih(:,1));
end
end

Expand All @@ -84,7 +83,7 @@
Icpl = zeros(length(Itot),size(ih,2)-1);
if ~isempty(ih)
for j = 1:nCoupled
Icpl(:,j) = spikefilt_mex(find(gg.sps2(:,j)),ih(:,j+1),[1,rlen]);
Icpl(:,j) = spikefilt(gg.sps2(:,j),ih(:,j+1));
end
end
end
14 changes: 0 additions & 14 deletions glmtools_mex/initialize_mexcode.m

This file was deleted.

82 changes: 0 additions & 82 deletions glmtools_mex/spikefilt_mex.c

This file was deleted.

Binary file removed glmtools_mex/spikefilt_mex.mexmaci64
Binary file not shown.
6 changes: 3 additions & 3 deletions glmtools_misc/simGLM.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
% column corresponding to a different pixel / regressor.
% Output:
% tsp - list of spike times (in s)
% sps - sparse binary matrix with spike times (at resolution dtSp).
% sps - binary matrix with spike times (at resolution dtSp).
% Itot - summed filter outputs
% Istm - just the spike-history filter output

Expand Down Expand Up @@ -60,7 +60,7 @@

% --------------- Set up simulation dynamics variables ---------------
nsp = 0; % number of spikes
sps = logical(sparse(rlen,1)); % sparse spike time matrix
sps = zeros(rlen,1); % sparse spike time matrix
jbin = 1; % current time bin
tspnext = exprnd(1); % time of next spike (in rescaled time)
rprev = 0; % Integrated rescaled time up to current point
Expand Down Expand Up @@ -174,7 +174,7 @@
end

% Remove any extra bins from tsp and compute binned spike train 'sps'
sps = logical(sparse(rlen,ncells));
sps = zeros(rlen,ncells);
for jj = 1:ncells
tsp{jj} = tsp{jj}(1:nsp(jj));
if ~isempty(tsp{jj})
Expand Down
Loading

0 comments on commit 47b10ab

Please sign in to comment.