Tools/Python Tools

From UIT
(Difference between revisions)
Jump to: navigation, search
(NumPy)
 
(38 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{TOC right}}
 
{{TOC right}}
 +
== IDEs ==
  
[http://www.python.org/ Python] can be used to achieve results similar to [[Tools/Octave_Matlab|Octave or Matlab]], but with the advantages of a fundamentally object-oriented general-purpose language. 
+
=== PyCharm ===
Additionally to numerical computation, packages allow to [http://docs.scipy.org/doc/scipy/reference/tutorial/linalg.html solve linear systems].
+
  
Numerical computation with [http://www.python.org/ Python] mainly bases on the following libraries:
+
The [https://www.jetbrains.com/pycharm/ PyCharm] IDE provides an exhaustive development interface.
* [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://matplotlib.org/ matplotlib] for 2D plots
+
  
[http://www.scipy.org/PyLab PyLab] integrates these 3 libraries.
+
=== Atom ===
  
The [https://code.google.com/p/spyderlib/ Spyder IDE] provides a MATLAB-like development interface.
+
[[Tools/Atom|Atom]] is an open source text editor whose functions can be extended with packages to provide a Python IDE.  
As a simple alternative, [http://ipython.org/ IPython] provides a web-based GUI and Mathematica-like notebooks.
+
 
 +
=== IPython ===
 +
 
 +
As a simple alternative, [http://ipython.org/ IPython] provides a web-based GUI and Mathematica-like notebooks. Spyder also contains a IPython console.
 +
 
 +
=== Spyder ===
 +
 
 +
The [http://code.google.com/p/spyderlib/ '''S'''cientific '''PY'''thon '''D'''evelopment '''E'''nvi'''R'''onment (Spyder)] IDE provides a complete MATLAB/Octave-like development interface. This means you get an editor, a console, online help, variable explorer, debugger with breakpoints and much more.
  
 
== Installation ==
 
== Installation ==
 +
 +
=== Mac OS ===
 +
 +
Download [https://code.google.com/p/spyderlib/downloads/list Spyder].
 +
Copy the application to the <code>Applications</code> folder.
  
 
=== Linux ===
 
=== Linux ===
  
Installation can be done on a package basis, with [http://en.wikipedia.org/wiki/EasyInstall easy_install] or [http://en.wikipedia.org/wiki/Pip_%28Python%29 pip].
+
Installation can be done on a package basis, with [http://en.wikipedia.org/wiki/Pip_%28Python%29 pip].
 +
An alternative would be  [http://en.wikipedia.org/wiki/EasyInstall easy_install].
  
 
Install the IDE:
 
Install the IDE:
sudo apt-get install spyder
+
<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>.
 +
 +
=== Windows ===
 +
 +
We recommend to use the free and open-source [http://winpython.sourceforge.net WinPython] Python distribution.
 +
It is portable in the sense, that it will not write anything to the Windows registry and everything is stored in the installation folder. This means that you can copy or move the installation folder anytime to any location (local, network or removable drive) with most of the application settings. You are even able to have multiple Python distributions installed on one machine (see also [http://sourceforge.net/p/winpython/wiki/Roadmap/ Roadmap]).
 +
 +
There are 32-bit or 64-bit installers (depending on your operating system) for
 +
* [https://sourceforge.net/projects/winpython/files/WinPython_2.7/ Python 2.7]
 +
* [https://sourceforge.net/projects/winpython/files/WinPython_3.3/ Python 3.3]
 +
 +
We do NOT recommend to install it to <code>C:\Program Files</code> or any similar folder, as you need administrator privileges to execute it there.
 +
 +
To install additional packages or upgrade existing ones, use the <code>WinPython Control Panel</code>.
 +
 +
<code>Spyder</code> is already provided with [https://sourceforge.net/projects/winpython/ WinPython].
 +
 +
== Verifiy correct installation ==
  
 
Launch <code>Spyder</code>, and in the console type:
 
Launch <code>Spyder</code>, and in the console type:
t = linspace(0, 10, 100);
+
<source lang="Python">
plot(t, sin(t));
+
t = linspace(0, 10, 100);
 +
plot(t, sin(t));
 +
</source>
 +
A plot of a sinus wave should appear.
  
=== Windows ===
+
== 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.scipy.org/ SciPy] depends on [http://www.numpy.org/ NumPy], used to manipulate numbers, for signal processing, ...
 +
* [http://matplotlib.org/ matplotlib] for 2D plots
 +
 
 +
Symbolic mathematics can be done with:
 +
* [http://sympy.org/en/index.html SymPy]
 +
 
 +
=== 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 ===
 +
 
 +
[http://www.numpy.org/ '''Num'''erical '''Py'''thon]
 +
 
 +
[http://docs.scipy.org/doc/numpy/reference/ NumPy Reference Documentation]
 +
 
 +
Install with:
 +
apt install python-numpy
 +
 
 +
=== SciPy ===
 +
 
 +
[http://www.scipy.org/ '''Sci'''entific Library for '''Py'''thon]
 +
 
 +
[http://docs.scipy.org/doc/scipy/reference/ SciPy Reference Documentation]
 +
 
 +
Update by downloading [http://sourceforge.net/projects/scipy/files/ the latest version].
 +
 
 +
=== matplotlib ===
 +
 
 +
[http://matplotlib.org/ matplotlib] python 2D plotting library
 +
 
 +
Check out the [http://matplotlib.org/faq/usage_faq.html#coding-styles Usage FAQ: Coding Styles] for a short introduction to plotting with [http://matplotlib.org/ matplotlib].For full documentation go to the [http://matplotlib.org/api/index.html API documentation].
 +
 
 +
Update by downloading [http://matplotlib.org/downloads.html the latest version].
 +
 
 +
Note 1: As [http://matplotlib.org/ matplotlib] depends on [http://www.numpy.org/ '''NumPy'''], update [http://www.numpy.org/ '''NumPy'''] before [http://matplotlib.org/ matplotlib]!
 +
 
 +
=== SymPy ===
 +
 
 +
[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 or read through the [http://docs.sympy.org/0.7.2/index.html documentation].
 +
 
 +
=== Pillow ===
 +
 
 +
[http://python-pillow.github.io Pillow - The friendly PIL fork] PIL is the Python Imaging Library.
 +
 
 +
Check the [http://pillow.readthedocs.org/en/latest/installation.html#simple-installation Simple Installation]
 +
[[Category:Install]] [[Category:Python]]
 +
 
 +
=== Pandas ===
 +
 
 +
[http://pandas.pydata.org/ pandas] with easy-to-use data structures and data analysis tools.
  
Download [https://code.google.com/p/pythonxy/ Python(x,y)].
+
=== Cocotb ===
  
This will allow to install [http://www.python.org/ Python] and other components of your choice.
+
[http://cocotb.readthedocs.io/en/latest/introduction.html Cocotb manual].
  
[[Category:Install]]
+
To run it without modelsim optimising the design :  
 +
make GUI=1 VCOM_ARGS=+acc

Latest revision as of 10:23, 17 August 2018

Contents

IDEs

PyCharm

The PyCharm IDE provides an exhaustive development interface.

Atom

Atom is an open source text editor whose functions can be extended with packages to provide a Python IDE.

IPython

As a simple alternative, IPython provides a web-based GUI and Mathematica-like notebooks. Spyder also contains a IPython console.

Spyder

The Scientific PYthon Development EnviRonment (Spyder) IDE provides a complete MATLAB/Octave-like development interface. This means you get an editor, a console, online help, variable explorer, debugger with breakpoints and much more.

Installation

Mac OS

Download Spyder. Copy the application to the Applications folder.

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.

Windows

We recommend to use the free and open-source WinPython Python distribution. It is portable in the sense, that it will not write anything to the Windows registry and everything is stored in the installation folder. This means that you can copy or move the installation folder anytime to any location (local, network or removable drive) with most of the application settings. You are even able to have multiple Python distributions installed on one machine (see also Roadmap).

There are 32-bit or 64-bit installers (depending on your operating system) for

We do NOT recommend to install it to C:\Program Files or any similar folder, as you need administrator privileges to execute it there.

To install additional packages or upgrade existing ones, use the WinPython Control Panel.

Spyder is already provided with WinPython.

Verifiy correct installation

Launch Spyder, and in the console type:

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

A plot of a sinus wave should appear.

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:

Pip

pip is a tool for installing and managing Python packages.

pip Documentation

NumPy

Numerical Python

NumPy Reference Documentation

Install with:

apt install python-numpy

SciPy

Scientific Library for Python

SciPy Reference Documentation

Update by downloading the latest 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 latest version.

Note 1: As matplotlib depends on NumPy, update NumPy before matplotlib!

SymPy

Symbolic Mathematics with Python

Try out SymPy Live directly in your browser to get a feeling of it or read through the documentation.

Pillow

Pillow - The friendly PIL fork PIL is the Python Imaging Library.

Check the Simple Installation

Pandas

pandas with easy-to-use data structures and data analysis tools.

Cocotb

Cocotb manual.

To run it without modelsim optimising the design :

make GUI=1 VCOM_ARGS=+acc
Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox