Best Python libraries for Psychology researchers

python-logo-master-v3-TM

Python is gaining popularity in many fields of science. This means that there also are many applications and libraries specifically for use in Psychological research.

For instance, there are Python packages for collecting data, doing basic statistics, and analyzing brain imaging data. In this post, I have collected some useful Python packages for researchers within the field of Psychology and Neuroscience. I have used and tested some of them, but others I have yet to try.

Read more

TrialHandler – a PsychoPy tutorial

In this tutorial, you will learn how to use the PsychoPy function TrialHandler to create trials and correct responses to your targets in these trials. PsychoPy is an application for creating experiments for Psychology experiments. The application is written in Python, an easy programming language to learn. You can learn more about PsychoPy in my … Read more

Free & Useful Software – PsychoPy

PsychoPy

This post will describe why I prefer using PsychoPy before other software. When I started getting involved in research (i.e., when doing my Bachelor’s and Masters’s theses), I used the software that was accessible to me. That is, some of the most commonly used software in the department I was studying at. After starting my Ph.D. studies, I got increasingly annoyed with one of the software we used to build experimental tasks in (i.e., E-prime).

First, I was unfamiliar with the scripting language (called ‘e-basic’) that was needed, for instance, to solve pseudo-randomization and send signals to a specially built device I was going to use in my experiments. Second, I prefer to use Linux systems, and e-prime is limited to Windows. In fact, e-prime seemed to work best with Windows Vista or earlier, but our lab computers were, and are, running Windows 7 (which might have changed back then). Some time into my Ph.D. studies, I found PsychoPy, which is written in Python, a programming language that I did know. It seemed like a good alternative to e-prime, and other similar software, to create experiments in.

Read more

Collecting data with Scrapy

This rather long (counting the Python code) tutorial assumes that you are interested in scraping data off the web using Scrapy. It might also be limited to Linux.

Installing scrapy

Here is how to install a Python package using pip:

pip install scrapyCode language: Bash (bash)

Note, if you need to you can also use pip to install a specific version of Scrapy as well as upgrade pip, if you have an old version. Now, to create a new Scrapy project, open up a terminal and create a directory where you will store your Scrapy projects change do that directory and run this (change ‘psysci’ to whatever your project will be named):

scrapy startproject psysciCode language: Bash (bash)

Item

We start with the Item class and create an object to store our scraped data in. In my example I scrape the article title, type of article, the article’s abstract, when the article was received and when it got accepted for publication, which year it was publicized (and month) and the articles keywords.

Read more