3. Check your installation

3.1. Check R and Rstudio

Launch Rstudio, and in the Console (left window), type:

example(density)

This should display a series of graphics (Press <Return> to advance).

Then type:

require(tidyverse)

If the package tidyyverse is not found, you need to install it with:

install.packages('tidyverse')

Close RStudio. That will be all.

3.2. Check if Python can be executed in a Terminal

Open a Terminal (that is, Git Bash for Windows users) and type:

which python

This should print the location of the python interpreter, e.g. something like /home/macron/anaconda3/python

If no message is displayed, the PATH environment variable — which lists the directories where programs can be found — is messed up, most probably due not following closely the installation instructions (for Windows users, check the Anaconda and Git for Windows instructions)

Type python and press ‘Enter’.

You should see a prompt >>> followed by a blinking cursor. Python is waiting for your commands! Type:

2**100

This should display the 100 power of 2. Type quit() to leave Python and press Ctrl-D to close the Terminal. Basic Python is working.

3.3. Check Git

Download the course materials using Git by entering the following command line in a Terminal:

git clone https://github.com/chrplr/PCBS.git

You should see a message Cloning into 'PCBS'... and, if everything goes well, all the course materials (python scripts, data files, …) should be downloaded in a new subdirectory called PCBS, within the current working directory. You can cd into it and list its content:

cd PCBS
pwd
ls

Your Terminal window should more or less look like this:

Terminal showing the results of git clone...

Warning

If a folder named PCBS already exists in the current working directory, git will stop and will not download the content of the remote PCBS repository. In that case, you must delete or move the existing PCBS folder before running the git clone command above.

When you open a Terminal, the current working directory is your “home”, or “user”, directory, until you start navigating in the filesystem with the cd (change directory) command. If you are lost at this point, read Navigating the file system.

3.4. Check Python

This tests if Python3 is installed and correctly configured.

cd ~/PCBS/games
python human-guess-a-number.py
_images/guess-number.png

Warning

If you receive an error message such as bash: python: No such file or directory, and you are sure that python is installed, the most likely reason is that the problems lies with the PATH environment variable) listing all the directories: the directory containing the python executable file may be missing from the list. This happens for example, if you run the Anaconda3 installer and did not check the relevant box.

3.5. Check basic graphics

cd ~/PCBS/simulations/fractals
python koch0.py
_images/koch0.png

You can launch the Visual Code editor and open the python file PCBS/simulations/fractals/koch0.py to check the code.

3.6. Check matplotlib

matplotlib is a python library to create and display graphics. Here, we try to generate some graphical effects to check that this library has been correctly installed.

cd ~/PCBS/stimuli/visual
python bullseye.py
_images/bullseye.png
python contrast_modulated_grating.py
_images/contrast-modulated.png
python gabor.py
_images/gabor.png
python image-manipulation.py
_images/image-manip.png
python wedgering.py
_images/wedge-ring.png

3.7. Check pygame

Pygame is a Python library to create simple audio visual games. It was installed along with expyriment. If you had to create a Python virtual environment when you installed expyriment, you need to activate it:

conda activate expyriment  # if you use conda
pyenv activate expyriment  # if you use standard python with pyenv

You can then check if pygame is installed by starting python on a command line and typing import pygame a the >>>` prompt. A message ``Hello from the pygame community. should be displayed.

cd ~/PCBS/stimuli/visual-illusions/
python kanizsa_triangle.py
_images/kani.png
python hering.py
_images/hering0.png
python extinction-rotated.py

3.8. Check Expyriment

Expyriment is a Python library for designing and conducting behavioural and neuroimaging experiments.

If you had to create a Python virtual environment when you installed expyriment, you need to activate it (unless it is already activated in your current Terminal):

conda activate expyriment  # if you use conda
pyenv activate expyriment  # if you use standard python with pyenv

Try to run the following experiment (Note that the programs can be interrupted at any time by pressing the Esc key).

cd ~/PCBS/experiments/xpy_parity_decision
python parity_feedback.py

This should run a small exepriment where the participant must chech the parity (odd or even) of numbers.

That’s all folks !

3.9. Appendices

3.10. Keep your local copy of the course material up to date

The course materials are often updated. To make sure you have the latest version, you can synchronize your local copy with the github repository http://github.com/chrplr/PCBS, with the commands:

cd ~/PCBS
git pull

Notes:

  • if the PCBS directory is not in your home directory (-), you will need to use the appropriate path in the first cd command.

  • do not manually modify or create new files in the PCBS folder. If you do so, git will notice it and might prevent an automatic upgrade and ask you to ‘resolve conflicts’. If you get such a message, the simplest course of action, for beginners, is to delete the PCBS folder (or move it if you wnat to keep a copy of your modifications) and reissue the git clone command above to reload the full folder.)

3.11. Basic surviving skill: how to enter command lines in a Terminal

Watch the video at https://www.youtube.com/watch?v=2yhcWvBt7ZE&t and try to perform the activities in it (the instructions also work for Mac or Linux: you just need to open a standard Terminal while in Windows you start ‘Git Bash’). Note: the game scripts mentioned in the video are available at https://github.com/chrplr/PCBS/tree/master/games/games.zip

For the moment, you mostly need to know the following three commands:

  • ls: list the content of the current working directory

  • pwd: path of current working directory

  • cd: change directory

Read about them in http://linuxcommand.sourceforge.net/lc3_lts0020.php

Here are some resources to learn more about how to control your computer from a terminal:

Footnotes