Python-control/Download

From Murray Wiki
Revision as of 04:42, 3 September 2012 by Murray (talk | contribs) (Created page with "{{righttoc}} This page contains information for downloading and installing python-control. This package is designed for use in the [http://ipython.scipy.org/moin/ IPython] en...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page contains information for downloading and installing python-control. This package is designed for use in the IPython environment, with SciPy extensions for scientific computing plus the matplotlib extensions (which enables MATLAB-like plotting).

  • Source code - download the latest version of the python control library here

Prerequisites

Standard python libraries

In order to run control-python, you must first install some standard python packages:

  1. SciPy - Open source library of scientific tools: http://www.scipy.org
  2. Matplotlib - Plotting library for python: matplotlib.sourceforge.net
  3. ipython (optional) - interactive python shell: http://ipython.scipy.org

If you have everything installed correctly, you should be able to run the following code

from scipy import *
from pylab import *    # Not needed if you use ipython -pylab
a = zeros(1000)
a[:100]=1
b = fft(a)
plot(abs(b))
show()                 # Not needed if you use ipython -pylab

SLICOT

Some of the underlying functions in python-control are carried out using the SLICOT software library. The python-control library uses the slycot python wrapper developed by Enrico Avventi at KTH.

  • Slycot is only required for functions that make use of SLICOT routines (eg, linear quadratic regulators, Kalman filtering, control)
  • The slycot library is currently under development and the API is not yet fixed. Some errors may occur if the version of slycot and python-control are incompatible

Download

The python-control package can be downloaded from SourceForge:

The files are distributed as compressed tar files. To unpack and installed, run the following from the command line

tar xzf control-N.mx.tar.gz
cd control-N.mx
python setup.py install

where N-mx is the latest release (eg, 0.3c).

To see if things are working, you can run the script secord-matlab.py (using either python or ipython -pylab). It should generate a step response, Bode plot and Nyquist plot for a simple second order linear system.

Installation notes

slycot

  • To compile for 64 bit architecture on OS X, edit setup.py to include the lines
extra_link_args=['-arch x86_64']
and then run setup.py as
python setup.py config_fc --arch="-arch x86_64" build