diff --git a/analyzePRF.m b/analyzePRF.m index 17a00dd..a215d90 100644 --- a/analyzePRF.m +++ b/analyzePRF.m @@ -193,6 +193,9 @@ % This is a little clunky but works... % % history: +% 2022/06/14 - the case of non-square stimulus preparations was being handled +% incorrectly (e.g. ang and ecc were being computed incorrectly). +% it is now fixed. % 2022/03/26 - implement new option . this changes past behavior, % in a sense, but the differences are tiny. % 2021/12/05 - tag as version 1.5. @@ -432,16 +435,16 @@ modelfun = @(pp,dd) conv2run(posrect(pp(4)) * (dd*[vflatten(placematrix(zeros(res),makegaussian2d(resmx,pp(1),pp(2),abs(pp(3)),abs(pp(3)),xx,yy,0,0) / (2*pi*abs(pp(3))^2))); 0]) .^ posrect(pp(5),options.exptlowerbound),options.hrf,dd(:,prod(res)+1)); switch options.modelmode % NOTE: these bounds may not have any effect if you use levenberg-marquardt optimization! case 1 - model = {{[] [1-res(1)+1 1-res(2)+1 0 0 NaN; - 2*res(1)-1 2*res(2)-1 Inf Inf Inf] modelfun} ... - {@(ss)ss [1-res(1)+1 1-res(2)+1 0 0 options.exptlowerbound; - 2*res(1)-1 2*res(2)-1 Inf Inf Inf] @(ss)modelfun}}; + model = {{[] [1-resmx+1 1-resmx+1 0 0 NaN; + 2*resmx-1 2*resmx-1 Inf Inf Inf] modelfun} ... + {@(ss)ss [1-resmx+1 1-resmx+1 0 0 options.exptlowerbound; + 2*resmx-1 2*resmx-1 Inf Inf Inf] @(ss)modelfun}}; case 2 - model = {{[] [1-res(1)+1 1-res(2)+1 0 0 options.exptlowerbound; - 2*res(1)-1 2*res(2)-1 Inf Inf Inf] modelfun}}; + model = {{[] [1-resmx+1 1-resmx+1 0 0 options.exptlowerbound; + 2*resmx-1 2*resmx-1 Inf Inf Inf] modelfun}}; case 3 - model = {{[] [1-res(1)+1 1-res(2)+1 0 0 NaN; - 2*res(1)-1 2*res(2)-1 Inf Inf Inf] modelfun}}; + model = {{[] [1-resmx+1 1-resmx+1 0 0 NaN; + 2*resmx-1 2*resmx-1 Inf Inf Inf] modelfun}}; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PREPARE SEEDS @@ -457,13 +460,13 @@ % generic large seed if ismember(0,options.seedmode) seeds = [seeds; - (1+res(1))/2 (1+res(2))/2 resmx/4*sqrt(0.5) options.typicalgain 0.5]; + (1+resmx)/2 (1+resmx)/2 resmx/4*sqrt(0.5) options.typicalgain 0.5]; end % generic small seed if ismember(1,options.seedmode) seeds = [seeds; - (1+res(1))/2 (1+res(2))/2 resmx/4*sqrt(0.5)/10 options.typicalgain 0.5]; + (1+resmx)/2 (1+resmx)/2 resmx/4*sqrt(0.5)/10 options.typicalgain 0.5]; end % super-grid seed @@ -723,10 +726,10 @@ end % massage model parameters for output and put in 'results' struct -results.ang(options.vxs,:) = permute(mod(atan2((1+res(1))/2 - paramsA(:,1,:), ... - paramsA(:,2,:) - (1+res(2))/2),2*pi)/pi*180,[3 1 2]); -results.ecc(options.vxs,:) = permute(sqrt(((1+res(1))/2 - paramsA(:,1,:)).^2 + ... - (paramsA(:,2,:) - (1+res(2))/2).^2),[3 1 2]); +results.ang(options.vxs,:) = permute(mod(atan2((1+resmx)/2 - paramsA(:,1,:), ... + paramsA(:,2,:) - (1+resmx)/2),2*pi)/pi*180,[3 1 2]); +results.ecc(options.vxs,:) = permute(sqrt(((1+resmx)/2 - paramsA(:,1,:)).^2 + ... + (paramsA(:,2,:) - (1+resmx)/2).^2),[3 1 2]); results.expt(options.vxs,:) = permute(posrect(paramsA(:,5,:),options.exptlowerbound),[3 1 2]); results.rfsize(options.vxs,:) = permute(abs(paramsA(:,3,:)) ./ sqrt(posrect(paramsA(:,5,:),options.exptlowerbound)),[3 1 2]); results.R2(options.vxs,:) = permute(rA,[2 1]); diff --git a/analyzePRFcomputesupergridseeds.m b/analyzePRFcomputesupergridseeds.m index e5ca211..bfb1547 100644 --- a/analyzePRFcomputesupergridseeds.m +++ b/analyzePRFcomputesupergridseeds.m @@ -19,6 +19,8 @@ % (or XYZ x 1) with the corresponding correlation (r) values. % % history: +% - 2022/06/14 - the case of non-square stimulus preparations was being handled +% incorrectly. it is now fixed. % - 2021/11/11 - remove the forcing of single format and instead inherit from . % also, explicitly handle some pernicious corner cases. % - 2015/02/07 - make less memory intensive @@ -56,8 +58,8 @@ end for s=1:length(ssindices) for r=1:length(expts) - allseeds(cnt,:) = [(1+res(1))/2 - sin(angs(q)) * (eccs(p)*resmx) ... - (1+res(2))/2 + cos(angs(q)) * (eccs(p)*resmx) ... + allseeds(cnt,:) = [(1+resmx)/2 - sin(angs(q)) * (eccs(p)*resmx) ... + (1+resmx)/2 + cos(angs(q)) * (eccs(p)*resmx) ... ssindices(s)*sqrt(expts(r)) 1 expts(r)]; cnt = cnt + 1; end