OSCR

Subspace reverse-correlation estimation of receptive fields during free viewing.

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 712 lines · 16 KB · CC-BY-4.0

  1. %% This is the code for eye movement correction in the paper "Subspace reverse-correlation estimation of receptive fields during free viewing"
  2. %% Loading the data
  3. clc;
  4. clear;
  5. experiment='np01_003_000'; % Experiment name
  6. data=load(strcat('./data/',experiment,'.db'),'-mat'); % loading the log data
  7. % dimensions of the visual field (the monitor). Here we downsampled our monitor size by a factor of 8.
  8. RF_size=[480,135];
  9. %% Computing the frequency domain receptive fields (fRFs)
  10. [fRFs,norms]=krnls(data.log); % Computing the frequency domain receptive fields (fRFs)
  11. fRFs=mean(fRFs,3);
  12. %% Selecting cells to pass to the optimization algorithm
  13. % FIRST METHOD
  14. % If the RFs are strongly distorted by eye movements such that they are not detectable we may select the cells based on the fRFs and their frequency.
  15. % [poris,freqs,frfm]=freq_extract(fRFs); % Extracting preferred oreintations (poris), preferred spatial frequencies (freqs)
  16. % index=find(frfm>0.01 & (freqs<16)); % finding the cells with large enough mean response and preferred frequency below a threshold
  17. % select=index; % The select indices will be used for optimization.
  18. % mask=[]; % empty mask allows optimization to be applied to all the visual field domain.
  19. % SECOND METHOD
  20. % If the RFs are visible we can select cells based on the Riesz envlope sharpness of the RFs.
  21. % If needed a mask can be used to limit the optimizer to particular areas of the receptive fields.
  22. % The following code gives us mask and selected neurons in mouse data.
  23. m=0.5;
  24. [mask,index,env,Narea,Nmax]=getmasks(data.log,m,RF_size); % Riesz envelopes are returned as env. Masks are seleced by thresholding the envelopes above 50 percent of their max value.
  25. select=index(1:40);
  26. disp('selected=')
  27. disp(select)
  28. mask=[]; % empty mask allows optimization to be applied to all the visual field domain.
  29. % SECOND METHOD
  30. % You can select the neurons and masks by hand.
  31. % select must be a one dimensional array with indices of selected neurons
  32. % mask must be a 3D array of zeros and ones with first index for neurons and other two
  33. % equivalent to dimensions of the screen. The optimization will be applied to mask==1.
  34. %% running the optimization algorithm
  35. A0=[4.5,0 ; 0,4.5]; % initial guess of the A matrix.
  36. [A,fval,exitflag,output,grad]=EYE_CORRECT(data.log,select,mask,A0,RF_size);
  37. %% Evaluating all RFs before and after correction
  38. tic
  39. rfsb=RECEPTIVE_FIELDS(data.log,[],[],0,RF_size); % before correction
  40. rfsa=RECEPTIVE_FIELDS(data.log,[],A,0,RF_size); % after correction
  41. toc
  42. % rearranging the data
  43. rfsa= permute(rfsa,[1 2 4 3]);
  44. rfsb= permute(rfsb,[1 2 4 3]);
  45. %% visualizing the RFs
  46. ftsz=18;
  47. N=length(select);
  48. % disp(select);
  49. for i=1:N
  50. ii=select(i);
  51. % rfb=squeeze(mean(squeeze(rfsb(:,ii,:,:)),1));
  52. % rfa=squeeze(mean(squeeze(rfsa(:,ii,:,:)),1));
  53. rfb=squeeze(squeeze(rfsb(ii,:,:)))';
  54. rfa=squeeze(squeeze(rfsa(ii,:,:)))';
  55. bmax=max(rfb(:));
  56. amax=max(rfa(:));
  57. cmax=max(bmax,amax);
  58. bmin=min(rfb(:));
  59. amin=min(rfa(:));
  60. cmin=min(bmin,amin);
  61. figure(1)
  62. ax1=subplot(2,2,2);
  63. imagesc(rfb);
  64. axis equal
  65. axis tight
  66. % axis off
  67. set(gca,'xticklabel',[])
  68. set(gca,'yticklabel',[])
  69. set(gca,'XTick',[])
  70. set(gca,'YTick',[])
  71. set(gca,'YDir','normal')
  72. colormap(ax1,parula)
  73. clim([cmin cmax])
  74. title('Naive','fontsize',ftsz)
  75. colorbar
  76. ax2=subplot(2,2,4);
  77. imagesc(rfa);
  78. axis equal
  79. axis tight
  80. % axis off
  81. set(gca,'xticklabel',[])
  82. set(gca,'yticklabel',[])
  83. set(gca,'XTick',[])
  84. set(gca,'YTick',[])
  85. set(gca,'YDir','normal')
  86. colormap(ax1,parula)
  87. clim([cmin cmax])
  88. title('Corrected','fontsize',ftsz)
  89. colorbar
  90. subplot(1,2,1)
  91. imagesc(squeeze(fRFs(:,:,ii)))
  92. axis equal
  93. axis tight
  94. xlabel('$k$','interpreter','latex','fontsize',ftsz)
  95. ylabel('$l$','interpreter','latex','fontsize',ftsz)
  96. title('fRF','fontsize',ftsz)
  97. pause;
  98. end
  99. %%
  100. function [A,fval,exitflag,output,grad,mask]=EYE_CORRECT(DATA,select,mask,A0,RF_size)
  101. % The cost function is based on the norm^2 of the receptive
  102. % fields.
  103. % Inputs are:
  104. % DATA=log
  105. % "select" is the neurons selected to do the optimization based on their
  106. % receptive fields. If select = [] all the neurons will be selected
  107. % mask allows focusing on the receptive fields is a binary array of zeros
  108. % and ones. zero outside of the RF domain and one in the RF domain of each
  109. % neuron. If mask=[] the code uses all the visual field to calibrate eye
  110. % movements
  111. % A0 is the initial guess for 2by2 matrix A. if A=[] then A0=[4,0 ; 0,4]
  112. % will be used
  113. % Outputs are:
  114. % A, fval , exitflag , output , grad at the optimum point.
  115. % Putting data to the format to pass to optimization algorithm
  116. disp('Putting data to the format to pass to optimization algorithm');
  117. ncells = size(DATA.signal{1},2);
  118. nstim = size(DATA,1);
  119. x_E=DATA.xpos-mean(DATA.xpos,'omitnan');
  120. y_E=DATA.ypos-mean(DATA.ypos,'omitnan');
  121. if(sum(isnan(x_E))+sum(isnan(y_E))>0)
  122. disp('--------------------------------')
  123. warning('There are trials with NAN values for eye positions that are set to zero')
  124. disp('--------------------------------')
  125. end
  126. idxnanx=isnan(x_E);
  127. idxnany=isnan(y_E);
  128. x_E(idxnanx)=0;
  129. y_E(idxnany)=0;
  130. S_tr=zeros(nstim,3);
  131. S_tr(:,1)=DATA.kx;
  132. S_tr(:,2)=DATA.ky;
  133. S_tr(:,3)=DATA.sign;
  134. R=cat(3,DATA.signal{:});
  135. Lambda_tr=squeeze(mean(R(2:7,:,:),1));
  136. if(isempty( select ))
  137. select=1:ncells;
  138. end
  139. if(isempty( A0 ))
  140. A0=[4,0 ; 0,4];
  141. end
  142. r=Lambda_tr(select,:);
  143. if(isempty(mask))
  144. mask1=[];
  145. else
  146. mask1=mask(select,:,:);
  147. end
  148. % running the minimization algorithm
  149. X0=[ A0(1,1) , A0(1,2) , A0(2,1) , A0(2,2) ];
  150. disp('starting optimization')
  151. tic
  152. opt = optimoptions('fminunc','SpecifyObjectiveGradient',true,'Display','iter','PlotFcns',@optimplotfval,'MaxIter',150,'TolFun',1e-5,'TolX',1e-5,'OutputFcn', @outfun);
  153. [X,fval,exitflag,output,grad] = fminunc( @(X)EYE_CORRECT_COSTSD(X,x_E,y_E,S_tr,r,RF_size,mask1) , X0 , opt );
  154. toc
  155. A=[X(1),X(2);X(3),X(4)];
  156. end
  157. %% Functions
  158. function U=KXLY(mon_size,k,l)
  159. % meshgrid phase of the cas function in the visual field
  160. Xmon=mon_size(1);
  161. Ymon=mon_size(2);
  162. ix=(1:Xmon);
  163. iy=(1:Ymon);
  164. [X,Y]=meshgrid(ix,iy);
  165. U=(2*pi/Xmon)*(k*X+l*Y);
  166. U=U';
  167. end
  168. %% This is a function that decouples the space and time components of the cas
  169. function [Rcos,Rsin,DaRcos,DaRsin,DbRcos,DbRsin,DcRcos,DcRsin,DdRcos,DdRsin]=reorganize(Lambda_tr,S_tr,x_E,y_E,A,RF_size)
  170. a=A(1,1);
  171. b=A(1,2);
  172. c=A(2,1);
  173. d=A(2,2);
  174. [N,~]=size(Lambda_tr);
  175. k=unique(S_tr(:,1));
  176. l=unique(S_tr(:,2));
  177. p=unique(S_tr(:,3));
  178. Nk=length(k);
  179. Nl=length(l);
  180. Np=length(p);
  181. XRF=RF_size(1);
  182. Rsin=zeros(Nk,Nl,Np,N);
  183. Rcos=zeros(Nk,Nl,Np,N);
  184. DaRcos=zeros(Nk,Nl,Np,N);
  185. DaRsin=zeros(Nk,Nl,Np,N);
  186. DbRcos=zeros(Nk,Nl,Np,N);
  187. DbRsin=zeros(Nk,Nl,Np,N);
  188. DcRcos=zeros(Nk,Nl,Np,N);
  189. DcRsin=zeros(Nk,Nl,Np,N);
  190. DdRcos=zeros(Nk,Nl,Np,N);
  191. DdRsin=zeros(Nk,Nl,Np,N);
  192. for ik=1:Nk
  193. kkk=k(ik);
  194. for il=1:Nl
  195. lll=l(il);
  196. for ip=1:Np
  197. pp=p(ip);
  198. idx=find(S_tr(:,1)==kkk & S_tr(:,2)==lll & S_tr(:,3)==pp);
  199. kk=kkk*2*pi/XRF;
  200. ll=2*pi*lll/XRF;
  201. xx=x_E(idx);
  202. yy=y_E(idx);
  203. Rcos(ik,il,ip,:)=pp*tensorprod( Lambda_tr(:,idx),cos( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ) , 2,1 );
  204. Rsin(ik,il,ip,:)=pp*tensorprod( Lambda_tr(:,idx),sin( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ) , 2,1);
  205. DaRcos(ik,il,ip,:)=-pp*tensorprod( Lambda_tr(:,idx), (kk*xx) .* sin( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ), 2,1);
  206. DaRsin(ik,il,ip,:)= pp*tensorprod( Lambda_tr(:,idx), (kk*xx) .* cos( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ), 2,1);
  207. DbRcos(ik,il,ip,:)=-pp*tensorprod( Lambda_tr(:,idx), (kk*yy) .* sin( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ), 2,1);
  208. DbRsin(ik,il,ip,:)= pp*tensorprod( Lambda_tr(:,idx), (kk*yy) .* cos( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ), 2,1);
  209. DcRcos(ik,il,ip,:)=-pp*tensorprod( Lambda_tr(:,idx), (ll*xx) .* sin( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ), 2,1);
  210. DcRsin(ik,il,ip,:)= pp*tensorprod( Lambda_tr(:,idx), (ll*xx) .* cos( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ), 2,1);
  211. DdRcos(ik,il,ip,:)=-pp*tensorprod( Lambda_tr(:,idx), (ll*yy) .* sin( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ), 2,1);
  212. DdRsin(ik,il,ip,:)= pp*tensorprod( Lambda_tr(:,idx), (ll*yy) .* cos( kk*(a*xx+b*yy)+ll*(c*xx+d*yy) ), 2,1);
  213. end
  214. end
  215. end
  216. end
  217. %%
  218. function [RFS,DRFS11,DRFS12,DRFS21,DRFS22]=RF_ESTSD(Lambda_tr,S_tr,x_E,y_E,RF_size,A)
  219. % This function computes the variables that are used to evaluate the objective function and its gradient
  220. [Rcos,Rsin,DaRcos,DaRsin,DbRcos,DbRsin,DcRcos,DcRsin,DdRcos,DdRsin]=reorganize(Lambda_tr,S_tr,x_E,y_E,A,RF_size);
  221. % [N,~]=size(Lambda_tr);
  222. Xmon=RF_size(1);
  223. Ymon=RF_size(2);
  224. k=unique(S_tr(:,1));
  225. l=unique(S_tr(:,2));
  226. p=unique(S_tr(:,3));
  227. Nk=length(k);
  228. Nl=length(l);
  229. % Np=length(p);
  230. casU=zeros(Nk,Nl,Xmon,Ymon);
  231. cas1U=zeros(Nk,Nl,Xmon,Ymon);
  232. Rcos1=squeeze(sum(Rcos,3));
  233. Rsin1=squeeze(sum(Rsin,3));
  234. DaRcos1=squeeze(sum(DaRcos,3));
  235. DaRsin1=squeeze(sum(DaRsin,3));
  236. DbRcos1=squeeze(sum(DbRcos,3));
  237. DbRsin1=squeeze(sum(DbRsin,3));
  238. DcRcos1=squeeze(sum(DcRcos,3));
  239. DcRsin1=squeeze(sum(DcRsin,3));
  240. DdRcos1=squeeze(sum(DdRcos,3));
  241. DdRsin1=squeeze(sum(DdRsin,3));
  242. for ik=1:Nk
  243. kk=k(ik);
  244. for il=1:Nl
  245. ll=l(il);
  246. U=KXLY(RF_size,kk,ll);
  247. casU(ik,il,:,:)=cas(U);
  248. cas1U(ik,il,:,:)=cas1(U);
  249. end
  250. end
  251. RFS=tensorprod(Rcos1,casU,[1,2],[1,2]) + tensorprod(Rsin1,cas1U,[1,2],[1,2]);
  252. DRFS11=tensorprod(DaRcos1,casU,[1,2],[1,2]) + tensorprod(DaRsin1,cas1U,[1,2],[1,2]);
  253. DRFS12=tensorprod(DbRcos1,casU,[1,2],[1,2]) + tensorprod(DbRsin1,cas1U,[1,2],[1,2]);
  254. DRFS21=tensorprod(DcRcos1,casU,[1,2],[1,2]) + tensorprod(DcRsin1,cas1U,[1,2],[1,2]);
  255. DRFS22=tensorprod(DdRcos1,casU,[1,2],[1,2]) + tensorprod(DdRsin1,cas1U,[1,2],[1,2]);
  256. end
  257. %%
  258. function RFS=RF_ESTS(Lambda_tr,S_tr,x_E,y_E,RF_size,A)
  259. [Rcos,Rsin,~,~,~,~,~,~,~,~]=reorganize(Lambda_tr,S_tr,x_E,y_E,A,RF_size);
  260. Xmon=RF_size(1);
  261. Ymon=RF_size(2);
  262. k=unique(S_tr(:,1));
  263. l=unique(S_tr(:,2));
  264. p=unique(S_tr(:,3));
  265. Nk=length(k);
  266. Nl=length(l);
  267. casU=zeros(Nk,Nl,Xmon,Ymon);
  268. cas1U=zeros(Nk,Nl,Xmon,Ymon);
  269. Rcos1=squeeze(sum(Rcos,3));
  270. Rsin1=squeeze(sum(Rsin,3));
  271. for ik=1:Nk
  272. kk=k(ik);
  273. for il=1:Nl
  274. ll=l(il);
  275. U=KXLY(RF_size,kk,ll);
  276. casU(ik,il,:,:)=cas(U);
  277. cas1U(ik,il,:,:)=cas1(U);
  278. end
  279. end
  280. RFS=tensorprod(Rcos1,casU,[1,2],[1,2]) + tensorprod(Rsin1,cas1U,[1,2],[1,2]);
  281. end
  282. %%
  283. function stop = outfun(x, optimValues, state)
  284. stop = false;
  285. A=[x(1), x(2) ; x(3) , x(4)];
  286. disp('A=')
  287. disp(A)
  288. drawnow
  289. end
  290. %%
  291. function [ELL,DELL]=EYE_CORRECT_COSTSD(X,x_E,y_E,S_tr,Lambda_tr,RF_size,mask)
  292. % This function returns
  293. % ELL = -E(A) where E(A) is our opjective function
  294. % DELL = the gradient
  295. A(1,1)=X(1);
  296. A(1,2)=X(2);
  297. A(2,1)=X(3);
  298. A(2,2)=X(4);
  299. [RFS,DRFS11,DRFS12,DRFS21,DRFS22]=RF_ESTSD(Lambda_tr,S_tr,x_E,y_E,RF_size,A);
  300. if(~isempty(mask))
  301. RFS=RFS.*mask;
  302. end
  303. DELL = -2 * [sum(RFS.*DRFS11,'all') , sum(RFS.*DRFS12,'all') , sum(RFS.*DRFS21,'all') , sum(RFS.*DRFS22,'all')]/(RF_size(1)*RF_size(2));
  304. ELL = -norm(RFS(:))^2 /(RF_size(1)*RF_size(2));
  305. end
  306. %%
  307. function y=cas1(x)
  308. y=sin(x)-cos(x);
  309. end
  310. %%
  311. function y=cas(x)
  312. y=sin(x)+cos(x);
  313. end
  314. %%
  315. function [mask,index,envelopes,Narea,N1]=getmasks(log,m,RF_size)
  316. % This function gets the data (log table), the threshold for masking 0<m<1
  317. % and RF size [length , height].
  318. % Returns:
  319. % masks,
  320. % index = cell indices sorted according to the naive RF sharpness,
  321. % envelopes = The Riesz Transforms
  322. % Narea = number of connected components after thresholding
  323. % N1 = Number of RFs with only one connected component
  324. rfs=RECEPTIVE_FIELDS(log,[],[],0,RF_size);
  325. [N,~,~]=size(rfs);
  326. mask=zeros(size(rfs));
  327. Cost=zeros(N,1);
  328. envelopes=zeros(size(rfs));
  329. Narea=zeros(N,1);
  330. for i=1:N
  331. E=rieszEnvelope(squeeze(rfs(i,:,:)));
  332. Eth=m*max(E,[],'all');
  333. % Eth=mean(E,'all')+1*std(E,[],'all');
  334. idx=E>Eth;
  335. CC = bwconncomp(idx);
  336. p = regionprops(CC,"Area");
  337. [maxArea,maxIdx] = max([p.Area]);
  338. [areas,IDX]=sort([p.Area],'descend');
  339. Narea(i)=CC.NumObjects;
  340. idx2= cc2bw(CC,ObjectsToKeep=maxIdx);
  341. idx2 = imdilate(idx2,strel("disk",8));
  342. ratio=maxArea/sum(areas);
  343. envelopes(i,:,:)=E;
  344. mask(i,:,:)=idx2;
  345. Cost(i)=ratio*sum(idx2.*squeeze(rfs(i,:,:).^2),'all');
  346. Cost(i)=Cost(i)/(100000^(Narea(i)-1));
  347. end
  348. ind=Narea==1;
  349. N1=sum(ind);
  350. [~,index]=sort(Cost,'descend');
  351. end
  352. %%
  353. function RFST=RECEPTIVE_FIELDS(DATA,select,A,flag,RF_size)
  354. % Inputs are:
  355. % DATA=log
  356. % "select" is an array indices of the neurons you want their receptive fields.
  357. % If select = [] all the neurons will be selected
  358. % Outputs are:
  359. % rfsb and rfsa
  360. % Receptive fields for neurons with and without corrections based on A.
  361. % flag=0 RFs are calculated for all time bins. falg=1 RFs are calculated for
  362. % the average 2:7 time bins.
  363. nstim = size(DATA,1);
  364. ncells = size(DATA.signal{1},2);
  365. if(isempty( select ))
  366. select=1:ncells;
  367. end
  368. if(isempty( A ))
  369. A=[0,0 ; 0,0];
  370. end
  371. x_E=DATA.xpos-mean(DATA.xpos,'omitnan');
  372. y_E=DATA.ypos-mean(DATA.ypos,'omitnan');
  373. idxnanx=isnan(x_E);
  374. idxnany=isnan(y_E);
  375. x_E(idxnanx)=0;
  376. y_E(idxnany)=0;
  377. S_tr=zeros(nstim,3);
  378. S_tr(:,1)=DATA.kx;
  379. S_tr(:,2)=DATA.ky;
  380. S_tr(:,3)=DATA.sign;
  381. Xmon=RF_size(1);
  382. Ymon=RF_size(2);
  383. LAMBDA=cat(3,DATA.signal{:});
  384. LAMBDA=LAMBDA(:,select,:);
  385. [T,N,~]=size(LAMBDA);
  386. if flag==1
  387. RFST=zeros(T,N,Xmon,Ymon);
  388. for t=1:T
  389. Lambda_tr=squeeze(LAMBDA(t,:,:));
  390. RFS=RF_ESTS(Lambda_tr,S_tr,x_E,y_E,RF_size,A);
  391. RFST(t,:,:,:)=RFS;
  392. end
  393. elseif(flag==0)
  394. Lambda_tr=squeeze(mean(LAMBDA(2:7,:,:),1));
  395. RFST=RF_ESTS(Lambda_tr,S_tr,x_E,y_E,RF_size,A);
  396. end
  397. end
  398. %%
  399. function E = rieszEnvelope(X)
  400. % RIESZENVELOPE Local envelope via the monogenic signal
  401. % E = rieszEnvelope(X) returns sqrt( X.^2 + R1.^2 + R2.^2 ),
  402. % where [R1,R2] are the Riesz transform of X.
  403. % compute Riesz components
  404. [M,N] = size(X);
  405. F = fft2(X);
  406. ux = ifftshift((-floor(N/2):ceil(N/2)-1)/N);
  407. uy = ifftshift((-floor(M/2):ceil(M/2)-1)/M).';
  408. [U,V] = meshgrid(ux,uy);
  409. K = sqrt(U.^2+V.^2)+eps;
  410. H1 = -1i*(U./K);
  411. H2 = -1i*(V./K);
  412. R1 = ifft2(F.*H1);
  413. R2 = ifft2(F.*H2);
  414. % envelope = magnitude of [X, R1, R2]
  415. E = sqrt( abs(X).^2 + abs(R1).^2 + abs(R2).^2 );
  416. end
  417. %%
  418. function [Rt,norms]=krnls(log)
  419. % This function gets the log data and returns the frequency domain RFs (fRFs) and their norms.
  420. % "norms" is a two dimensional array.
  421. % First index -> number of cells
  422. % Second index -> time
  423. % Rt are kernels for all conditions
  424. maxk = max(log.kx); % the maximum number of cycles per screen
  425. sz = size(log.signal{1}); % size of the signal [time bins x number of cells]
  426. Rt = zeros([2*maxk+1 2*maxk+1 sz]); % responses all
  427. for i = 1:size(log,1) % lets accumulate the resposnes and compute the mean at the end
  428. kx = log.kx(i)+maxk+1; % pick (kx,ky) for this trial
  429. ky = log.ky(i)+maxk+1; % shift the index so it starts at 1
  430. Rt(kx,ky,:,:) = squeeze(Rt(kx,ky,:,:)) + log.signal{i};
  431. end
  432. ncells = size(log.signal{1},2);
  433. % filter
  434. sigma = 3; % Little bit of smoothing the kernels
  435. norms=zeros(ncells,10);
  436. for n=1:ncells
  437. for i=1:10
  438. Rt(:,:,i,n) = imgaussfilt(squeeze(Rt(:,:,i,n)),sigma);
  439. krnl=squeeze(Rt(:,:,i,n));
  440. norms(n,i)=norm(krnl(:));
  441. end
  442. end
  443. end
  444. %% Extracting preferred frequency and orientation of the RFs
  445. function [poris,freqs,frfm]=freq_extract(Rt)
  446. % Tis function gets the fRFs as input and returns
  447. % poris = preferred orientations
  448. % freqs = preferred spatial frequencies
  449. % frfm = mean of the fRFs
  450. [~,~,N]=size(Rt);
  451. poris=zeros(N,1);
  452. freqs=zeros(N,1);
  453. frfm=zeros(N,1);
  454. t=1;
  455. for i=1:N
  456. krnl=squeeze(Rt(:,:,i));
  457. krnl=0.5*(krnl+flip(flip(krnl,1),2));
  458. [rs, cs]=find(krnl==max(krnl(:)));
  459. if(length(cs)>1)
  460. thetaa=(180/pi)*atan( (cs(2)-cs(1))/(rs(2)-rs(1)));
  461. nuu=0.5*sqrt( (cs(2)-cs(1))^2+(rs(2)-rs(1))^2);
  462. else
  463. thetaa=2*pi;
  464. nuu=0;
  465. end
  466. poris(i,t)=thetaa;
  467. freqs(i,t)=nuu;
  468. frfm(i,t)=mean(krnl(:));
  469. end
  470. end

