← Other topics

PsychoPy - Builder View (lexical decision task) (#4)

Series contents:

Video Notes

Summary

In Part 4 of this series on building experiments with PsychoPy, we will build a lexical decision task using the Builder View. This will be the same experiment we created in Part 2 and Part 3 of this series using just code, allowing you to compare/contrast the process of creating experiments in code vs using the Builder.

The following is a summary of the steps completed in the video.

Setup

Create a folder on your computer named ldt-builder.

Within this folder, create a text file called conditions.csv with the following data:

characters,isWord,answer
cat,1,right
bar,1,right
tea,1,right
ghs,0,left
jul,0,left
pok,0,left

Create a new experiment in the PsychoPy Builder view. Save the experiment as ldt.psyexp within your ldt-builder folder.

Folder and file set up for the lexical decision task experiment

Experiment properties

In the experiment properties (accessed via the gear icon) under Basic:

  • Set Experiment name to Lexical Decision Task
  • Update Experiment info to just collect participant id (removing session id); set the default for participant to be blank
Basic experiment settings

In the experiment properties under Screen:

  • Set the Background color to black

To find out information about a setting, try hovering over the input for a second. Many settings have info boxes that will appear. Additionally, clicking the Help button on the bottom left will take you to the relevant PsychoPy documentation pages.

Learning more about properties

Welcome routine

Right click the default routine called trial and choose rename; rename it to welcomeRoutine.

From Components > Favorites click the Text component to add it to the welcome routine.

  • For the text properties, set Name to instructionText.
  • Update Stop duration to be blank.
  • Update Text to the following:
Welcome to the lexical decision task.

You are about to see a series of characters. 

If the characters make up a word, 
press the RIGHT arrow key.

If the characters do not make up a word, 
press the LEFT arrow key.

Press SPACE to begin.

Next, from Components > Favorites click the Keyboard component to add it to the welcome routine.

  • Update Name to startKeyboard.
  • Update Allowed keys to 'space'

After completing the above steps, this is what your experiment should look like:

Condition routine

In the Flow pane, click Insert Routine and choose (new)

  • Name the routine conditionRoutine.
  • After clicking OK it will allow you to click a position on the Flow timeline where you want to insert this new routine; click after welcomeRoutine to place it there.

After completing the above step, your Flow should look like this:

With the conditionRoutine open in the Routines pane, add a new Text component:

  • Set Name to charactersText.
  • Update Stop duration so it’s blank.
  • Set Text to $characters and update the dropdown on the right to set every repeat.

Next, add a new Keyboard component.

Under Basic:

  • Set Name to responseKeyboard
  • Update Allowed keys to 'left', 'right'

Under Data:

  • Check Store correct
  • Set Correct answer to $answer
  • Uncheck Discard previous

Loop trial routine

In the Flow pane click Insert Loop.

Click to the left of conditionRoutine to indicate the start of the loop then click to the right of conditionRoutine to indicate the end of the loop.

For the Loop Properties...

  • Set Name to conditionLoop
  • Check Is trials
  • Set Num. repeats to 1.
  • Set Conditions to point to the conditions.csv file created above.

The end result should look like this:

Exit routine

Insert a new routine for the exit screen; name it exitRoutine. Place it after the conditionRoutine.

Within the exitRoutine, add a new Text component with the following settings:

  • Set Name to thankYouText
  • Set Stop duration to blank.
  • Set Text to:
Thank you for participating.

Press SPACE to exit.

Also within the exit routine, add a new Keyboard component...

  • Name it exitKeyboard.
  • Set Allowed keys to 'space'.

Run the experiment

To test your experiment, click the play button.

Resulting data

After running the experiment, output files will be generated in a data folder within your ldt-builder project directory.

Within the .csv files in the data folder you can see the resulting data collected from your experiment. Here you can see info about what conditions the participant was shown, what their responses were, and whether or not their response was correct. Example:

PsychoPy .csv experiment results

Read more about data outputs here...

If this info helped you out you can say thanks and support future content by clicking my Amazon affiliate link: https://amzn.to/3UtgnYk. If you make a purchase on Amazon within 24 hours of clicking the link I may receive a micro-commission and it costs you nothing extra. Any income from these sales goes directly to supporting me in making new videos and guides. Thank you for your support!

← Other topics