PsychoPy as a library is very complete and much easier to use than Pyglet, Pygame and Kivy, while PsychoPy as an IDE is subtle with weak completion and debugging.
I used to edit scripts in Vim, but recently I've noticed that PsychoPy works very well with Jupyter.
So, this time I will explain how to use PsychoPy with Jupyter.
Before ..., let's first introduce how useful it is.
Of course it can be started.
Want to Hello World? ... then you can add it later.
Oops, I wanted to make black letters on a white background. Close the page with win.close () ... What was the color setting of visual.Window?
Remake and re-present.
... you can create experiments interactively like this.
Use ** Anaconda ** for later analysis. Click here to install.
There are 2 series and 3 series, but here we will include 3 series [^ 1]. The reason is as follows.
Also, I think it is good to install Miniconda instead of Anaconda. The reason is as follows.
However, be aware that if you use Miniconda, you will need to include the libraries (numpy, pandas, etc.) yourself.
After installing Anaconda, first make sure that Jupyter Notebook starts. Open a terminal (Anaconda Prompt for Win) and do the following:
jupyter notebook
If the browser starts up and localhost: 8888
is displayed automatically, it is successful.
Please do not delete the terminal or Anaconda Prompt opened here while using Jupyter Notebook. If you turn it off, the server will stop. On the contrary, if you do not use it anymore, you can close it.
Open Anaconda Prompt (Windows users should run as administrator) and do the following:
pip install psychopy
After installation, try the following from your notebook:
from psychopy import visual
win = visual.Window()
A window should open.
In case of Windows, NotImplementedError
may be displayed. In that case, open Anaconda Prompt again with administrator privileges and open it.
pip install pyglet==1.2
(I'm lowering the version because it doesn't work with version 1.3, which comes in by default).
If you try to drag and drop a screen created with fullscr = False, it may become unresponsive. There is no particular problem, and the stimulus is presented properly, so it is okay to proceed with the experiment creation as it is.
With% time or% timeit.
Please when the stimulus presentation is slow.
When set to% 2, the execution time of the entire block is measured.
If you want to use R with Jupyter Notebook,
https://irkernel.github.io/installation/
Let's put R referring to. Open R
install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()
If you execute ** paying attention to the following **, it will be automatically linked with Jupyter Notebook.
[Caution (Win)]
If ʻIRKernel :: installspec () `is moss, the following measures may be effective.
C: \ Program Files \ R \ R-X.X.X \ bin \ R.exe
etc.[Caution (Mac)]
[^ 1]: This article was also compatible with both 2 series and 3 series until January 2018. Since there is almost no merit to install the 2nd system now, I modified it to introduce only the introduction method of the 3rd system.