{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "PYTHON/ANACONDA TUTORIAL\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "

Getting Started With Python and Anaconda


\n", "\n", "\n", "\n", "
    \n", "\n", "\n", "
  1. Introduction
  2. \n", "\n", "
  3. Anaconda
  4. \n", "\n", "
  5. Downloading Anaconda
  6. \n", "\n", "\n", "
  7. Installation on Linux
  8. \n", "\n", "\n", "
  9. Installation on Windows
  10. \n", "\n", "\n", "
  11. Installation on Mac
  12. \n", "\n", "\n", "
  13. Spyder
  14. \n", "\n", "\n", "
  15. Getting Started: Variables and Arrays
  16. \n", "\n", "\n", "
  17. Matrix Operations
  18. \n", "\n", "\n", "
  19. Importing Data
  20. \n", "\n", "\n", "
  21. IPython
  22. \n", "\n", "\n", "
  23. IPython Notebooks
  24. \n", "\n", "
  25. Functions and Scripts
  26. \n", "\n", "
  27. References
  28. \n", "\n", "

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "

1. Introduction

Python is a very popular general-purpose language, with all the modern and classic constructs of a programming language that every software developer appreciates. This is what makes Python beneficial over MATLAB, besides the fact that it is not proprietary and various open source python distributions are freely and publicly available.\n", "\n", "\n", "However, the very fact that Python is a general purpose language and not a software specific to scientific computing may be considered a drawback of it, too. To address this problem, several scientific computing packages (i.e. sets of function,classes,...) have been developed and released for it so far. These packages contain a large variety of functions which can solve everyday computational problems of researchers in many fields of engineering and science.\n", "\n", "\n", "But the remaining problem is to find, install, maintain, manage updates and retain the consistency among all such packages as well as the Python system itself. This is where Anaconda comes in." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "

2. Anaconda

Anaconda is a completely free Python distribution (i.e. set of packages) for scientific purposes, as stated in their website. It contains more than 125 Python packages for science, mathematics, engineering and data analysis.\n", "\n", "Installing Anaconda will not only give you an out-of-the-box ready python system as well as a fully-featured IDE (Integrated Development Environment), but also it will release you from the burden of manually installing and taking care of dependency and consistency requirements between various packages." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

3. Downloading Anaconda

To download the Anaconda, you can simply go to the link http://continuum.io/downloads and download the zip file compatible with your system. The download page looks like this:\n", "\n", "\n", "\"window\"\n", "\n", "\n", "It may ask for your e-mail as well. Please note that the Python version Anaconda uses is Python 2.7.
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

4. Installation on Linux

Installing Anaconda is pretty simple. On Linux-based systems, all you need to do is running the following command.\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
bash Anaconda-1.x.x-Linux-x86[ 64].sh
\n", "\n", "
No root access is required. However, you will need to manually add Python executable files to your Path environment if you want to run them from every folder. This can be done by adding the following line of code to your ~/.bashrc file:\n", "\n", "\n", "\n", "\n", "
export PATH= /anaconda:$PATH
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

5. Installation on Windows

Installing Anaconda on Windows should be easy. It is automatically added to Path. In case of any prospective problem, disabling your anti-virus can be a potential solution.\n", "\n", "\"window\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

6. Installation on Mac

On MacOS,  all you need to do is running the graphical installer. Anaconda will be automatically added to your path. However, in some cases an error message may appear at the installation time which is not a big deal. You can simply click Install for me only and go on.\n", "\n", "\"window\"\n", "\n", "It seems to happens for older versions of OS X that the following error is generated when launching the ipython notebook (see section 12)\n", "
ValueError: unknown locale: UTF-8
\n", "\n", "In that case, run the command locale in the terminal and inspect the value of the environment variable LC_CTYPE. It is probably just UTF-8.\n", "\n", "Now open the file ~/.profile and add the following line\n", "
export LC_CTYPE='us_EN.UTF-8'\n", "
\n", "\n", "Then close the terminal session and try again. You might need to replace us_EN by a different value matching your system configuration." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

7. Spyder

Spyder is a popular and very handy GUI for Python which is integrated in Anaconda by default. It is very similar to MATLAB's GUI meaning that if you have already worked with MATLB, you will not get lost in spyder. You can run the spyder using the following command in your command line:.\n", "
spyder

\n", "\n", "\n", "\n", "\n", "When you run the command above, the following screen appears.\n", "\n", "\"window\"\n", "\n", "The Console window on the bottom right is where you type your commands and view possible results. The Object inspector window in top right shows the help manual available for functions you type in the console window. In the top bar of the application you can see and change your working directory. This is the default location in which spyder expects to find the files you read, the scripts you run,...  .
\n", "\n", "Finally, the Editor window in the left is where you create and edit your own functions.  We will talk about functions later in this tutorial.
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

8. Getting Started: Variables and Arrays

Variables are where you store your values and results of your operations. Despite some other programming languages, in Anaconda there is no need to define a variable or its type prior to using it. The most important variable type you will be working\n", "\n", "with is the array type. Please note the very important fact that in Python, indices of an array start from zero. This is in contrast to some other systems (the most notable of them is MATLAB) in which arrays and matrices are indexed starting from one.\n", "\n", "Initializing arrays is simple and can be done using the following commands, for example:\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "v1=[1,2,3,4]\n", "v2=[4,2,7,4]\n", "v3=[v1,v2]" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "You may or may not put semicolon at the end of the commands you type. \n", "\n", "The above commands create three arrays. The first two are four-element numerical arrays containing different numbers. The third one, v3, is known as an array of arrays, a multi-dimensional (here two-dimensional) array, or simply a matrix. v3 is a two-element\n", "\n", "array whose each element is a four-element array itself. Hence it is a $2\\times 4$ matrix. The default type of the elements in an array is integer, unless at least one of them is defined explicitly as a rational number (i.e. having a fractional part, such as $1.0$). \n", "\n", "Please note that hereafter, we use the terms \"matrix\" and \"array\" interchangeably since in Python and in the programming language community in general, a matrix is simply an array of arrays or a multi-dimensional array.\n", "\n", "To see the value of an array (or any variable in general), we can either simply write its name in the console:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "v2" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "[4, 2, 7, 4]" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "\n", "\n", "
or use the more elegant and more flexible print command:\n", "\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "print v2" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[4, 2, 7, 4]\n" ] } ], "prompt_number": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "\n", "
There are useful commands which facilitate creating and initializing matrices. Two of them are the function zeros and ones, which can create arbitrary arrays with values initialized to $0$ and $1$ respectively. Consider the following commands for example:\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%pylab inline\n", "z1=zeros(2)\n", "o1=ones((2,2))" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Populating the interactive namespace from numpy and matplotlib\n" ] } ], "prompt_number": 4 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first line creates a two-element array z1 with all elements initialized to $0$, whereas the second line creates a $2\\times 2$ matrix o1 with all elements initialized to $1$. \n", "\n", "Another useful group of functions are those which query about the structure or shape of an array, i.e. its number of elements and dimensions. The first one is shape which returns the number of elements in each dimension of an array (like MATLAB's size()).\n", "\n", "An example is the following line of code (assuming you have already executed the above commands in your current Anaconda session)," ] }, { "cell_type": "code", "collapsed": false, "input": [ " shape(v3)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 5, "text": [ "(2L, 4L)" ] } ], "prompt_number": 5 }, { "cell_type": "markdown", "metadata": {}, "source": [ "which outputs $(2L,4L)$ meaning that v3 is a $2\\times 4$ matrix. The letter $L$ in the output stands for \"long\", stating that size of an array is by default a long integer value.\n", "\n", "The second one is size which outputs the number of elements in the whole array/matrix or a specific dimension of it (This is partly similar to MATLAB's length(), not size(). Note the confusion). Consider executing the following lines of code (again assuming you have already executed the above commands in your current Anaconda session):" ] }, { "cell_type": "code", "collapsed": false, "input": [ "print size(v3,0)\n", "print size(v3,1)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "2\n", "4\n" ] } ], "prompt_number": 6 }, { "cell_type": "markdown", "metadata": {}, "source": [ "You will see the outputs $2$ and $4$ respectively. These are the number of elements in each column and row of v3, respectively. Equivalently, these are the number of rows and columns of v3. \n", "\n", "Please note that the following command leads to an error, since v3 has only two dimensions." ] }, { "cell_type": "code", "collapsed": false, "input": [ "size(v3,2)" ], "language": "python", "metadata": {}, "outputs": [ { "ename": "IndexError", "evalue": "tuple index out of range", "output_type": "pyerr", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0msize\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mv3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[1;32mE:\\Programs\\Anaconda\\lib\\site-packages\\numpy\\core\\fromnumeric.pyc\u001b[0m in \u001b[0;36msize\u001b[1;34m(a, axis)\u001b[0m\n\u001b[0;32m 2536\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2537\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mAttributeError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2538\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0masarray\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0maxis\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2539\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2540\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mIndexError\u001b[0m: tuple index out of range" ] } ], "prompt_number": 7 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

9. Matrix Operations

Many functions are provided to manipulate an array. Some useful ones are explained here.\n", "\n", "To flatten a multi-dimensional array into a single-dimensional vector, we use a combination of commands flatten and list. For example, the following line of code flattens the array v3 defined above:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "v4=list(flatten(v3))" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can see the output by typing \"v4\" in the Console window and viewing the output:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "v4" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 9, "text": [ "[1, 2, 3, 4, 4, 2, 7, 4]" ] } ], "prompt_number": 9 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The function transpose transposes v3, similar to MATLAB's transpose operator (single-quotation). This is shown below:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "v5=transpose(v3)\n", "print v5" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[[1 4]\n", " [2 2]\n", " [3 7]\n", " [4 4]]\n" ] } ], "prompt_number": 10 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The matrix multiplication and element-wise multiplication are performed using the commands dot and multiply, respectively:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "v6=dot(v3,v5)\n", "v7=multiply(v3,v3)\n", "print v6\n", "print v7" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[[30 45]\n", " [45 85]]\n", "[[ 1 4 9 16]\n", " [16 4 49 16]]\n" ] } ], "prompt_number": 11 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Please note that the summation operator \"+\" has a completely different meaning for arrays/matrices than for scalar numbers. The output of the following line of code for example, is the concatenation of the two vectors v1 and v2, rather than their element-wise summation one may guess." ] }, { "cell_type": "code", "collapsed": false, "input": [ "v1+v2" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 12, "text": [ "[1, 2, 3, 4, 4, 2, 7, 4]" ] } ], "prompt_number": 12 }, { "cell_type": "markdown", "metadata": {}, "source": [ "For element-wise summation, we should use the sum function. A few other useful functions are summarized in the table below. Please note that the division operator on integer values (which are default values in Python) acts as the modulo operator. That means 2/4 outputs $0$ for example. But 2.0/4 outputs $0.5$.\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", " \n", "\n", "
add\n", "\n", " Addition
subtract\n", "\n", " Subtraction
dot\n", "\n", " Matrix multiplication
multiply\n", "\n", " Element-wise multiplication
divide\n", "\n", " Element-wise division
np.power\n", "\n", " Element-wise power
\n", "\n", "\n", "\n", "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

10. Importing Data

Various commands provide means to import data in different formats and various modalities. A few of them are explained here.\n", "\n", "\n", "
To read the data stored in an ASCII text file, the function loadtxt is used. The following piece of code, for example:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "v11=loadtxt('data.txt')\n", "print v11" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[[ 1. 3. 5.]\n", " [ 2. 4. 6.]]\n" ] } ], "prompt_number": 14 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "Reads the data in the file data.txt into the matrix v11 and prints the matrix. Each line of the text file is stored in a row of v11. \n", "\n", "Values in a line are assumed to be separated by white spaces by default. To change this, for example in the case of comma-separated CSV files, we use the following form:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "v12=loadtxt('data.csv',delimiter=',')\n", "print v12" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[[ 0. 3. 6.]\n", " [ 1. 5. 8.]]\n" ] } ], "prompt_number": 15 }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also import data from MATLAB's specific .mat files. This can be done using the following lines of code:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import scipy.io as sio\n", "sio.loadmat('matlab.mat')" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 16, "text": [ "{'M': array([[-1.79467884, -0.19412354, -1.20784549, -2.0518163 , -0.29906603,\n", " 0.96422942, -0.58902903, 0.79141606, 0.86202161, -0.06786555],\n", " [ 0.84037553, -2.13835527, 2.90800803, -0.35385 , 0.02288979,\n", " 0.5200601 , -0.2937536 , -1.33200442, -1.36169447, -0.1952212 ],\n", " [-0.88803208, -0.83958875, 0.82521889, -0.82358653, -0.26199543,\n", " -0.02002785, -0.84792624, -2.32986716, 0.45502956, -0.21760635],\n", " [ 0.10009283, 1.35459433, 1.37897198, -1.57705702, -1.75021237,\n", " -0.03477109, -1.1201283 , -1.44909729, -0.84870938, -0.30310762],\n", " [-0.54452893, -1.07215529, -1.05818026, 0.50797465, -0.28565097,\n", " -0.79816358, 2.52599969, 0.33351083, -0.33488694, 0.02304562],\n", " [ 0.30352079, 0.96095387, -0.46861558, 0.28198406, -0.83136651,\n", " 1.01868528, 1.65549759, 0.3913536 , 0.55278335, 0.05129036],\n", " [-0.60032656, 0.1240498 , -0.27246941, 0.03347988, -0.97920631,\n", " -0.13321748, 0.30753516, 0.45167942, 1.03909065, 0.82606279],\n", " [ 0.48996532, 1.43669662, 1.09842462, -1.33367794, -1.15640166,\n", " -0.71453016, -1.25711836, -0.13028465, -1.11763868, 1.52697669],\n", " [ 0.73936312, -1.9609 , -0.27787193, 1.12749228, -0.53355711,\n", " 1.35138577, -0.86546803, 0.1836891 , 1.26065871, 0.46691444],\n", " [ 1.71188778, -0.19769823, 0.70154146, 0.35017941, -2.00263574,\n", " -0.22477106, -0.17653411, -0.47615302, 0.66014314, -0.20971334]]),\n", " 'N': array([[ 0.81472369, 0.15761308, 0.6557407 , 0.70604609, 0.43874436,\n", " 0.27602508, 0.75126706, 0.84071726, 0.35165951, 0.07585429],\n", " [ 0.90579194, 0.97059278, 0.03571168, 0.03183285, 0.38155846,\n", " 0.67970268, 0.25509512, 0.25428218, 0.83082863, 0.05395012],\n", " [ 0.12698682, 0.95716695, 0.84912931, 0.27692298, 0.76551679,\n", " 0.655098 , 0.50595705, 0.81428483, 0.58526409, 0.53079755],\n", " [ 0.91337586, 0.48537565, 0.93399325, 0.04617139, 0.7951999 ,\n", " 0.16261174, 0.69907672, 0.24352497, 0.54972361, 0.77916723],\n", " [ 0.63235925, 0.80028047, 0.67873515, 0.09713178, 0.1868726 ,\n", " 0.11899768, 0.89090325, 0.92926362, 0.91719366, 0.93401068],\n", " [ 0.0975404 , 0.14188634, 0.75774013, 0.82345783, 0.4897644 ,\n", " 0.49836405, 0.95929143, 0.34998377, 0.28583902, 0.12990621],\n", " [ 0.27849822, 0.42176128, 0.74313247, 0.69482862, 0.4455862 ,\n", " 0.95974396, 0.54721553, 0.19659525, 0.75720023, 0.56882366],\n", " [ 0.54688152, 0.91573553, 0.39222702, 0.31709948, 0.64631301,\n", " 0.34038573, 0.13862444, 0.25108386, 0.75372909, 0.46939064],\n", " [ 0.95750684, 0.79220733, 0.65547789, 0.95022205, 0.70936483,\n", " 0.58526775, 0.14929401, 0.61604468, 0.38044585, 0.01190207],\n", " [ 0.96488854, 0.95949243, 0.17118669, 0.03444608, 0.75468668,\n", " 0.22381194, 0.25750825, 0.47328885, 0.56782164, 0.33712264]]),\n", " '__globals__': [],\n", " '__header__': 'MATLAB 5.0 MAT-file, Platform: PCWIN64, Created on: Tue Apr 22 00:06:25 2014',\n", " '__version__': '1.0'}" ] } ], "prompt_number": 16 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first line is required since the package containing the loadmat function is not loaded by default when spyder is started. So we need to import it manually. \n", "\n", "Finally, to load an image into the spyder environment, the function imread is used:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "I=imread('David.bmp')\n", "print shape(I)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(96L, 96L, 4L)\n" ] } ], "prompt_number": 17 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The command in the first line is used to read the image David.bmp into a matrix, here I. Supported formats may vary depending on the device and the operating system. The second line prints the size and the number of color channels of the image." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

11. IPython

IPython is an interactive shell for Python which offers much more functionality then the default Python command line. These vary from more direct operating system support (e.g. for manipulation of data files, interacting with external processes, ...) to logged system state (i.e. storing results of all operations performed so far). IPython is installed by Anaconda and can be used as an alternative to the default spyder Console, although some of its properties exist there too. \n", "\n", "To run IPython you should type the following command in the command prompt of your operating system:\n", "\n", "
\n", "\n", "\n", "\n", " ipython\n", "\n", "\n", "\n", "
\n", "\n", "
You will see a prompt as In [1]. This means that it is your first command. When you run something, the result is shown in an output line starting with Out [1]. As you go on and execute more commands, the number increases. You can always refer to the output of the command in line $n$ simply by the variable named $\\_n$ (where $n$ is replaced by the command number). This is a very useful property of the IPython.\n", "\n", "One other feature of IPython is its more direct connection to the underlying operating system. By preceding the character \"!\" in front of a command line, that line is passed to the operating system to be executed directly. You will find this specially useful when you want to run OS commands or execute external files from within Python. As an example, consider the following code:\n", "\n", "
\n", "\n", " !vlc test.avi\n", "\n", "
\n", "\n", "
This will try to execute the vlc media player from the operating system. More information about IPython and its features can be found in this paper. \n", "\n", "In recent versions of the IPython, a very interesting feature has been added to it, called the IPython notebooks. We will talk about these in the next section. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

12. IPython Notebooks

IPython notebooks are very interesting novel features added to recent versions of IPython. Notebooks are interactive documents that allow running Python code and reading (or writing) notes and documentations in the same place. Therefore, one can not only see the results he is reading about, but also can produce different results by changing the documented code.

A notebook is actually an extended HTML file which contains specific markup to distinguish Python codes inside the page. When displayed using a custom web server, it allows interactive execution and editing of the code inside the document. However, it can also be viewed as a usual, nicely-formatted HTML page. The document you are currently reading is itself an IPython notebook.\n", "\n", "The command to run the IPython Notebooks web server is the following:\n", "\n", "
ipython notebook
\n", "\n", "\n", "
When you execute the command above, a new browser window is opened which shows the notebooks in the current folder. The IPython notebook files have the \".ipynb\" extension.\n", "\n", "There are a lot of notebooks available on the web which you can see and read. The GitHub repository available in here contains many useful and interesting ones. The source code of these notebooks is also available through the GitHub version control system. \n", " \n", "Another interesting source is the book \"Python For Signal Processing\" which is publicly available as a series of IPython notebooks available at this address.
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

13. Functions and Scripts

\n", "You can define your own functions and scripts in Python as well. We start with scripts here.\n", "\n", "You can create, edit, save and execute your scripts through the Editor panel in the left side of the spyder window. A script can be any pice of code that you may want to run together and more than once. For example, the following code draws 1000 random samples from the standard Gaussian distribution and plots a histogram of them. You can verify the statistical distribution of the samples by looking at the histogram." ] }, { "cell_type": "code", "collapsed": false, "input": [ "x = randn(10000);\n", "hist(x, 100);" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEACAYAAABMEua6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGTNJREFUeJzt3X9MVff9x/HXpdA/DNBKHRfHdbmd4PD6g3tjA8syt+sU\nzeYgdjZ0MC3fqf+02ZLWZrV26YpLFNxmGu1i0iy2Y2mmc38USKOG2vR2ncuCrZJsoSm2wRUuP6JD\nFGodCOf7B+UCwv0B3HvPvYfnIzE53nt+vEXuizef8znn2AzDMAQAsIQUswsAAEQPoQ4AFkKoA4CF\nEOoAYCGEOgBYCKEOABYSMtTv3Lmj4uJiud1uuVwu7d+/X5LU19enkpISrVixQps3b1Z/f39gm5qa\nGuXn56ugoEBNTU2xrR4AMIUt3Dz127dva9GiRbp7966+/e1v63e/+50aGxu1ZMkSPffcczp8+LBu\n3Lih2tpatba2qrKyUhcvXpTf79emTZvU1tamlBR+IQCAeAibtosWLZIkDQ0NaWRkRIsXL1ZjY6Oq\nqqokSVVVVaqvr5ckNTQ0qKKiQmlpaXI6ncrLy1Nzc3MMywcATBY21EdHR+V2u2W327VhwwatWrVK\nvb29stvtkiS73a7e3l5JUldXlxwOR2Bbh8Mhv98fo9IBAPdKDbdCSkqKWlpadPPmTW3ZskXvvvvu\nlPdtNptsNlvQ7UO9BwCIrrChPu6BBx7Q1q1b9eGHH8put6unp0c5OTnq7u5Wdna2JCk3N1cdHR2B\nbTo7O5WbmzttX3l5efr000+jUD4ALBzLly/XJ598EnKdkMMv169fD8xs+eKLL/T222/L4/GorKxM\ndXV1kqS6ujpt27ZNklRWVqZTp05paGhI7e3tunLlioqKiqbt99NPP5VhGAn/56WXXjK9BqvUmYg1\njjG+/KO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Y+fOncbTTz9tdilBXbt2zbhx44ZhGIZx+/ZtY/369cb58+dNrio0n89n/PCHPwy5jukPyUjkX3v3\n79+vNWvWyO12y+fz6ciRI2aXNKOf//znGhwcVElJiTwej5566imzS5rRm2++qWXLlumf//yntm7d\nqu9///tmlxQw+aI5l8ulxx9/PCEvmquoqNC3vvUttbW1admyZaYNB4Zz4cIFvfHGG3r33Xfl8Xjk\n8Xh07tw5s8uaoru7W9/73vfkdrtVXFys0tJSbdy40eyywgqXmVx8BAAWYnqnDgCIHkIdACyEUAcA\nCyHUAcBCCHUAsBBCHQAshFAHAAsh1AHAQv4f/3UVEQ9ITi8AAAAASUVORK5CYII=\n", "text": [ "" ] } ], "prompt_number": 18 }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "To save the above code as a script, you should first create a new file using the menu item \"File> New File\", type your script in the file and then save it with your preferred name. the default folder to save the scripts is your working folder we talked about earlier. You can then execute the script by clicking the green play button in the toolbar. This runs the currently open script.\n", "\n", "Looking at the console, you will notice that clicking the play button is equivalent to running the following function in console:\n", "\n", "
\n", "runfile('C:/Users/mrazavi/Documents/Python Scripts/untitled1.py', wdir=r'C:/Users/mrazavi/Documents/Python Scripts')\n", "
\n", "\n", "
The first argument is the script file and the second one is the working directory.\n", "\n", "You can also define your own functions in a script. Functions are defined by a starting def command. Consider the following code for example:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "def celsius_to_fahrenheit(c_temp):\n", " return 9.0 / 5.0 * c_temp + 32\n", "print celsius_to_fahrenheit(0)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "32.0\n" ] } ], "prompt_number": 30 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The code above first defines a function which receives a degree in Celsius and returns its Fahrenheit equivalent. Then it prints the result of applying the function to the value $0$.\n", "\n", "After the first time you run the script containing a function, it is added to the current spyder session meaning that you can later run it independently from the console. However, if you change the function, you should run the scripts for the changes to take effect." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

14. References

There is a lot of documentation available on the web, both about Anaconda and its packages and also about Python itself. A few of them are listed below.\n", "\n", "\n", "" ] } ], "metadata": {} } ] }