Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pRF fit for 1d Gaussian for 4 digits #8

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions mrLoadRet/Plugin/pRF_somato/pRF_somatoFit.m
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
% compute all the model response, using parfor loop
% parfor i = 1:fitParams.prefit.n

parfor i = 1:fitParams.prefit.n
parfor i = 1:fitParams.prefit.n %parfor
% fit the model with these parameters
%[residual modelResponse rfModel] = getModelResidual([fitParams.prefit.x(i) fitParams.prefit.y(i) fitParams.prefit.rfHalfWidth(i) fitParams.prefit.hrfDelay(i) params(4:end)],tSeries,fitParams,1);
%[residual modelResponse rfModel] = getModelResidual([fitParams.prefit.x(i) fitParams.prefit.y(i) fitParams.prefit.rfHalfWidth(i) params(4:end)],tSeries,fitParams,1, crossValcheck);
Expand Down Expand Up @@ -421,7 +421,7 @@
case {'gaussian-1D-transpose'} % BETWEEN DIGIT MODEL


if size(fitParams.stimX,2) == 5 % for TW Touchmap
if size(fitParams.stimX,2) == 5 || size(fitParams.stimX,2) == 4 % for TW Touchmap
[~,index] = max(rfModel);
else
[~,index] = max(max(rfModel,[],2),[], 1); % max digit amp of Gaussian
Expand All @@ -433,7 +433,7 @@

thisX = linspace(1,size(rfModel,2),100);

if size(fitParams.stimX,2) == 5
if size(fitParams.stimX,2) == 5 || size(fitParams.stimX,2) == 4
Pone = [fit.amp1 fit.meanOne fit.stdOne 0];
thisStd = fit.stdOne;
else
Expand Down Expand Up @@ -470,7 +470,7 @@
% ignore this for base/tips pRF fitting

% this is trickier, because we need to rewrap the PD values onto a 1-4 grid
if size(fitParams.stimX,2) == 5
if size(fitParams.stimX,2) == 5 || size(fitParams.stimX,2) == 4
fit.prefPD = fit.prefPD;
else
fit.prefPD = abs(fit.prefPD - (size(rfModel,2)+1) );
Expand Down Expand Up @@ -795,7 +795,7 @@
fitParams.initParams = [fitParams.initParams fitParams.amplitudeRatio fitParams.timelag2 fitParams.tau2];
end

elseif size(fitParams.stimX,2) == 5 % pRF on patients TW
elseif size(fitParams.stimX,2) == 5 || size(fitParams.stimX,2) == 4% pRF on patients TW

% fitParams.paramNames = {'mean1', 'mean2', 'mean3', 'mean4', 'mean5',...
% 'sd1', 'sd2', 'sd3','sd4', 'sd5',...
Expand Down Expand Up @@ -1525,7 +1525,7 @@ function dispModelFit(params,fitParams,modelResponse,tSeries,rfModel)
p.canonical.offset2 = 0;
end

elseif size(fitParams.stimX,2) == 5
elseif size(fitParams.stimX,2) == 5 || size(fitParams.stimX,2) == 4
% p.meanOne = params(1);
% p.meanTwo = params(2);
% p.meanThr = params(3);
Expand Down Expand Up @@ -1815,7 +1815,7 @@ function dispModelFit(params,fitParams,modelResponse,tSeries,rfModel)

rfModel = [];

% now gernerate the rfModel
% now generate the rfModel
switch fitParams.rfType
case {'gaussian','gaussian-hdr','gaussian-hdr-double','gaussian-1D','gaussian-1D-transpose','gaussian-surround', 'gaussian-1D-orthotips'}
rfModel = makeRFGaussian(params,fitParams);
Expand Down Expand Up @@ -1901,7 +1901,7 @@ function dispModelFit(params,fitParams,modelResponse,tSeries,rfModel)
% direction!


elseif size(fitParams.stimX,2) == 5
elseif size(fitParams.stimX,2) == 5 || size(fitParams.stimX,2) == 4
% X = linspace(1,5,5);
% params.amp1 = 1;
% pone = [params.amp1 params.meanOne params.stdOne 0];
Expand All @@ -1917,7 +1917,7 @@ function dispModelFit(params,fitParams,modelResponse,tSeries,rfModel)
% else
% rfModel = Z;
% end
X = linspace(1,5,5);
X = linspace(1,size(fitParams.stimX,2),size(fitParams.stimX,2));
%params.amp1 = 1;
pone = [params.amp1 params.meanOne params.stdOne 0];
%ptwo = [params.amp2 params.meanTwo params.stdTwo 0];
Expand Down