Tools/Python Tools
Line 1: | Line 1: | ||
{{TOC right}} | {{TOC right}} | ||
+ | == Modules == | ||
− | + | For our scientific purposes we use following modules regularly: | |
− | + | ||
− | + | [http://www.scipy.org/PyLab PyLab] is an effort to consolidate following libraries together with [http://ipython.org/ IPython] into a ''compelling environment for numerical computation'': | |
* [http://www.numpy.org/ NumPy] for arrays, linear algebra, ... | * [http://www.numpy.org/ NumPy] for arrays, linear algebra, ... | ||
* [http://www.scipy.org/ SciPy] depends on [http://www.numpy.org/ NumPy], used to manipulate numbers, for signal processing, ... | * [http://www.scipy.org/ SciPy] depends on [http://www.numpy.org/ NumPy], used to manipulate numbers, for signal processing, ... | ||
* [http://matplotlib.org/ matplotlib] for 2D plots | * [http://matplotlib.org/ matplotlib] for 2D plots | ||
− | [http:// | + | Symbolic mathematics can be done with: |
+ | * [http://sympy.org/en/index.html SymPy] | ||
− | The [https://code.google.com/p/spyderlib/ Spyder IDE] provides a MATLAB-like development interface. | + | == IDEs == |
+ | |||
+ | The [https://code.google.com/p/spyderlib/ Spyder IDE] provides a complete MATLAB-like development interface. | ||
As a simple alternative, [http://ipython.org/ IPython] provides a web-based GUI and Mathematica-like notebooks. | As a simple alternative, [http://ipython.org/ IPython] provides a web-based GUI and Mathematica-like notebooks. | ||
Line 18: | Line 21: | ||
=== Mac OS === | === Mac OS === | ||
− | + | Download [https://code.google.com/p/spyderlib/downloads/list Spyder]. | |
Copy the application to the <code>Applications</code> folder. | Copy the application to the <code>Applications</code> folder. | ||
Launch <code>Spyder</code>, and in the console type: | Launch <code>Spyder</code>, and in the console type: | ||
− | + | <source lang="Python"> | |
− | + | t = linspace(0, 10, 100); | |
+ | plot(t, sin(t)); | ||
+ | </source> | ||
=== Linux === | === Linux === | ||
Line 31: | Line 36: | ||
Install the IDE: | Install the IDE: | ||
− | + | <source lang="Python"> | |
+ | sudo apt-get install spyder | ||
+ | </source> | ||
This also installs <code>numPy</code>, <code>sciPy</code> and <code>matplotlib</code>. | This also installs <code>numPy</code>, <code>sciPy</code> and <code>matplotlib</code>. | ||
Launch <code>Spyder</code>, and in the console type: | Launch <code>Spyder</code>, and in the console type: | ||
− | + | <source lang="Python"> | |
− | + | t = linspace(0, 10, 100); | |
+ | plot(t, sin(t)); | ||
+ | </source> | ||
=== Windows === | === Windows === | ||
Line 43: | Line 52: | ||
Download [https://code.google.com/p/pythonxy/ Python(x,y)] to install [http://www.python.org/ Python] and other components of your choice. | Download [https://code.google.com/p/pythonxy/ Python(x,y)] to install [http://www.python.org/ Python] and other components of your choice. | ||
− | ==== Python(x,y) 2.7.3.1 ==== | + | ==== [https://code.google.com/p/pythonxy/ 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 ===== | + | ===== [http://code.google.com/p/spyderlib/ Spyder] IDE ===== |
− | + | [http://code.google.com/p/spyderlib/ '''S'''cientific '''PY'''thon '''D'''evelopment '''E'''nvi'''R'''onment] 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. | |
− | + | ||
− | First you have to remove the old | + | With ''[https://code.google.com/p/pythonxy/ Python(x,y)] 2.7.3.1'' you get ''[http://code.google.com/p/spyderlib/ Spyder]v. 2.1.11''. We recommend however to upgrade to the newest version. |
+ | |||
+ | If you installed [https://code.google.com/p/pythonxy/ Python(x,y)] correctly the commands below should work in any console. If [https://github.com/pypa/pip#readme 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 [http://code.google.com/p/spyderlib/ Spyder] first | ||
<source lang='DOS'> | <source lang='DOS'> | ||
Line 58: | Line 70: | ||
</source> | </source> | ||
− | and then install the newest | + | and then install the newest version (at the time of writing this: v. 2.2.0) with |
<source lang='DOS'> | <source lang='DOS'> | ||
Line 65: | Line 77: | ||
== Modules == | == Modules == | ||
+ | |||
+ | === Pip === | ||
+ | |||
+ | [https://github.com/pypa/pip#readme pip] is a tool for installing and managing [http://www.python.org/ Python] packages. | ||
+ | |||
+ | [http://www.pip-installer.org/en/latest/ pip Documentation] | ||
+ | |||
=== NumPy === | === NumPy === | ||
− | ['''Num'''erical '''Py'''thon] | + | [http://www.numpy.org/ '''Num'''erical '''Py'''thon] |
[http://docs.scipy.org/doc/numpy/reference/ NumPy Reference Documentation] | [http://docs.scipy.org/doc/numpy/reference/ NumPy Reference Documentation] | ||
Line 90: | Line 109: | ||
=== SymPy === | === SymPy === | ||
− | [http:// | + | [http://sympy.org/en/index.html '''Sym'''bolic Mathematics with '''Py'''thon] |
− | Try out [http://live.sympy.org/ SymPy Live] directly in your browser to get a feeling of it. | + | Try out [http://live.sympy.org/ 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. |
[[Category:Install]] [[Category:Python]] | [[Category:Install]] [[Category:Python]] |
Revision as of 10:40, 8 May 2013
|
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.
NumPy
SciPy
matplotlib
Install the newest version (v1.2.1 is NOT recommended) of matplotlib
Check out the Usage FAQ: Coding Styles for a short introduction to plotting with matplotlib. For full documentation go to the API documentation.
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.