cognitive science
and more
Setting up Kubuntu 13.04 for research

A few days ago, Kubuntu 13.04 Raring Ringtail was released. I am a Kubuntu user myself, and to celebrate this new release, I wanted to share a few tips on how to set up the perfect Kubuntu environment for neuroscientists and psychologists. Of course, the ‘perfect’ environment is different everyone, but there are a few things that almost every researcher in this field will need: An office suite, a reference manager, graphics software, statistics and analysis software, and experiment building software.

What is Kubuntu?

Kubuntu is a Linux distribution. If you’re not familiar with Linux, this may not mean much to you, so let’s start with a little background.


Some relations between various flavors of Linux.

A Linux-based operating system is a layer cake. It consists of many layers of software that can be stacked and combined in an infinite number of ways. Only the bottom layer is constant: That’s the Linux kernel, which is part of all Linux-based operating systems, including Android. On top of the kernel, there can be different layers of software. Kubuntu is essentially one specific selection of software. Other Linux distributions, such as openSUSE, have slightly different selections. Some differences are clearly visible, such as different desktop environments (i.e. the software that controls the start menu, etc.). Other differences are largely under the hood, such as different system management tools.

A Linux distribution arranges the many layers of software in such a way that you, as a user, don’t have to worry about how it works.

The preference for one Linux distribution over another is entirely one of taste. I like Kubuntu because it is built on Ubuntu and Debian. These are major distributions that offer a lot of software out of the box, and you can rely on them to provide regular updates and support. The difference between Ubuntu and Kubuntu is the desktop interface. Ubuntu uses Unity, which is good-looking, but highly simplified. Kubuntu uses KDE, which offers more flexibility. I particularly like Kate, the default KDE text editor, which is truly excellent for programming. The entire Ubuntu family shares the same innards, so the tips from this post apply to all of them.

Installation


The default Kubuntu desktop.

You can download Kubuntu from http://www.kubuntu.org/getkubuntu. You can choose between the latest release (currently 13.04) and the latest Long Term Support release (currently 12.04.2 LTS). The LTS release comes with slightly older versions of most software, but should be more stable and will receive security updates for a longer period of time. The tips in this post should work for both releases, so the choice depends on whether you prefer the latest and greatest or the maximum amount of stability.

I won’t explain the installation procedure here, because it’s adequately explained on the Kubuntu site. Suffice it to say that installing Kubuntu doesn’t take long (maybe 20 minutes) and is very easy. Much easier than installing Windows!

When you start Kubuntu for the first time, you are presented with a basic desktop environment that should look familiar (but refreshingly different) to most Windows users.

Setting up your system

A lot of software is pre-installed on Kubuntu. This includes notably the full-featured office suite LibreOffice. However, as a researcher, you will need a number of programs that are not installed by default. Below is a description of some useful software. Some of it is useful for all researchers. Some of it is specific to psychologists and neuroscientists.

Browsing the web with Chromium

To start with the basics, Chromium, the open-source sister of Google Chrome, is my preferred web browser. Firefox is also a good option, of course. For some reason, the default browser in Kubuntu is Rekonq. Although Rekonq is not a bad piece of software, you will probably want to switch to either Firefox, Chrome, or Chromium, if only for the integration with Zotero.

Managing references with Zotero

Speaking of which: Zotero is a reference-management tool, more-or-less like the non-free EndNote. Zotero integrates with your web browser, so that you can easily import papers directly from PubMed, Google Scholar, etc. Zotero also integrates with LibreOffice. Zotero is available both as a Firefox plug-in and a standalone program. We will install the standalone version, which I think is more convenient.

By clicking on an icon in the top-right of your browser’s address bar, you can import references into Zotero. Virtually all major academic websites are supported.

To accompany Zotero, we will install Qnotero. This is a small program, written by yours truly, that allows you to search and open PDFs from your Zotero database with the click of a button.

Creating figures and posters with Inkscape and Gimp

A good tool for editing graphs, designing posters, etc., is Inkscape. Another useful graphics program that we will install is Gimp, a photo-editing program à la PhotoShop.

Doing statistics with R

R is a programming language for statistics. It’s very script-oriented, and has a steep learning curve. There are some GUIs available for R, notably Rkward and R commander, but unfortunately these are not as powerful as the non-free SPSS. A notable thing that is missing is an easy way to do within-subject (Repeated Measures) ANOVAs using the GUI. Because it’s remarkably tricky to find out how to do an SPSS-style Repeated Measures ANOVA in R, I will save you the trouble. The R-style equivalent goes like this:

dv ~ iv1 * iv2 + Error(subject / (iv1 * iv2))

This assumes that dv is your dependent variable, iv1 and iv2 are your independent variables, and subject is your subject variable.

Update: Thanks to Jona Sassenhagen and Andrea Epifani for pointing out R studio as another powerful R GUI (the best one maybe), and the ez package for running within-subject ANOVAs. Unlike the other packages described in this post, these cannot be installed from a repository, but instructions for installing R studio can be found here. ez can be easily installed from within R studio via Tools > Install packages. If the installation of ez fails, you have to upgrade R, as described here..

Doing analyses with Python

Finally, we will also install a variety of Python-based research tools. For conducting analyses and creating graphs (much of this you can also do with R), we will install NumPy, SciPy, Matplotlib, and IPython.

Creating experiments with OpenSesame

For creating and running experiments, we will install OpenSesame, PsychoPy, and Expyriment.

OpenSesame is the free graphical experiment builder that we are developing. Much of the development is done on Kubuntu.

Installing the software

Some of the programs listed above are available from the standard Kubuntu repositories (a repository is a software source, or an ‘app store’). This means that you can install them right away from the Muon Software Manager. However, a few programs are only available from third-party repositories. Fortunately, adding third-party repositories is very easy.

The first repository that we will add is NeuroDebian, which is dedicated to software for neuroscience and psychology. To add NeuroDebian to your software sources, first open a terminal program, which is called Konsole in Kubuntu. Now run the following two commands in the terminal (or see the NeuroDebian website for more instructions):

wget -O- http://neuro.debian.net/lists/raring.de-m.full \
    | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver pgp.mit.edu 2649A5A9

We will also need to add the Cogsci.nl repository. This can be done with the following command:

sudo add-apt-repository ppa:smathot/cogscinl

Now refresh the list of available software:

sudo apt-get update

You can now install all the necessary packages through the Muon Software Manager. But it’s easier to install everything in one go with the following command:

sudo apt-get install chromium-browser zotero-standalone \
    qnotero inkscape gimp python-numpy python-scipy \
    python-matplotlib opensesame psychopy expyriment r-base \
    r-cran-rcmdr rkward default-jre libreoffice-java-common \
    gnome-icon-theme-full

After confirming this last command it’s coffee time–It will take a few minutes to download and install these packages.

Just a few notes, to avoid surprises: The first time that you start Zotero, you will be asked to install the LibreOffice extension. This is normal, and should be done automatically. Similarly, the first time that you start Qnotero, you have to indicate the Zotero folder, which can be auto-detected. Finally, the first time that you start the R commander, you will be prompted to install some additional packages. This too, is a guided process.

The only thing that cannot be installed from a repository is the Zotero connector for Chrome, which is required for importing resources into Zotero from Chrome/ Chromium. However, it is available from the Chrome Web Store. First, open Chromium and visit https://chrome.google.com/webstore/category/home. Search for ‘Zotero Connector’ and click on the ‘Add to Chrome’ button next to the Zotero Connector extension.

That’s it! Happy researching.