Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Change Blindness Experiment with flicker paradigm

edited November 2013 in OpenSesame

I am doing a change blindness study and have been trying to set it up with opensesame. I want to use around 30 images. I am doing the flicker paradigm, so I need it to present 2 images with a gray screen in between for 60 seconds or until the participant responds when they detect the change. It must stop between each trial to record their answer and description possibly on a paper. I have started to set it up roughly following the tutorial to put together the general stuff. How do I set up the trial sequence to make it switch between the 2 images for 60 seconds? Is a special script or code needed? I'm not sure how this would be set up if it's repeat cycle or if each trial needs to be separate. I also want there to be one practice trial before the experimental trials. Any help would really be appreciated.

Comments

  • edited 11:28PM

    How do I set up the trial sequence to make it switch between the 2 images for 60 seconds?

    A flicker paradigm is probably best implemented with an inline_script, because it's fairly dynamic. Below you see an example that you can modify to fit your particular experiment. The basic idea is that you present one canvas, then poll the keyboard for the duration of one frame. If a key is pressed, you stop, otherwise you present the next canvas, and so on.

    from openexp.canvas import canvas
    from openexp.keyboard import keyboard
    
    # The duration for each frame
    frame_dur = 250
    # The number of repetitions
    repetitions = 10
    # Get the filenames for the two images. This assumes that you have defined these
    # filenames as the variables `img1` and `img2` and that these files are in the
    # filepool.
    img1 = self.get('img1')
    img2 = self.get('img2')
    
    # Create a keyboard with a timeout that is equal to the frameduration
    my_keyboard = keyboard(exp, timeout=frame_dur)
    
    # Create three canvas objects, for both images and a gray one to get the
    # flicker effect.
    my_canvas1 = canvas(exp)
    my_canvas1.image(exp.get_file(img1))
    my_canvas2 = canvas(exp)
    my_canvas2.image(exp.get_file(img2))
    my_canvas_gray = canvas(exp, bgcolor='gray')
    
    # Loop through all repetitions
    start_time = self.time()
    for i in range(repetitions):
    
        # Show the first canvas
        my_canvas1.show()
        # Wait for a key press or timeout
        resp, time = my_keyboard.get_key()
        # If a key was pressed, break the loop
        if resp != None:
            break
    
        my_canvas_gray.show()
        resp, time = my_keyboard.get_key()
        if resp != None:
            break
    
        my_canvas2.show()
        resp, time = my_keyboard.get_key()
        if resp != None:
            break
    
        my_canvas_gray.show()
        resp, time = my_keyboard.get_key()
        if resp != None:
            break
    
    # Set the response variables so that they can be logged, etc.
    exp.set('response_time', time-start_time)
    exp.set('response', resp)
    

    I hope this helps you get started!

    Cheers,
    Sebastiaan

  • edited November 2013

    I have set everything up. I got it to flicker with the images and disruptions, but it doesn't end the loop if I press a key (spacebar). My practice trial loop is Cycles 1 Repeat each cycle 43 times because each image will display for 500ms and each disruption will display for 200ms and that many times will make it 60 seconds of flickering/repeating. I have everything set to run always. Repeat_cycle is Run if [response] > 1400 and Repeat if [response] > 1400. I don't know what to change to make it end a loop once there is a response. I don't really know how to do an inline_script and I'm not sure what variables to add either. I have this all set up for the 1 practice loop and experimental loop where each of the 28 trials has it's own loop and it set up as is shown in this picture. I can't figure out what to do or if there is an easy fix to make this setup work. I've been playing around with everything in the practice trial and it will not work how I want it to. Let me know if you need more information.

    image

  • edited November 2013

    I would implement the flicker paradigm with the script I posted above. In principle, it is possible to use loops and sequences to do this, but it will end up being much more complicated.

    Basically the script is ready for use as is (although you can modify it), the only thing that it expects are two variables, img1 and img2 to be defined in your block loop, which in your case appears to be called Trial1 etc. These variables should be set to the names of image files in the file pool. Does that make sense?

    So the following loop table would correspond to three trials, where the images shown in the columns are presented in alternation:

    image

    I know that Python inline scripts can seem a little daunting at first, but it's really the easiest solution in this case. Just take some time to read and understand the script. For more information, see also:

    Cheers!
    Sebastiaan

  • edited 11:28PM

    Thank you so much. Your second comment explained it more clearly and helped me figure out where the inline scripts go. Everything works how I want it to now. I have an inline script for the practice trial and each of the 28 test trials. I have a logger after each script in every sequence to log response (or none) and response time. I have img1 and img2 as variables and the corresponding image set image set below. I also have response and response_time to record those for each trial. I have looked at the excel document and it collects what I want. I just need to do a few more things like switch out a few of the images for ones I like more, add text between the participants have to stop and say what changed and the press a button when they are ready to go on to the next trial, and possibly something else if I need to.

    I just have a few questions. How accurate will the response times be? It seems like it is and I set the frame duration and repetitions to go for 1 min, and that's when it stops.

    Can I do a different frame duration for the gray visual disruptions between the images? I would like to display those for less time than the images.
    How do I record the average response time for each participant?

    Should I use legacy? That seems to run better than xpyriment which took a long time to prepare the experiment.

    And I have everything in the prepare phase of the inline script. Is that good?
    Once again thank you very much for the help and the great program. An experiment like this is not easy to set up.

  • edited 11:28PM

    How accurate will the response times be?

    The response times will be very accurate (on a good system).

    Can I do a different frame duration for the gray visual disruptions between the images? I would like to display those for less time than the images.

    You can pass a timeout to get_key(), which will override the original timeout. For example:

    my_canvas_gray.show()
    resp, time = my_keyboard.get_key(timeout=100)
    if resp != None:
        break
    

    This will show my_canvas_gray for only 100 ms. As a small exercise, try to implement this nicely, using a variable to specify the presentation duration of my_canvas_gray!

    See also:

    How do I record the average response time for each participant?

    With a bit of script, see:

    Should I use legacy? That seems to run better than xpyriment which took a long time to prepare the experiment.

    Xpyriment offers slightly better temporal precision, but it won't make any practical difference. So I would just choose whatever feels best. See also:

    And I have everything in the prepare phase of the inline script. Is that good?

    No! Stuff like display presentation should be in the run phase. See also:

    Good luck!

Sign In or Register to comment.