PsychoPy was developed as a Python package that could be imported from scripts needing to present stimuli. As a result, the behaviour is free to, and does, vary between manufacturers. An example of this is that the OpenGL specification allows for the frame not to be cleared after a swap of the “front” and “back” buffers during a screen refresh, but does not specify whether the new back buffer is maintained from the previous back buffer (most useful for the continuity of drawing frames) or retrieved from the previous front buffer (as implied by the term “swapping” buffers). Other differences are subtle and unnoticed by most users. Some such differences are obvious for example, Apple Macs have not supported parallel ports directly for several years so scripts using parallel port communication cannot work on those platforms. Perfect independence is never possible because of hardware differences between computers. Scientists should not need to learn a whole new set of tools just because they have decided to switch their main computer platform, and should be able to share code and experiments with colleagues using other platforms. Computer technologies change rapidly and the relative advantages of different platforms can vary equally quickly. Platform independence is a particular goal of PsychoPy. Nearly all modern graphics cards are capable of using OpenGL (although they may need updated drivers) and perfectly adequate cards from nVidia or ATI, that support the OpenGL 2.0 extensions, can be currently purchased and added to a desktop computer of any platform for roughly £30. PsychoPy 0.95 is fully compatible with the OpenGL 1.5 specification but makes use of further facilities that were added to OpenGL 2.0 on graphics cards and drivers where these are available. The OpenGL specification determines, fairly precisely, what a graphics card should do given various commands, such that platform independence is largely maintained (there are certain aspects, such as the synchronisation of drawing with the screen vertical refresh that are graphics card and/or platform dependent). Most modern machines have very powerful graphics processing units that can perform a lot of the calculations necessary to present stimuli at a precise point in space and time and to update that stimulus frequently. In order to achieve good temporal precision, while updating stimuli in real-time from an interpreted language like Python or Matlab, it has been essential to make good use of the hardware accelerated graphics capabilities of modern computers. Where Matlab has, in the past, benefited from its large user base and wide variety of applications to science, Python stands to benefit even more. By nature of its clean, readable, and powerful syntax combined with its free and open-source release model Python is clearly a very popular language that is continuously growing and developing further. The fact that Python can be used in such a wide variety of ways (for example, in the author’s own lab Python is used not only for stimulus presentation but also for data analysis, for the generation of publication-quality figures, for computational modelling and for various general purpose scripts to manipulate files) means that in many cases this is likely to be the only programming language that a scientist need learn, with the obvious benefits in time that result. The fact that Python now has such a large user base means that there is a large community of excellent programmers developing libraries that PsychoPy can make use of. The platform independence that PsychoPy enjoys is based very much on the fact that it is based on pure Python code, using libraries such as wxPython, pyglet and numpy that have been written to be as platform independent as is technically possible. The high-level functions and libraries available in Python make it an ideal language in which to develop such software. One of the strengths of PsychoPy is its use of Python.
0 Comments
Leave a Reply. |