
function spikeResp = ClassModel1(allStim)

xDim = 8;
kernelX = xDim;                 % spatial size of filter
kernelT = 6;                    % temporal size of filter
kernelSize = kernelX * kernelT;
nFrames = size(allStim,1);

themodel = 3;

rate = 1/12;
base = 1/100;
crp = 0.85;

rate = 1/12;
base = 00;
itau = 1.2;  sig=1.6; per=4.5;
[X,Y] = meshgrid([1:kernelX]-(kernelX+1)/2,[kernelT:-1:1]);
v1 = exp(-X.^2/(2*sig^2)) .* exp(-itau*Y) .* Y.^2 .* ...
     mkSine([kernelT,kernelX],per,pi/4,1,0);
v2 = exp(-X.^2/(2*sig^2)) .* exp(-itau*Y) .* Y.^2 .* ...
     mkSine([kernelT,kernelX],per,pi/4,1,pi/2);
v3 = exp(-X.^2/(2*sig^2)) .* exp(-itau*Y) .* Y.^2 .* ...
    mkSine([kernelT,kernelX],per,pi/2+pi/4,1,0);

clear modelFilts;
modelFilts(:,:,1) = v1;
modelFilts(:,:,2) = v2;
modelFilts(:,:,3) = v3;
v1=vectify(v1)/sqrt(var2(v1)); v2=vectify(v2)/sqrt(var2(v2));
v3=vectify(v3)/sqrt(var2(v3));

rate = .25;
p=2;
l1 = (allStim*v1>0).*((allStim*v1).^2); % half squared
l2 = ((allStim*v2).^2);
l3 = ((allStim*v3).^2);

linResp = (1 + l1) ...
    ./ (1 + .03*l2 + .05*l3);
linResp = 15*rate*linResp/max(linResp);

spikeResp = (linResp > rand(nFrames,1));
spikeResp(1:(kernelT-1)) = 0;  % can't use these


