24 PsychoPy basics
In this lab, you will start to create our own experiments using PsychoPy, a piece of software developed by Jon Peirce here at the University of Nottingham. With PsychoPy, the most important thing will be that you try things out. Remember that you cannot break PsychoPy1, so nothing can go wrong!
24.1 Why learn PsychoPy?
We think learning how to use PsychoPy is important for four key reasons: The first reason is that we would of course like you to be able to create experiments. However, we would argue that using PsychoPy also teaches you other fundamental skills:
- Attention to detail: When creating experiments, small things matter. E.g., a period or space in the wrong location could stop an experiment from running or make data not interpretable. Practising this attention to detail is not only relevant for creating experiments, but also for any type of data analysis you will perform during your studies.
- Staying organised: Creating experiments in PsychoPy involves keeping track of multiple files (and likely multiple versions of the same file) and making sure you are using the correct ones when running your experiment. Learning how to keep things organised on your computer is an important transferable skill that is important for other more complex tasks (such as working on a lab report or a final-year project).
- Problem solving skills: No one is born a master and when you start using PsychoPy, things might not work right away. You will likely need to hone your problem solving skills to find solutions to the problems you encounter.
We would argue that the strategies you can use to solve PsychoPy problems are ones that can be helpful in many other contexts. These strategies include:
- Breaking complex tasks down into smaller steps.
- Manipulating only one thing at a time.
- Simplifying things (e.g., by creating a simpler version of the experiment that focuses only on what is not working).
- Using feedback (or, in the case of PsychoPy, error messages) for working out what is going wrong.
- Resilience. Persisting when things don’t work is really important. And it’s a great feeling if they eventually do!
The remaining sections in this chapter will describe five basic PsychoPy operations:
- Launching PsychoPy.
- Opening experiments.
- Running experiments.
- Quitting experiments.
- Saving experiments.
24.2 Launch PsychoPy
To launch PsychoPy, click on the PsychoPy icon:
Depending on your operating system and hardware, PsychoPy can take a while to launch (potentially up to a minute or so).
Once Psychopy has launched, make sure the Builder window is in the foreground:
Note that the next chapter will cover the Builder in more detail.
24.3 Open an experiment
We recommend the following way to open a PsychoPy experiment file:
- Open PsychoPy.
- Drag and drop the
.psyexp
file onto the Builder window.
There are other options (double-click or right-click), but in our experience drag and drop works best.
For the double-click to work under macOS, you first need to tell macOS that it should open .psyexp
files using PsychoPy. Here is how to do this (if you follow these steps exactly, you will need to do this only once):
- Right-click on the
.psyexp
file → Get Info → Open with → Choose… → PsychoPy. - You must then make sure to click on “Change all” and “OK” to confirm.
24.4 Run an experiment
The simplest way to run an experiment is to click on the “Run” icon:
The colour of the run icon depends on the setting for Pilot vs. Run:
If the toggle switch is set to “Pilot”, the run icon will be orange. When set to “Run”, it is green.
For now, the key difference between these options is that Pilot mode will not run an experiment in full screen. This can make it easier to quit the experiment when something goes wrong.
24.5 Quit an experiment
You can press the Escape
key at any time to quit a running experiment.
If you are running macOS and pressing Escape
has no effect, try Cmd + Alt + Escape
.
24.6 Save an experiment
To save a new or modified experiment, click on the “Save” icon or the “Save as” icon in the toolbar.
Alternatively, you can press Cmd + S
(macOS) or Ctrl + S
(Windows).
When working on experiments and running them, we would recommend to always save PsychoPy experiments locally (i.e., not on OneDrive). Once you’re finished with an experiment, make sure to save a copy on OneDrive though, so you have a back-up copy and can also access it from another computer if necessary.
If you are using one of the iMacs in the school, we would recommend to initially save your experiments in separate folders on the Desktop and to copy them to OneDrive at the end of the session. You can copy experiments to OneDrive by opening OneDrive in a browser window, navigating to the folder where you want to save the experiment, and dragging and dropping the experiment onto the browser window.
And even if you did: You could simply download and install it again!↩︎