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

regarding parameterization/problem with instructions for psychophysicists page #5

Open
rtraghavan opened this issue Jan 15, 2018 · 8 comments
Labels

Comments

@rtraghavan
Copy link

I'm having trouble figuring out how to parameterize the stimuli, even after reading the instructions for psychophysicists

Here is my monitor information:
Monitor refresh rate = 120 Hz
Monitor resolution = 1280x960
Screen size = 40 cm
Viewing distance = 57 cm
Pixels per degree = 33.1 (let's say this is in a variable called pixels_per_degree)

Let's assume I specify clouds like in instructions for psychophysicists
fx, fy, ft = mc.get_grids(mc.N_X, mc.N_Y, mc.N_frame)
mc.envelope_gabor(fx, fy, ft, name_, B_sf=Bsf, sf_0=sf_0, theta=theta, B_V=B_V, B_theta = B_theta, alpha=alpha)

I want to create a simple cloud with the following parameters:

  1. 256x256 pixels in size over 120 frames
  2. the cloud should contain all orientations
  3. spatial frequency of 1 cycle/degree (let's say this is in a variable called spatial_frequency_cpd)
  4. speed = 5 degrees/s (let's say this is in a variable called speed_degrees_per_second
  5. The Bandwidth should be an less than an octave for spatial frequency. Equally small for speed.

Here is what I think I should do, but I have some questions.

  1. The first is easy enough, that is N_X = 256, N_Y = 256, N_frame = 120
  2. This should be possible by just setting B_theta=np.inf I believe.
  3. Here I begin to get confused. How do I go from cycles/degree to whatever sf_0 is supposed to be specified as in mc.envelope_gabor? Is it simply spatial_frequency_cpd/pixels_per_degree? Or is there an additional transformation I am missing?
  4. I think the way to go from speed to V_X = speed_degrees_per_second/pixels_per_degree. Is that correct?
  5. In general, what are the units of bandwidth variables B_sf and B_V . Is it octaves? In the document it says cpd, but how can something centered at .1 cpd have a bandwidth more than .1 cpd in that case?

Finally, I would like to report a small error with the documentation on the instructions for psychophysicists page particularly under the section entitled "why should we use polar coordinates for frequencies." f_s was not defined.

Thank you.

@laurentperrinet
Copy link
Contributor

thanks for your note and sorry for the long delay :-/

  1. fine
  2. exact
  3. sf_0 is in cycle per pixel - knowing the width in visual angle of your stimulus you should find that easily, perhaps following the same route as in http://motionclouds.invibe.net/posts/orientation_protocol.html#summary-of-the-protocol
  4. correct
  5. correct, it is in the same unit as sf_0 - see the annex of http://www.motionclouds.invibe.net/files/MotionClouds_Supplementary.pdf for a derivation of B_sf from the value in octave

thanks!

@laurentperrinet
Copy link
Contributor

Do you need more information?

@ruyuanzhang
Copy link

Hi, laurent
It seems that I cannot access to the links below. Can you take a look?
http://motionclouds.invibe.net/posts/orientation_protocol.html#summary-of-the-protocol
http://www.motionclouds.invibe.net/files/MotionClouds_Supplementary.pdf

I am looking for more documentation of the mc.envelope_gabor function. I am confused by the log_gabor variable.
Can you explain it a little more?? Thanks

Best regards
Ru-Yuan

@laurentperrinet
Copy link
Contributor

Hi Ru-Yuan,
Thanks for reporting this. Indeed, the "invibe.net" website is now down and I now rely on github pages:

concerning your question, the log_gabor variable is a boolean which controls if the envelope is Normal (if set to False) or if it is log-Normal (if set to True). This was to control for these two alternatives, but in practice, we always use log_gabor=True as it better covers the range of frequencies (as show in this paper ).

Best regards,
Laurent

@ruyuanzhang
Copy link

Thanks so much Laurent. This is super helpful ! I still have some questions about the meanings of the parameters.

  1. You mentioned above that 'sf_0 is the cycles per pixel'. But in your python code, you explain it as "mean spatial frequency relative to the sampling frequency". Let's say I have a 100 x 100 pixels image and I want 5 cycles covering 100 pixels. Shall I set the sf_0 to 5/100 = 0.05 ?
  2. Also, for B_theta, B_sf, and B_V, can I set them to 0? If I set them to inf, shall I cover all orientation, all SF, and all possible speed?? If all bandwidths become 0, we should only use sf_0, theta, and V_X/V_Y. Then the stimulus should be the simplest case of drift grating (i.e., only one dot is 1 in the 3d Fourier envelope). But It seems not the case when I tried it...
  3. I am also confused by the ft_0 (spatiotemporal scaling factor), where can I find a description of ft_0??

Thanks again
Ru-Yuan

@laurentperrinet
Copy link
Contributor

laurentperrinet commented Jul 6, 2020

  1. yes, sf_0 is in cycle per pixel and your example should be right.

  2. One thing to be careful about is that the envelope is not too "small" (for instance when using low bandwidths) -> this will generate aliasing artifacts. When I created the library, I was not thinking about the possibility of low bandwidths, but it is actually nice to push parameters to the limit to make it converge to a classical stimulus such as a grating. In further developments, I have changed the code to allow this in some conditions (see here or here). it also works for orientation, but to avoid aliasing, use theta=0 and then rotate your stimulus, for instance with https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.rotate / I have seen quite some users first generate sets of motion stimulus with zero speed and a vertical orientation and then do the motion + tilting at presentation time

  3. ft_0 was mainly used to make a correspondence with previous work by P. R. Schrater, D. C. Knill, & E. P. Simoncelli, (2001) and we only kept it for "for backward compatibility". Still, you can regard it as a scaling factor between space and time if you want to generate a 1/f noise in space and time. however, in our experiments and then in theory, you can show that what matters for the color component is its spatial frequency envelope. if you really need it, I could develop on this point.

hope that helps
Laurent

@ruyuanzhang
Copy link

Hi, Laurent.
Thanks so much for your reply. Yeah, I looked the code, I can set the B_V and B_theta to 0, but not B_sf. I play it a little bit. I am still confused by some issues.

  1. the meaning of speed V_X and V_Y. Typically the speed is deg / sec. Since we do not know the visual degree of a pixel nor the duration per frame. I'd like to translate the speed to pixels/frame, or cycles/frame. In your documentation, you said "a speed of V_X=1 corresponds to an average displacement of 1/N_X per frame." I am confused about what does "displacement of 1/N_X per frame" mean?
  2. Also, you mentioned " first generate sets of motion stimulus with zero speed and a vertical orientation and then do the motion + tilting at presentation time". Did you mean we can first generate several static images and manually displace it for a few pixels to emulate motion when presenting the images?? Can you elaborate more?

Sorry I am not that familiar with the power spectrum of motion stimuli. Thanks !

Ru-Yuan

@laurentperrinet
Copy link
Contributor

Indeed, you can not set B_sf=0' in envelope_radial` but in practice, you can achieve very narrow bandwidths with small values. it is possible to do it in the code, do not hesitate to do a PR if you think this would be a useful addition to the library.

  1. to avoid problems with units, speed is defined in spatial period / temporal period, meaning that if you set V_X=1, the average speed will be of one spatial period (N_X pixels) in one temporal period (N_frame frames).

  2. as detailed in https://laurentperrinet.github.io/publication/vacher-16/ a full-field translation of a static image is equivalent to the warping of the spatio-temporal spectrum. By using this operation, it is very simple to generate any translation motion to any kind of movie (here, we are safe with regards to border effects as our textures are generated in the Fourier domain and are therefore always periodic)... so there are different alternatives: either you set V_X and V_Y (see https://neuralensemble.github.io/MotionClouds/posts/testing-speed.html ) or you set them to zero (still you have some motion, proportional to B_V but on average it is zero) and then you operate your translation.

hope this helps!
best regards,
Laurent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants