kurokida / jspsych-psychophysics

A jsPsych plugin for psychophysics
https://kurokida.github.io/jspsych-psychophysics/
MIT License
51 stars 13 forks source link

Wrong X,Y coordinates for gabor stimuli #29

Closed DeoMiche closed 2 years ago

DeoMiche commented 2 years ago

Hello and thank you for developing this amazing plugin. I am using a macbook with google chrome. I noticed a bug when trying to plot a gabor stimulus in the center of the screen. I haven't figured out why, but it seems that gabor stimuli cannot be plotted at the center of the screen using the usual parameters.

    const gabor1 = {
        obj_type: 'gabor',
        origin_center: true,
        tilt: 0,
        sf: 0,
        phase: 90,
        width: 300,
        sc: 20,
        contrast: 10,
        startX: 0,
        startY: 0,
    }

Instead this code results in the stimulus being plotted at the center of the top-right quadrant (it is as if the real coordinates were halved). I do not encounter this issue with other stimuli (e.g. circles). This is the only code that fixed it for me

const jsPsych = initJsPsych({
        on_finish: function() {
            jsPsych.data.displayData();
        }
    })

    var w = window.innerWidth;
    var h = window.innerHeight;
    const gabor1 = {
        obj_type: 'gabor',
        origin_center: true,
        tilt: 0,
        sf: 0,
        phase: 90,
        width: 300,
        sc: 20,
        contrast: 10,
        startX: w / 2,
        startY: h / 2,
    }

    const trial = {
        type: jsPsychPsychophysics,
        stimuli: [gabor1],
    }

    jsPsych.run([trial])

It would be nice if this could be fixed in order to work similarly to other type of stimuli (like circles) for which I do not encounter this issue. Thanks a lot !

kurokida commented 2 years ago

Thank you for your valuable comments. Could you download the latest code (v3.2.0), and confirm that the problem has been reolved?

DeoMiche commented 2 years ago

works like a charm, thanks a lot !