psychopy.org | Reference | Downloads | Github

Change Blindness

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2020.1.3.
Standard Standalone? (y/n) Y
What are you trying to achieve?:

I try to setup a change blindess experiment.

What did you try to make it work?:
I followed the solution offered here. So, I have a loop that loops through the various trials (alltrials) and a loop (singletrial) that presents the stimuli in a trial.

In the code component I set up a timer at Begin Experiment

tStart = False

then in Begin Routine I start the timer

if tStart == False:
    timer = core.Clock()
    tStart = True

and in Each Frame I check whether a key was pressed to break the loop.

if len(keyResp.keys) > 0:
    singlereps.addData('RT', timer.getTime())
    singlereps.finished = True
    tStart = False 

What specifically went wrong when you tried that?:

Well, each trial only runs once, that is the sequence BildA, Maske, BildB, MaskeB is shown only once. After a keypress the programm proceeds to the next picture pair, which again is shown only once aso.When I deleted the key-component from the routine, pictures are shown as expected.

Well, I need a response. So, how do I use the key-component to end a trial in a change blindness experiment? I am out of options.

Cheers Jens

What is your nReps for singlereps?

Hello,

at the moment for testing purposes 10. Later in the real experiment it will be more.

Best wishes Jens

If I understand correctly, what you want to happen when a participant hits a key is that the routine ends, right? At the moment, if I’m not mistaken, you are instead ending the loop singlereps as soon as a participant has pressed a key. You probably want:

if len(keyResp.keys) > 0:
    singlereps.addData('RT', timer.getTime())
    continueRoutine = False
    tStart = False 

For this method of presenting change blindness there is a tight loop which continuously presents a routine containing image 1, blank, image 2, blank until the participant responds. I use an alternate method which updates a single image component:

if stage == 1:
    image.setImage(Original, log=False)
    if trial_clock.getTime()*1000 > waxon:
        stage=2
        trial_clock=core.Clock()
elif stage == 2:
    image.setImage(Flicker, log=False)
    if trial_clock.getTime()*1000 > waxoff:
        stage=3
        trial_clock=core.Clock()
elif stage == 3:
    image.setImage(Changed, log=False)
    if trial_clock.getTime()*1000 > waxon:
        stage=4
        trial_clock=core.Clock()
else:
    image.setImage(Flicker, log=False)
    if trial_clock.getTime()*1000 > waxoff:
        stage=1
        trial_clock=core.Clock()

change blindness.psyexp (17.7 KB)

Best wishes,

Wakefield

If I understand correctly, what you want to happen when a participant hits a key is that the routine ends, right?

No, the problem at the moment. The problem is that nobody hits a key and the loop singletrial is executed only once.

Cheers Jens

Ah, sorry, I’d misunderstood (thanks for the clarification @wakecarter - I took for granted that the method you describe would be used, I did a similar thing when I implemented a change blindness task some time ago). Could you post a screenshot of your keyResp settings? Since you mentioned that “When I deleted the key-component from the routine, pictures are shown as expected.”, there ought to be something about the keyResp. Did you perhaps set its duration to “blank”, meaning the routine will continue until a key is pressed?

I think that the problem is that keyResp.keys is undefined (or None) which has a length.

Try if len(keyResp):

Also, try moving the code component below the keyboard component.

Hello,

ok. there is actually no duration specified.

What is the proper duration in a change blindness experiment for one repetition? The sum of all stimulis’ durations?

Cheers Jens

I moved the code component below the keyboard-component and changed the code as suggested.

Try if len(keyResp):

That did not work. It throws an error message

if len(KeyResp) > 0:
TypeError: object of type 'Keyboard' has no len()

Do you mind sending my the condition file as well?

@Arboc When I use a duration, it works a expected.

Cheers Jens

If you don’t want there to be any pauses between each routine then yes, you must set the duration of ‘keyResp’ to be the same as the sum of your stimuli’s durations. Note that this means the participant won’t be able to respond after the last round of showing the stimuli. This setup might also make the experiment data a bit harder to navigate, I would guess. If you’re able to do it without too much hassle it might be worth it in the long run to switch to a setup more like what @wakecarter suggested (one routine/trial, but with stimuli being updated). Apart from being a bit more heavy on the code, I think it mostly has upsides compared to the less intuitive method of using a loop. But this might just be me being narrow-minded.

I would start the keyboard response at the start and then give it a duration of the sum.

Here’s my conditions file.change blindness.xlsx (11.3 KB)

This experiment hasn’t been touched since October 2017 so there may be a few things I’d do differently now. However, it also wasn’t my first version.

Thanks for the excel file.

Hello,

your solution runs with my stimuli: I just need to clarify two points. I assume that the numbers given under waxon and waxoff are milliseconds? What does getTime() return in terms of units?

trial_clock.getTime()*1000

In order for the if-construction to be true trial_clock.getTime() must be 0.5. Can getTime() also return .45 or even 0.452 (regardless of whether such numbers make sense in this context)?

Cheers Jens

getTiime() returns a value in seconds (to several decimal places). I’m using > rather than = in the code so that the first refresh where the time exceeds the specified duration initiates the next stage.