PsiHandler - the Psi staircase of Kontsevich & Tyler (1999) QuestPlusHandler - for the updated QUEST+ algorithm (Watson, 2017) QuestHandler - for traditional QUEST algorithm StairHandler - for basic up-down (fixed step) staircases TrialHandlerExt - similar to TrialHandler but with ability to run oddball designs #SHUFFLE PSYCHOPY UPDATE#TrialHandler2 - similar to TrialHandler but with ability to update mid-run TrialHandler - basic predefined trial matrix Trial = response # first answer, second element is rt.Psychopy.data - functions for storing/saving/analysing data ¶ĮxperimentHandler - to combine multiple loops in one study Response = event.waitKeys(keyList =, timeStamped=True) Let's record reaction times in the trial, just for fun. And then loop over trials: for trial in trialList:ĭistractorstim.image = trial Try printing the trial list ( print trialList) to see what it looks like. So rather than the two map lines, do: trialList = #SHUFFLE PSYCHOPY FULL#It's still much faster than generating a full Window/ImageStim each loop though.Īnother way to randomize the images while maintaining the pairing is something you'd probably do anyway sometime: put them together in a list of dictionaries, where each dict represents a trial. Probably between 20 and 500 ms depending mainly on image dimensions. Rather than just showing two stimuli, I've set it to loop over all stimuli. Set autodraw here since you didn't seem to change it during runtime. Targetstim = visual.ImageStim(win=win, pos=pos2, size=)ĭistractorstim = visual.ImageStim(win=win, pos=pos1, size=) # removed all default values and initiated without an image. Win = visual.Window(size=(1280, 800), fullscr=True, screen=0, monitor='testMonitor', color=) # removed a default value Think of them as containers in which you can update the content on the fly. Target = map(target._getitem_, indices)ĭistractor = map(distractor._getitem_, indices) Indices = random.sample(range(len(target)), len(target)) # because you're using python 2 Target = glob.glob("DDtest/targetimagelist1/*")ĭistractor = glob.glob("DDtest/distractorimagelist1/*") # import two images sequences and randomize in the same order This section was simplified.įrom psychopy import visual, event, gui # gui is not used in this script #SHUFFLE PSYCHOPY CODE#Note that I've changed quite a bit to make the code much shorter, cleaner and faster. I particularly like the following for its syntactic simplicity randomizedItems = map(items._getitem_, indices)įor a complete working example, see code below. This question has been answered here and here. However, I would like it is shuffle the images in the same order so that both lists are displayed in the same random order. This code randomly shuffles a bunch of images and displays them. TexRes=128, interpolate=True, depth=-2.0) TexRes=128, interpolate=True, depth=-1.0) Win = visual.Window(size=(1280, 800), fullscr=True, screen=0, monitor='testMonitor', color=, colorSpace='rgb')ĭistractorstim = visual.ImageStim(win=win,Ĭolor=, colorSpace='rgb', opacity=1, I have a question about shuffling, but first, here is my code: from psychopy import visual, event, guiĪ = glob.glob("DDtest/targetimagelist1/*")ī = glob.glob("DDtest/distractorimagelist1/*")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |