]> git.donarmstrong.com Git - neurodebian.git/blob - sandbox/opensesame.rst
1b2e0585780158ce998fef644b66379378e266c1
[neurodebian.git] / sandbox / opensesame.rst
1 :date: 2011-xx-xx 0:00:00
2 :tags: neuroscience, software, opensesame, sebastiaan mathot
3 :author: Sebastiaan Mathôt
4
5 OpenSesame and back-end independence
6 ====================================
7
8 I suspect that many of you will not be familiar with me or my software, so
9 let's start with a brief introduction. My name is Sebastiaan Mathôt. I'm the
10 lead developer of OpenSesame, a graphical tool for creating psychological and
11 neuroscientific experiments.
12
13 About OpenSesame
14 ----------------
15
16 The reason that I started working on OpenSesame, aside from the inherent
17 pleasure that a geek like myself derives from developing software, was my
18 dissatisfaction with the tools that were available. Not that there's a shortage
19 of experiment building software, not at all. And for people with reasonable
20 programming skills there are many viable options: MatLab/ Octave in combination
21 with the Psychophysics Toolbox, Python in combination with VisionEgg or
22 PsychoPy, to name but a few (all of these are, incidentally, available through
23 NeuroDebian). But for people with relatively modest programming skills, such as
24 most students doing a Bachelor's or Master's project, there aren't that many
25 options. In my experience, people will generally end up using a proprietary
26 program, such as E-Prime, Inquisit, or what have you. These offer a reasonably
27 intuitive graphical interface, but at a price. First, these packages are
28 expensive and, due to licensing restrictions, people are frequently unable to
29 install them on their personal computers. Second, they are limited in their
30 functionality and in their interoperability with other software.
31
32 .. figure:: pics/blog/opensesame_stimulus.png
33
34    One of the unique features of OpenSesame is the ability to draw your
35    stimuli. You can combine this what-you-see-is-what-you-get approach with
36    scripting, to easily create flexible stimulus displays.
37
38 Therefore, I wanted to develop a graphical environment for building
39 experiments, centered around the Python programming language. The idea was to
40 give users the type of comprehensive graphical interface that they have come to
41 expect from proprietary packages, but for free, and without taking away any of
42 the power that Python has to offer. And, almost a year, 12 public releases, and
43 more than 10,000 downloads later, the result is OpenSesame!
44
45 Back-end independence
46 ---------------------
47
48 For this post, I was asked to write about one of OpenSesame's features in
49 particular: back-end independence. This may sound a bit technical and boring,
50 but it's not. Well... maybe a little boring. In fact, it should be a little
51 boring, because it's a feature that you're not supposed too notice, unless you
52 need it.
53
54 So what do I mean by "back-end independence"? Experiments are all about
55 presenting stimuli. Most often visual stimuli on a computer display, sometimes
56 sounds, tactile stimuli, etc. From the perspective of a programmer, there are
57 many ways to present such stimuli. Put differently, there are many programming
58 libraries that you can use.
59
60 For example, if you want to write a program that controls a computer display,
61 you can use a Python library called PyGame. PyGame has been designed with
62 video-games in mind, but, experiments being conceptually so similar (although
63 not typically as entertaining), it is also well suited for creating
64 experiments. For this reason, I initially designed OpenSesame around PyGame.
65
66 This seemed like a good idea at the time, but there was a huge drawback. If
67 people wanted to use OpenSesame, they were forced to use PyGame as well. It was
68 a package deal, so if PyGame didn't support a particular feature, neither did
69 OpenSesame. That wasn't very nice. And it also wasn't necessary, because there
70 was nothing in OpenSesame that inherently required PyGame. It was just an
71 arbitrary design choice that I had made at the outset.
72
73 So I decided to decouple the "back-end" (i.e., all the functions that had been
74 handled by PyGame up to that point) from the rest of OpenSesame. This means
75 that the user can now choose which back-end he or she wants to use for
76 controlling the display etc. Importantly, OpenSesame continues to function in
77 the same way, regardless of which back-end is selected. For users who don't
78 care or know what a back-end is, let alone which back-end they prefer, PyGame
79 still serves as a default.
80
81 .. figure:: pics/blog/opensesame_backend.png
82
83    You can easily select your favorite back-end using the graphical interface.
84    The same experiment can be run, (usually) completely unmodified, using any
85    of the three available back-ends.
86
87 So what's the upshot of all this? Right now, the most direct benefit is that
88 you can use OpenGL and PsychoPy in your OpenSesame experiments. PsychoPy in
89 particular provides lots of functions (drawing Gabor patches etc.) that are
90 very convenient when creating experiments. Previously, users couldn't use
91 these, because PsychoPy doesn't play nice with PyGame (even though it actually
92 uses, or can use, PyGame under the hood). Now they can, so that's a definite
93 plus. And in the future I may add more back-ends, depending on popular demand.
94 For example, VisionEgg is another library for creating experiments. VisionEgg
95 is quite popular and could probably be used as a back-end as well.
96
97 This means that users of OpenSesame now have both a comprehensive graphical
98 interface and powerful programming libraries at their disposal. They can
99 choose. Most of the experiment can usually be created using the GUI, which is
100 especially appealing for the less tech-savvy among us. But, for more
101 complicated parts, Python scripting can be used and, consequently, users have
102 access to a wide range of libraries.
103
104 I think that OpenSesame's back-end independence is a nice example (one of many,
105 I hasten to add) of how free software can work together. If it hadn't been
106 possible to use PsychoPy and OpenGL in OpenSesame, I would have probably ended
107 up duplicating lots of functionality. That would have been very time consuming.
108 Time that I have now spent on refining other parts of OpenSesame, unique parts
109 and not simply duplicates of existing functionality.
110
111 And ultimately, I believe that this type of interoperability is why free
112 software will continue to grow.
113
114 Links
115 Cogsci.nl <http://www.cogsci.nl/>
116 OpenSesame <http://www.cogsci.nl/opensesame>
117
118