# Author: Erik Marsja

PhD Student in Psychology, Umeå University. Main interest is experimental and cognitive psychology. Enjoy programming in Python and R.

In this post, PyCharm vs Spyder will be compared. If you have followed my blog you may have noticed that a lot of focus have been put on how to learn programming (particularly in Python). I have also written about Integrated Development Environments (IDEs). I think that an IDE may, in fact, be very useful when learning how to code. Of course, when it comes to Python IDEs it may be hard to choose the best one (e.g., PyCharm vs Spyder?).

Spyder is one of my long-time favorite IDEs, and I am mainly using Spyder when I have to write code in Windows environments. However, in one of my blog posts PyCharm was suggested in one comment (see the comments on this post: Why Spyder is the Best Python IDE for Science) that I should test PyCharm.

After testing out PyCharm I started to like this IDE. In this post you will find my views on the two IDEs. E.g., I intend to answer the question; which is the best Python IDE; PyCharm or Spyder?

In this post you are going to learn how to create a simple experiment using the free experiment building software OpenSesame. As I have previously written about, OpenSesame, is an application, based on Python, for creating Psychology, Neuroscience, and Economics experiments. It offers a nice and easy to use interface.  In this interface you can drag-and-drop different objects. This means that you don’t have to know any Python programming at all to create an experiment. If you need to know how to use images as stimuli you can see this OpenSesame Tutorial.

In this short post we are going to revisit the topic on how to carry out summary/descriptive statistics in Python. In the previous post, I used Pandas (but also SciPy and Numpy, see Descriptive Statistics Using Python) but now we are only going to use Numpy. The descriptive statistics we are going to calculate are the central tendency (in this case only the mean),  standard deviation, percentiles (25 and 75), min, and max.

One of the great things with programming is that you can automate things that is boring. For instance, as a student I often got schedules in the form of Word documents.

I prefer to have all my activities in a digital calendar and used to manually enter every class, seminar, and so on from a course into my calendar.  One day I got tired and thought that  I could probably do automate this task using Python.

After some searching around on the Internet I found the Python packages python-docx and iCalendar. In this post I will show you how to use these to packages to create an iCalender file that can be loaded in to a lot of available calendars (e.g., Google Calendar, Outlook Calendar).

Inspired by my post for the JEPS Bulletin (Python programming in Psychology), where I try to show how Python can be used from collecting to analyzing and visualizing data, I have started to learn more data exploring techniques for Psychology experiments (e.g., response time and accuracy). Here are some methods, using Python, for visualization of distributed data that I have learned; kernel density estimation, cumulative distribution functions, delta plots, and conditional accuracy functions. These graphing methods let you explore your data in a way just looking at averages will not (e.g., Balota & Yap, 2011).

## Required Python packages

I used the following Python packages; Pandas for data storing/manipulation, NumPy for some calculations, Seaborn for most of the plotting, and Matplotlib for some tweaking of the plots. Any script using these functions should import them:

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 analysing 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.

In this post I will describe, shortly, how to use InLine scripts in E-prime to save your data in comma-separated values (CSV) files. For those who are not familiar with E-prime it is an experiment generating software based on visual basic (i.e., it has its own scripting language called e-basic). Its main purpose is to make building experiment easy/easier. It offers a drag-and-drop graphical user interface (GUI) which is fairly easy to use (although I prefer OpenSesame and PsychoPy – which both offers drag-and-drop GUIs). See the Wikipedia article if you want to know more about e-prime.

This guide will assume that you have worked with e-prime before. That is, you should already have a, more or less, ready experiment that you can add the scripts to.  In the guide I use a Simon task created in e-prime as an example.

PsychoPy, as I have previously written about (e.g., Free and Useful Software and PsychoPy tutorial) is really a great Python tool for creating Psychology experiments. You can write Python code by either using  “code view” or import the package in your favourite IDE.  Furthermore, you can use the builder mode and just drag and drop different items and PsychoPy will create a Python Script for you.

If need inline scripts (in Python, of course) can be inserted. That is, you can combine drag-and-drop building with some coding.

In this post I have collected some tutorial videos that can be useful for someone unfamiliar with PsychoPy.

Previously I have shown how to analyze data collected using within-subjects designs using rpy2 (i.e., R from within Python) and Pyvttbl. In this post I will extend it into a factorial ANOVA using Python (i.e., Pyvttbl). In fact, we are going to carry out a Two-way ANOVA but the same method will enable you to analyze any factorial design. I start with importing the Python libraries that  are going to be use.