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

How to record mouse clicks in excel with reaction time in psychopy or just python itself

sagarcogsagarcog Posts: 3
edited March 2016 in Miscellaneous

I am writing a program to provide visual stimuli which are basically two tone mooney photos.

The location of the images are coming from a csv sheet, and being displayed one by one on the screen.

The images are divided in the category of face or object.

I want the user to left click if he thinks what he sees is a face and right click on a mouse if he thinks it is an object.

The left click should be recorded in an excel/csv sheet as a 'face' entry & 'right' click as an object entry. All individual participants data, should be saved in different tabs in the excel sheet.
Along with that, the response time when the click was done as soon as myWin.flip() was called, should be recorded in another column in milliseconds.

Please suggest.

Relevant code is below:

csv input for images

trials = data.TrialHandler(
trialList=data.importConditions('stimsv1.csv'),
nReps=1,
method= 'sequential')

if aTrial['type'] == 'face':

    try:

        windll.inpout32.Out32(0x0000D100, 1)
        myWin.flip()
        core.wait(0.01)
        windll.inpout32.Out32(0x0000D100, 0)

    except:
        print 'trigger issue found '


elif aTrial['type'] == 'object':

    try:

        windll.inpout32.Out32(0x0000D100, 2)

        myWin.flip()
        core.wait(0.01)
        windll.inpout32.Out32(0x0000D100, 0)

    except:
        print 'trigger issue found '
else:
    continue

Comments

  • JoshJosh Posts: 360
    edited 7:27PM

    Hi,

    Your plan is clear. Are you stuck at a specific point, or do you want us to tell you exactly how to do everything?

    In case of the latter, it may be best for you to do an OpenSesame tutorial first; see http://osdoc.cogsci.nl/tutorials/step-by-step-tutorial/

    Cheers

    Josh

  • sagarcogsagarcog Posts: 3
    edited March 2016

    Hi,

    I am only interested in knowing specifically, how to capture whether a left(defined as yes) or a right(defined as no) mouse clicks while the stimuli are shown, in an excel/csv sheet along with the difference in time from the myWin.flip() in milliseconds.

    Can you mention the code I need to write to capture these mouse clicks along with the time(ms). I want the code part & not using the GUI.

  • eduardeduard Posts: 875
    edited 7:27PM

    Hi,

    All information you need or on the documentation of the mouse object. Basically, you wait for a click of the left and the right mouse button separately, but in rapid succession (e.g. in a while loop with a timeout of 10 ms each). Use the keylist argument to sample only right, or left clicks. Once a response was given, check whether it was left or right, and based on that info you can assign proper values to your object/face/response time variables.

    Does this make sense?

    Good luck,

    Eduard

  • puniu1accpuniu1acc Posts: 1
    edited February 21

    The left click should be recorded in an excel/csv sheet as a 'face' entry & 'right' click as an object entry. All individual participants data, should be saved in different tabs in the excel sheet.

    Along with that, the response time when the click was done as soon as myWin.flip() was called, should be recorded in another column in milliseconds.

    sagarcog, did you get it fixed?

Sign In or Register to comment.