{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lesson 8 - Tricks and Tips" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here we give a list of short and useful tips" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## \"Automatic\" Reshaping" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To change the dimensions of an array, you can omit one of the sizes which will\n", "then be deduced automatically:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "a = np.arange(30)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,\n", " 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29])" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "a.shape = 2,-1,3 # -1 means \"whatever is needed\"" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([[[ 0, 1, 2],\n", " [ 3, 4, 5],\n", " [ 6, 7, 8],\n", " [ 9, 10, 11],\n", " [12, 13, 14]],\n", "\n", " [[15, 16, 17],\n", " [18, 19, 20],\n", " [21, 22, 23],\n", " [24, 25, 26],\n", " [27, 28, 29]]])" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(2L, 5L, 3L)" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Vector Stacking" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "How do we construct a 2D array from a list of equally-sized row vectors? In\n", "MATLAB this is quite easy: if x and y are two vectors of the same length you only need do m=[x;y]. In NumPy this works via the functions column_stack, dstack, hstack and vstack, depending on the dimension in which the stacking is to be done. For example:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "x = np.arange(0,10,2) # x = ([0,2,4,6,8])\n", "y = np.arange(5) # y = ([0,1,2,3,4])\n", "m = np.vstack([x,y]) # m = ([[0,2,4,6,8],\n", " # [0,1,2,3,4]])\n", "xy = np.hstack([x,y]) # xy = ([0,2,4,6,8,0,1,2,3,4])" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([0, 2, 4, 6, 8])" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([0, 1, 2, 3, 4])" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "y" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([[0, 2, 4, 6, 8],\n", " [0, 1, 2, 3, 4]])" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([0, 2, 4, 6, 8, 0, 1, 2, 3, 4])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Histograms" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The NumPy histogram function applied to an array returns a pair of vectors: the\n", "histogram of the array and the vector of bins. Beware: matplotlib also has a\n", "function to build histograms (called hist, as in Matlab) that differs from the one in NumPy. The main difference is that pylab.hist plots the histogram automatically, while numpy.histogram only generates the data." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note: see [this post](http://nbviewer.ipython.org/github/htapia/scientific-python-lectures/blob/master/Lecture-4-Matplotlib.ipynb) for information on displaying plots inline within the IPython Notebook." ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Populating the interactive namespace from numpy and matplotlib\n" ] } ], "source": [ "# This line configures matplotlib to show figures embedded in the notebook, \n", "# instead of opening a new window for each figure. More about that later. \n", "%pylab inline" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pylab" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Build a vector of 10000 normal deviates with variance 0.5^2 and mean 2\n", "mu, sigma = 2, 0.5\n", "v = np.random.normal(mu,sigma,10000)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(array([ 0.01022988, 0.01169129, 0.0131527 , 0.01607552, 0.01899834,\n", " 0.0263054 , 0.04384233, 0.07014773, 0.09791454, 0.10522159,\n", " 0.12714276, 0.17683073, 0.1987519 , 0.28205232, 0.34197017,\n", " 0.39604238, 0.47349716, 0.5319536 , 0.61233121, 0.69855445,\n", " 0.73655114, 0.71170715, 0.76577936, 0.84031132, 0.76577936,\n", " 0.74531961, 0.81546733, 0.71170715, 0.63279096, 0.5845644 ,\n", " 0.53049219, 0.42965483, 0.45888305, 0.39019674, 0.29082079,\n", " 0.2396714 , 0.17390791, 0.13444981, 0.10814441, 0.08330043,\n", " 0.05407221, 0.04676515, 0.0394581 , 0.02776681, 0.01899834,\n", " 0.01022988, 0.00292282, 0.01022988, 0. , 0.00146141]),\n", " array([ 0.34679319, 0.41522021, 0.48364723, 0.55207425, 0.62050127,\n", " 0.6889283 , 0.75735532, 0.82578234, 0.89420936, 0.96263638,\n", " 1.0310634 , 1.09949042, 1.16791744, 1.23634446, 1.30477148,\n", " 1.3731985 , 1.44162552, 1.51005254, 1.57847956, 1.64690658,\n", " 1.7153336 , 1.78376062, 1.85218764, 1.92061466, 1.98904169,\n", " 2.05746871, 2.12589573, 2.19432275, 2.26274977, 2.33117679,\n", " 2.39960381, 2.46803083, 2.53645785, 2.60488487, 2.67331189,\n", " 2.74173891, 2.81016593, 2.87859295, 2.94701997, 3.01544699,\n", " 3.08387401, 3.15230103, 3.22072805, 3.28915508, 3.3575821 ,\n", " 3.42600912, 3.49443614, 3.56286316, 3.63129018, 3.6997172 ,\n", " 3.76814422]),\n", " )" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFJVJREFUeJzt3X+sXOld3/H3J3fXhW1IlnTRpngvuAI33a2aENo6VSDh\nQhZhIhpHFLExpVELAgvJBNRfLhGqXSFa+ItfK4Kbmh+lVayKQDDqbixaMi1FybJuvJuEXK9sEqu2\n0waSQJSQAHb32z9mvJ0dz48zc2fuzJz7fkmjzJnz+Mw3z9753OeeOed5UlVIktrlBcsuQJI0f4a7\nJLWQ4S5JLWS4S1ILGe6S1EKGuyS10MRwT3I4yaUkl5OcGLL/i5P8WpKnkzyR5K8vplRJUlNjwz3J\nBvAocBh4CDia5MGBZm8F3l9VrwDeDPzUIgqVJDU3aeR+CLhSVVer6iZwFjgy0OZB4D0AVfUMcCDJ\nl8y9UklSY5PCfT9wrW/7eu+1fk8D3wqQ5BDw5cAD8ypQkjS9SeHeZG6CHwPuTXIROA5cBP7vTguT\nJM3urgn7bwCbfdubdEfvz6mqzwDfdXs7yUeBjwweKImT2EjSDKoqs/yjkQ+64f/7wAFgH/AU8OBA\nmxcD+3rPvwf4xRHHqnHvtSoP4NSya7BOa7RO6+yrs2b5d2NH7lV1K8lx4DywAZypqu0kx3r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zqBbwO+L8kt4HN0O31XJXkH8HXAfUmu0Z3V7O7bNa5CX06qkRXo\nx56vAb4T+ECS2x/utwJfBqvTn03qZDX69C8Dv5TkBXQHib9cVf911T7rTepkNfqzXwHstC+9iUmS\nWsgFsiWphQx3SWohw12SWshwl6QWMtwlqYUMd0lqIcNdklrIcJekFvp/oXXpMm0ONBMAAAAASUVO\nRK5CYII=\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plot a normalized histogram with 50 bins\n", "pylab.hist(v, bins=50, normed=1) # matplotlib version (plot)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": true }, "outputs": [], "source": [ "pylab.show()" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Compute the histogram with numpy and then plot it\n", "(n, bins) = numpy.histogram(v, bins=50, normed=True) # NumPy version (no plot)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcXFWd9/HPl0BkE1kHnNAQ1IiAsrgERJCWNYQlgCwG\nxUEWIxgGH5yZOD4omfFBx5nHB1nUAWVReTTgAkQEIgiNLAEJhE0STIAgCbIJRmWRRH7zx70dKpXu\nrurqqjq3bn3fr1e/qFv35PaXm/Svb5177jmKCMzMrFxWSx3AzMyaz8XdzKyEXNzNzErIxd3MrIRc\n3M3MSsjF3cyshGoWd0kTJM2XtEDStAH2byDpCkn3SbpT0natiWpmZvUasrhLGgWcB0wAtgUmS9qm\nqtnngXsiYgfg48DZrQhqZmb1q3XlPh5YGBGLImIZMAOYVNVmG+AmgIh4GBgraZOmJzUzs7rVKu5j\ngCcqthfn71W6Dzg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z\ntJ/1enJSjPNZKQBGei79EJOZWQl5gWwzsxJycTczKyEXdzOzEnJxNzMrIRd3M7MScnE3MyshF3cz\nsxJycTczK6H/AUVqeX+xJGuZAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pylab.plot(.5*(bins[1:]+bins[:-1]), n)" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": true }, "outputs": [], "source": [ "pylab.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Conclusion" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We have now completed lesson 8 Tricks and Tips." ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }