Grating patch online

I’m aware grating patches are not implemented online yet. I’m so aware that because screen calibration is not possible the sinosoids wouldn’t actually be sinusoids. That being said, I want to implement Gabor patches and I’m ok with the sinusoid problem.

I found some JS code to generate Gabor patches here: https://github.com/jtth/gaborgen-js/blob/gh-pages/gab.js

but I’m not sure how to get from the calculation to actually displaying the patch. Any guidance or tip would be mych appreciated.

Use the live demo linked in their repo? https://github.com/jtth/gaborgen-js

Sorry, I didn’t read your post carefully enough. You’d like to integrate this library in PsychoJS, so you can draw these patches parametrically right?

The live demo shows how to draw them in a web page. The challenge is getting that output into an ImageStim. In the PsychoJS code, I see that the setImage function of an ImageStim can accept HTMLElements.

https://psychopy.github.io/psychojs/visual_ImageStim.js.html#line78

My guess is that if you manage to convert the output of the Gabor generator to an HTMLElement, and use that to set an ImageStim, you’re there