eye_cal.m, under CC-BY-4.0 · at the source

Overview

Authors: S Amin Moosavi1, Elaine Tring1, Dario L Ringach2
  1. Department of Neurobiology, David Geffen School of Medicine, University of California, Los Angeles, CA, USA
  2. Department of Neurobiology and Department of Psychology, David Geffen School of Medicine, University of California, Los Angeles, CA, USA
Institutions: University of California, Los Angeles (United States)
Journal: Journal of vision, volume 26, issue 8, article 9
Dates: received 26 September 2025; accepted 4 July 2026; published online 31 August 2026; in print August 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1167/jov.26.8.9 · PMID 42671131 · PMCID PMC13533300 · OpenAlex W4414524836
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: behavior only (modality), mouse (organism), systems (subfield)
Methods: Single-unit activity, calcium imaging, Physiology & signal measures
Keywords: receptive fields, primary visual cortex, free viewing, subspace reverse correlation, simple cells
MeSH: Eye Movements*, Models, Neurological*, Retina*, Visual Cortex*, Visual Fields*, Animals, Mice, Photic Stimulation (* major topic)
Topic: Visual perception and processing mechanisms (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: NEI NIH HHS (R21 EY035064, R01 EY034488); NINDS NIH HHS (R01 NS116471, RF1 NS116471)
Citations: not cited yet (Europe PMC); 16 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above.

figshare 32257377

License: CC-BY-4.0
State: the link answers, verified on 26 September 2026
Evidence: files inventoried
Languages: MATLAB (1)
Size: 3 files, 1 script
Software Heritage: not checked
Found in: the acknowledgements
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 26 September 2026: the link answers (HTTP 200)
  • 26 September 2026: the link answers (HTTP 200)
1 file

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 1 script, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 3, 28 September 2026

  • Authors: added S Amin Moosavi (0000-0002-8862-789X); Dario L Ringach (0000-0001-6439-334X); removed S Amin Moosavi; Dario L Ringach

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 5 keywords, 8 MeSH terms, 2 funders, 12 references.

Cite

This paper

Moosavi, S. A., Tring, E., & Ringach, D. L. (2026). Subspace reverse-correlation estimation of receptive fields during free viewing. Journal of vision, 26(8), 9. https://doi.org/10.1167/jov.26.8.9

BibTeX

@article{moosavi2026subspace,
author = {Moosavi, S Amin and Tring, Elaine and Ringach, Dario L},
title = {{Subspace reverse-correlation estimation of receptive fields during free viewing}},
journal = {Journal of vision},
year = {2026},
month = aug,
volume = {26},
number = {8},
pages = {9},
publisher = {Association for Research in Vision and Ophthalmology},
issn = {1534-7362},
doi = {10.1167/jov.26.8.9},
url = {https://doi.org/10.1167/jov.26.8.9},
pmid = {42671131},
pmcid = {PMC13533300}
}

RIS

TY - JOUR
AU - Moosavi, S Amin
AU - Tring, Elaine
AU - Ringach, Dario L
TI - Subspace reverse-correlation estimation of receptive fields during free viewing
T2 - Journal of vision
J2 - J Vis
PY - 2026
DA - 2026/08/01
VL - 26
IS - 8
SP - 9
SN - 1534-7362
PB - Association for Research in Vision and Ophthalmology
DO - 10.1167/jov.26.8.9
UR - https://doi.org/10.1167/jov.26.8.9
LA - en
ER -

CSL-JSON

{
"id": "10.1167/jov.26.8.9",
"type": "article-journal",
"title": "Subspace reverse-correlation estimation of receptive fields during free viewing",
"container-title": "Journal of vision",
"author": [
{
"family": "Moosavi",
"given": "S Amin"
},
{
"family": "Tring",
"given": "Elaine"
},
{
"family": "Ringach",
"given": "Dario L"
}
],
"container-title-short": "J Vis",
"volume": "26",
"issue": "8",
"page": "9",
"DOI": "10.1167/jov.26.8.9",
"PMID": "42671131",
"PMCID": "PMC13533300",
"ISSN": "1534-7362",
"publisher": "Association for Research in Vision and Ophthalmology",
"URL": "https://doi.org/10.1167/jov.26.8.9",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
1
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1126/sciadv.adz9632 [code]
Population coding under the scale invariance of high-dimensional noise.
Journal: Science advances
In common: systems, mouse, author S Amin Moosavi
[2] doi:10.1016/j.crmeth.2026.101421 [code]
EthoPy provides an accessible platform for reproducible behavioral neuroscience.
Journal: Cell reports methods
In common: behavior only, mouse, 3 references
[3] doi:10.1038/s41467-026-75347-4 [code]
Sleep reveals dynamics integrating and segregating movement and stimulus representations in V1.
Journal: Nature communications
In common: Optimization Toolbox, Image Processing Toolbox, systems, mouse, 1 reference
[4] doi:10.1016/j.celrep.2026.117646 [code]
Medial entorhinal-hippocampal desynchronization parallels the emergence of memory impairment in a mouse model of Alzheimer's disease pathology.
Journal: Cell reports
In common: Optimization Toolbox, Image Processing Toolbox, systems, mouse, 1 reference
[5] doi:10.1016/j.neuron.2026.03.034 [code]
Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice.
Journal: Neuron
In common: Optimization Toolbox, Image Processing Toolbox, systems, mouse, 1 reference
[6] doi:10.1523/jneurosci.2001-25.2026 [code]
Dynamics of Dentate Gyrus Place Cells and Dentate Spikes during Spatial and Nonspatial Changes in Environments.
Journal: The Journal of neuroscience : the official journal of the Society for Neuroscience
In common: Optimization Toolbox, Image Processing Toolbox, systems, 1 reference
[7] doi:10.1038/s41467-026-76581-6 [code]
Thalamocortical bursts encode reward contingencies and drive associative learning.
Journal: Nature communications
In common: Image Processing Toolbox, systems, mouse, 2 references
[8] doi:10.1523/eneuro.0417-25.2026 [code]
Learning and Motivation State Fluctuations from Motoric and Neurophysiologic Metrics during a Somatosensory Task in Mice.
Journal: eNeuro
In common: Optimization Toolbox, Image Processing Toolbox, behavior only, mouse
[9] doi:10.1038/s41593-026-02357-2 [code]
Experience reorganizes content-specific memory traces in macaques.
Journal: Nature neuroscience
In common: Optimization Toolbox, Image Processing Toolbox, 1 reference
[10] doi:10.1038/s41593-026-02350-9 [code]
Probing inter-areal computations with a two-photon holographic mesoscope.
Journal: Nature neuroscience
In common: Optimization Toolbox, Image Processing Toolbox, systems, mouse

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.