Tools/Python Tools

From UIT
Revision as of 14:00, 8 May 2013 by Guo (Talk | contribs)
Jump to: navigation, search

Contents

Modules

For our scientific purposes we use following modules regularly:

PyLab is an effort to consolidate following libraries together with IPython into a compelling environment for numerical computation:

  • NumPy for arrays, linear algebra, ...
  • SciPy depends on NumPy, used to manipulate numbers, for signal processing, ...
  • matplotlib for 2D plots

Symbolic mathematics can be done with:

IDEs

The Spyder IDE provides a complete MATLAB-like development interface. As a simple alternative, IPython provides a web-based GUI and Mathematica-like notebooks.

Installation

Mac OS

Download Spyder. Copy the application to the Applications folder.

Launch Spyder, and in the console type:

t = linspace(0, 10, 100);
plot(t, sin(t));

Linux

Installation can be done on a package basis, with pip. An alternative would be easy_install.

Install the IDE:

sudo apt-get install spyder

This also installs numPy, sciPy and matplotlib.

Launch Spyder, and in the console type:

t = linspace(0, 10, 100);
plot(t, sin(t));

Windows

Download Python(x,y) to install Python and other components of your choice.

Python(x,y) 2.7.3.1

In the Choose Components window of the installation make sure to have Python->Pip selected. Pip is needed to do the upgrades of the packages as described below. Select also Python->SymPy if you need it. Additional modules can easily be added later by re-running the installer and selecting the desired module(s).

Spyder IDE

Scientific PYthon Development EnviRonment is an IDE similar to the one you get with Matlab or Octave. This means you get an editor, a console, online help, variable explorer and much more.

With Python(x,y) 2.7.3.1 you get Spyderv. 2.1.11. We recommend however to upgrade to the newest version.

If you installed Python(x,y) correctly the commands below should work in any console. If pip is an unknown command, make sure that you have C:\Python27\Scripts in the Path environment variable.

First you have to remove the old Spyder first

pip uninstall spyder

and then install the newest version (at the time of writing this: v. 2.2.0) with

pip install spyder

Modules

Pip

pip is a tool for installing and managing Python packages.

pip Documentation

NumPy

Numerical Python

NumPy Reference Documentation

Update by downloading the newest version.

SciPy

Scientific Library for Python

SciPy Reference Documentation

Update by downloading the downloading the newest version.

matplotlib

matplotlib python 2D plotting library

Check out the Usage FAQ: Coding Styles for a short introduction to plotting with matplotlib.For full documentation go to the API documentation.

Update by downloading the downloading the newest version. Attention: v1.2.1 is NOT recommended!

SymPy

Symbolic Mathematics with Python

Try out SymPy Live directly in your browser to get a feeling of it or read through the [http://docs.sympy.org/0.7.2/index.html documentation.

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox