Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

mouse response is not logging

OsmoseOsmose Posts: 19

Hi,

I made a script in which a canvas and sound are presented. Participants must click with the mouse on images that represent the sound played.

But in the logger file i can't find the coordinates of the mouse when clicked, neither the response time.
I initialize the mouse with that code :

from openexp.mouse import mouse
my_mouse = mouse(exp)
resp, position, time = my_mouse.get_click(timeout=5000)

Did I forgot something to track the response time and the coordinate of the click ?

Thanks

Comments

  • JarikJarik Posts: 189

    Hi Osmose,

    When you save variables in the var object they are saved in your output by the logger item. So var.resp etc. should work (assuming you have a logger item somewhere after that in your sequence).

    Best,
    Jarik

  • OsmoseOsmose Posts: 19

    Hi,

    thanks for the answer, but i'm not sure I get it. I do have a logger item after in the sequence after my script, but the mouse click position (in x and y) and the response time is not in the var object as I didn't defined it in a loop. I thought that when I create a mouse in the script, all the variables that could be linked to it (click, response time etc) would be saved in the logger. In fact, there are variables called cursor_x and cursor_y but it is written " NA " in it instead of a value.

    So my question is how to fix that ?

    Thanks

  • JarikJarik Posts: 189

    Hi,

    So instead of:
    resp, position, time = my_mouse.get_click(timeout=5000)
    You want to use:
    var.resp, var.position, var.time = my_mouse.get_click(timeout=5000)

    there are variables called cursor_x and cursor_y but it is written " NA " in it instead of a value

    These variables are coming from some other part of your experiment.

    Best,
    Jarik

  • OsmoseOsmose Posts: 19

    Hi Jarik,

    thanks for you answer. I tried it but it still doesnt work, I'm afraid I don't understand the use of the " var.something " I guess i didnt explain well my problem, i give it another try.

    when I used this line : resp, position, time = my_mouse.get_click(timeout=5000)

    it gave me the position of a mouse click but not the time since the sampler has began with the first click(which I want), but the time since the software is open.

    Just to give you a real overview of the architecture I need :

    1) Images are displayed by on a canvas
    2) a click on the center of the canvas should :
    a) Start the sampler
    b)Start the count for the mouse response, waiting for a second click to stop it.
    3)an answer by a mouse click that :
    a) stop (and reset ?) the count. From this click, I need the position of the click and the mouse time response (i.e the time between the first and second click)
    b) stop the sampler

    And finaly, it should continues to other trials.

    If you have any idea, please tell me :smiley:

    Otherwise, I will try it with a mouse response item, and will stop the sampler myself with the BARSPACE while the participants run the experience.

    Thanks,

    Robin

  • JarikJarik Posts: 189

    Hi Robin,

    it gave me the position of a mouse click but not the time since the sampler has began with the first click(which I want), but the time since the software is open.

    OK I understand. All items including the sampler item have a time variable which holds their onset. So assuming your sampler item is named "new_sampler" means var.time_new_sampler holds the onset time (i.e. the sound start time).

    So after:
    var.resp, var.position, var.time = my_mouse.get_click(timeout=5000)
    You could do:
    var.CalculatedSoundRT = var.time - var.time_new_sampler

    Does this help?

    Jarik

  • OsmoseOsmose Posts: 19

    Hi Jarik,

    thanks again for your answer. It still doesnt work.. I got a message error : "The variable 'time_my_sampler' does not exist ".

    As I said I'm a beginner in python and opensesame, so I don't get all the subtilities, my bad.

    I'm actually doing my exp as I said above (with spacebar and a touch response), hope this gonna be ok.

    Thanks a lot for your time and answers Jarik :smiley:

  • eduardeduard Posts: 764

    Hi,

    Osmose:

    I got a message error : "The variable 'time_my_sampler' does not exist ".

    Jarik:

    var.CalculatedSoundRT = var.time - var.time_new_sampler

    Spot the difference...

    Eduard

Sign In or Register to comment.