Closed elinekupers closed 3 years ago
Hi Eline! I have not very much time right now, but I was trying to remember what happened here.
1./ At first, this function should be the same to vistasoft's rfGaussian2d : if you use this function for reconstruction, you should not expect differences because there is no normalization going on. 2./ In our case, we did a normalization so that the area of the gaussian when there is full coverage of the RF by the stimulus equals to one (the first step, before convolving with the hrf). Jon is in copy because it was his idea, just in case he wants to add more info here. We used this function for creating the synthetic time series, and to be able to control the magnitudes, I don't think you want this for your reconstruction? 3./ I need to check more carefully to know if what you are describing here is problematic or not for the simulation code, I guess not, but I will look into it just in case. I remember that it was somehow problematic because a gaussian is infinite, and I think we truncated the gaussian at 5 SDs, which basically covers most of the values...
I hope this is helpful for now! Gari
On Mon, Aug 16, 2021 at 10:47 PM Eline R. Kupers @.***> wrote:
Hi! I am reconstructing my RFs with pmGaussian2d.m and noticed that the RF volume is relatively close to 1 when centered on 0 and sigma < 6 deg. But for pRFs not centered at 0 or that are relatively large, the area does not sum up to 1.
I ran an example below for [x0,y0] = [7.8, 3.9] (the "off-center" Gaussian) and [x0,y0]=[0,0] (the "center" Gaussian), and found that with my sampling grid (101 by 101, ranging from -12 to 12 deg):
1.
I only get a volume of 1 for the off-center Gaussian when sigma = 1 deg. For the centered Gaussian, a sigma of 1-6 deg results in a volume of
- But for larger sigmas, the volume is smaller than 1. Especially for the offset Gaussian.
When we divide the RF by 2pi*sigma^2, we assume a continuous function. But in my case (and presumably other cases), this assumption does not hold, and therefore the normalization does not result in a volume of one.
The only way I can get a volume of 1 for different RF sizes is when I divide by the sum(RF(:)).
I wonder if we are better off when dividing the RF by its volume (as in RF3) to get a volume of 1.
Any thoughts?
sigmas = [1:11]; % deg x0 = 7.8; % deg y0 = 4.9; % deg x = -12:0.24:12; % deg y = x;
[X,Y] = meshgrid(x,y);
for s = 1:length(sigmas)
sigmaMajor = sigmas(s); % deg sigmaMinor = sigmaMajor; RF1 = pmGaussian2d(X,Y, sigmaMajor, sigmaMinor, [], x0, y0); sRF1(s) = sum(RF1(:)); % or do a simple version ourselves: X = X - x0; Y = Y - y0; RF_tmp = exp(-0.5*((Y./sigmaMajor).^2 + (X./sigmaMinor).^2)); % Either with normalization assuming continuous sampling RF2 = RF_tmp ./ (sigmaMajor .* 2 .* pi .* sigmaMinor); sRF2(s) = sum(RF2(:)); % Or with normalization assuming discrete sampling RF3 = RF_tmp ./ sum(RF_tmp(:)); sRF3(s) = sum(RF3(:));
end
figure; hold on; plot(sigmas, sRF1, 'ro-', 'lineWidth',2); plot(sigmas, sRF2, 'bo-', 'lineWidth',2); plot(sigmas, sRF3, 'go-', 'lineWidth',2); legend('RF1 - pmGaussian2d','RF2 - norm continous','RF3 - norm discrete'); xlabel('pRF sigma (deg)') ylabel('pRF volume (deg2)') title(sprintf('PRF at [x0,y0]=[%1.1f,%1.1f]',x0,y0))
[image: image] https://user-images.githubusercontent.com/6117079/129627266-d761e2cd-58e2-448a-a2d7-29e8f6e19c6d.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vistalab/PRFmodel/issues/61, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCZAV6UZXG5I6HEEQX3HLDT5F2MZANCNFSM5CIPDFPA .
Hi Gari! Thanks for your quick response! That is helpful.
Re 1 and 2): Right, I was wondering if it’s ok to solve pRFs with vistasoft’s rfGaussian2d and then reconstruct time series with pmGaussian2d. In my case, it will be to predict responses to a different stimulus where magnitude differences are meaningful. So maybe it would be better for me to stick to the same function? Do you know if there is an easy way to convert a predicted response using a unit volume pRF (i.e., your pmGaussian2d) to a prediction using unit height pRF (vistasoft’s rfGaussian2d)?
Re 3) if your simulated pRFs are not on the edge you are probably covered, but I wonder if it matters for those on the edge of the fov..
1 and 2) sorry! not at the moment, but if you are comparing resolved fits you will need to consider the gain factor then right? rfGaussian2d does not normalize to anything right?
3) if I remember correctly and if there are no bugs, the edges where covered as well right? I mean, if the center of the RF is exactly in the border, the result instead of 1 will be .5 no?
On Wed, Aug 18, 2021 at 9:55 PM Eline R. Kupers @.***> wrote:
Hi Gari! Thanks for your quick response! That is helpful.
Re 1 and 2): Right, I was wondering if it’s ok to solve pRFs with vistasoft’s rfGaussian2d and then reconstruct time series with pmGaussian2d. In my case, it will be to predict responses to a different stimulus where magnitude differences are meaningful. So maybe it would be better for me to stick to the same function? Do you know if there is an easy way to convert a predicted response using a unit volume pRF (i.e., your pmGaussian2d) to a prediction using unit height pRF (vistasoft’s rfGaussian2d)?
Re 3) if your simulated pRFs are not on the edge you are probably covered, but I wonder if it matters for those on the edge of the fov..
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vistalab/PRFmodel/issues/61#issuecomment-901388696, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCZAV4YVRMA24JWS3L4VG3T5QF4PANCNFSM5CIPDFPA .
1 and 2) I see. Yes, that's right when you want to reconstruct the predicted pRF responses. But in my case, I want to predict it to new stimuli then I think I don't need this scale factor, because the predictions will be scaled when fitting to new data.
3) Yes, I think you're right. I had the wrong assumption that it needed to sum to 1 as well, but if only half the pRF covers the field of view, then full stimulation should result in a predicted response of 0.5.
I will close this issue for now but feel free to reopen it!
Hi! I am reconstructing my RFs with pmGaussian2d.m and noticed that the RF volume is relatively close to 1 when centered on 0 and sigma < 6 deg. But for pRFs not centered at 0 or that are relatively large, the area does not sum up to 1.
I ran an example below for [x0,y0] = [7.8, 3.9] (the "off-center" Gaussian) and [x0,y0]=[0,0] (the "center" Gaussian), and found that with my sampling grid (101 by 101, ranging from -12 to 12 deg):
1) I only get a volume of 1 for the off-center Gaussian when sigma = 1 deg. For the centered Gaussian, a sigma of 1-6 deg results in a volume of 1. But for larger sigmas, the volume is smaller than 1. Especially for the offset Gaussian.
2) When we divide the RF by 2pi*sigma^2, we assume a continuous function. But in my case (and presumably other cases), this assumption does not hold, and therefore the normalization does not result in a volume of one.
3) The only way I can get a volume of 1 for different RF sizes is when I divide by the sum(RF(:)).
I wonder if we are better off when dividing the RF by its volume (as in RF3) to get a volume of 1.
Any thoughts?