Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 1 Getting...

16
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 1 Getting Started 4/5/09 Python Mini-Course: Day 1 - Lesson 1 1

Transcript of Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 1 Getting...

Python Mini-CourseUniversity of Oklahoma

Department of Psychology

Day 1 – Lesson 1Getting Started

4/5/09Python Mini-Course: Day 1 - Lesson 11

Lesson objectives

1. Describe what Python is2. Understand how Python can

be used in behavioral science3. Install Python and add-ins

4/5/09Python Mini-Course: Day 1 - Lesson 12

What is Python?

General purpose computer programming languageHas math and science add-insHas GUI add-ins

Multi-platformSame program can run on MS Windows, Mac OS X, Linux, etc.

4/5/09Python Mini-Course: Day 1 - Lesson 13

What can I do with Python?

Write programs to run experimentsExample: Trivia Lag Expt

Computational modelingExample: fSAMpy

Statistical analysesExample: bootstrapping

4/5/09Python Mini-Course: Day 1 - Lesson 14

What can I do with Python?

Data processing and analysisPyParse (Kahana lab)

fMRI (Waisman Brain Imaging Lab)

Just about anything else you can think ofGames, graphics, audio apps, even cell phone apps(http://www.awaretek.com/pymo.html)

4/5/09Python Mini-Course: Day 1 - Lesson 15

How does Python compare:

Other languages (C, C++, Visual Basic, Java, etc.)Python is easier to learnPython is just as powerfulPython is NOT as widely used

4/5/09Python Mini-Course: Day 1 - Lesson 16

How does Python compare:

Scientific computing packages (Matlab and Mathematica)

Statistical packages (SAS, SPSS, R, etc.)

4/5/09Python Mini-Course: Day 1 - Lesson 17

Python isFREE

4/5/09Python Mini-Course: Day 1 - Lesson 18

How to get and install Python

We’re going to install several components:Python – the main languagewxPython – for building and running GUIs

NumPy and SciPy – for numeric and scientific computing

SPE (Stani’s Python Editor)4/5/09Python Mini-Course: Day 1 - Lesson 19

Installing Python

www.python.org/download/releases/2.5.4

Find your platform (Windows or MacOS X) and click on the download link

Save the file to your hard driveRun the installer program

4/5/09Python Mini-Course: Day 1 - Lesson 110

Installing wxPython

http://www.wxpython.org/download.php

Windowsdownload “win32-unicode”

MacOS Xdownload “osx-unicode”

Save the install file, then run it

4/5/09Python Mini-Course: Day 1 - Lesson 111

Installing NumPy

http://numpy.scipy.org/Click on the download link

Download numpy-1.3.0rc2 for your platform and Python version

Run the install file

4/5/09Python Mini-Course: Day 1 - Lesson 112

Installing SciPy

http://sourceforge.net/project/showfiles.php?group_id=27747Click on the download link

Download scipy0.7.0 for your platform and Python version

Run the install file

4/5/09Python Mini-Course: Day 1 - Lesson 113

Installing SPE

For MS Windows:http://prdownload.berlios.de/python/SPE-

0.8.4.c-wx2.6.1.0-no_setup.zipUnzip it to somewhere you will

remember (e.g., Program Files) but don’t rename the folder anything other than “_spe”.

Go inside the _spe directory you just created and double click SPE.py

4/5/09Python Mini-Course: Day 1 - Lesson 114

Installing SPE

For Mac OS X:http://olczyk.krzysztof.googlepages.com/

SPE.dmgSave the file, mount the disk image, and follow the instructions

4/5/09Python Mini-Course: Day 1 - Lesson 115

Python resources

www.python.orghttp://python.org/doc/2.5/tut/tut.html

www.scipy.orghttp://numpy.scipy.org

4/5/09Python Mini-Course: Day 1 - Lesson 116