# HG changeset patch # User Puneeth Chaganti # Date 1288164353 -19800 # Node ID 35fc94bf76736820f4499c91f6b93a4021a2652b # Parent 284170f2c12ef266ed8bfa9a8a9a265999d213bb# Parent 68ec23cfef499d23ed5a1ae0370a4d342e42af7e Merged Heads. diff -r 68ec23cfef49 -r 35fc94bf7673 dictionaries/script.rst --- a/dictionaries/script.rst Tue Oct 26 16:19:36 2010 +0530 +++ b/dictionaries/script.rst Wed Oct 27 12:55:53 2010 +0530 @@ -6,9 +6,9 @@ .. 1. Create dictionaries .. #. Add data to dictionaries .. #. Retrieve data -.. #. Familiarize using ``.keys()`` and ``.values()`` methods -.. #. Checking for container-ship of keys -.. #. Iterating over elements +.. #. use ``.keys()`` and ``.values()`` methods +.. #. Check for container-ship of keys +.. #. Iterate over elements .. Prerequisites .. ------------- @@ -22,6 +22,7 @@ External Reviewer : Checklist OK? : [2010-10-05] +.. #[Puneeth: Quickref] ============ Dictionaries @@ -49,6 +50,8 @@ Before we can proceed, start your IPython interpreter with the ``-pylab`` option. +.. #[Puneeth: We don't need pylab] + {{{ start ipython interpreter by issuing command ipython -pylab }}} {{{ switch to next slide, Creating dictionary }}} @@ -59,11 +62,11 @@ mt_dict = {} -Notice that unlike lists curly braces are used define ``dictionary``, +Notice that unlike lists, curly braces are used define ``dictionary``. {{{ move the mouse over curly braces to grab attention }}} -Now let us see how to create a filled dictionary, +Now let us see how to create a non-empty dictionary, :: extensions = {'jpg' : 'JPEG Image', 'py' : 'Python script', 'html' : 'Html document', 'pdf' : 'Portable Document Format'} @@ -146,10 +149,9 @@ 'py' in extensions 'odt' in extensions -So in short it will return ``True`` if the key is found in the -dictionary, and will return ``False`` if key is not present. Note that -we can check only for container-ship of keys in dictionaries and not -values. +It will return ``True`` if the key is found in the dictionary, and +will return ``False`` if key is not present. Note that we can check +only for container-ship of keys in dictionaries and not values. {{{ switch to next slide, Retrieve keys and values }}} diff -r 68ec23cfef49 -r 35fc94bf7673 other-type-of-plots/script.rst --- a/other-type-of-plots/script.rst Tue Oct 26 16:19:36 2010 +0530 +++ b/other-type-of-plots/script.rst Wed Oct 27 12:55:53 2010 +0530 @@ -22,6 +22,7 @@ External Reviewer : Checklist OK? : [2010-10-05] +.. #[Puneeth: Quickref missing] =================== Other type of plots @@ -31,12 +32,21 @@ Hello and welcome to the tutorial other type of plots. +.. #[Puneeth: this sentence doesn't read well] + {{{ show the outline slide }}} +.. #[Puneeth: motivate looking at other plots. Why are we looking at +.. them? Tell that we have only looked at one type of plot all the +.. while, etc.] + In this tutorial we will cover scatter plot, pie chart, bar chart and -loglog plot. We will also see few other plots and also introduce you to +log-log plot. We will also see few other plots and also introduce you to the matplotlib help. +.. #[Puneeth: cover, see and introduce you. be consistent. does, the +.. "We" include the viewer or not?] + Let us start with scatter plot. {{{ switch to the next slide, scatter plot }}} @@ -47,8 +57,7 @@ position on the vertical axis. This kind of plot is also called a scatter chart, scatter diagram and scatter graph. -Before we proceed further get your IPython interpreter running with -the ``-pylab`` option. Start your IPython interpreter as +Before we proceed further, start your IPython interpreter :: ipython -pylab @@ -59,9 +68,9 @@ {{{ switch to the next slide having the problem statement of first exercise }}} -Now, let us plot a scatter plot showing the percentage profit of company A -from the year 2000-2010. The data for the same is available in the -file ``company-a-data.txt``. +Now, let us plot a scatter plot showing the percentage profit of +company A from the year 2000-2010. The data for the same is available +in the file ``company-a-data.txt``. {{{ open the file company-a-data.txt and show the content }}} @@ -78,6 +87,9 @@ year,profit = loadtxt('/home/fossee/other-plot/company-a-data.txt',dtype=type(int())) +.. #[Puneeth: make a remark about dtype, that has not been covered in +.. the loadtxt tutorial.] + {{{ switch to next slide, ``scatter`` function }}} Now in-order to generate the scatter graph we will use the function @@ -104,6 +116,9 @@ Now let us move on to pie chart. +.. #[Puneeth: instead of just saying that, say that let's plot a pie +.. chart for the same data. continuity, will be good.] + {{{ switch to the slide which says about pie chart }}} A pie chart or a circle graph is a circular chart divided into @@ -116,6 +131,8 @@ the same data from file ``company-a-data.txt``. So let us reuse the data we have loaded from the file previously. +.. #[Puneeth, this part can be move above.] + {{{ switch to next slide, ``pie()`` function }}} We can plot the pie chart using the function ``pie()``. @@ -192,7 +209,7 @@ Plot a `log-log` chart of y=5*x\ :sup:`3` for x from 1-20. Before we actually plot let us calculate the points needed for -that. And it could be done as, +that. :: x = linspace(1,20,100) diff -r 68ec23cfef49 -r 35fc94bf7673 progress.org --- a/progress.org Tue Oct 26 16:19:36 2010 +0530 +++ b/progress.org Wed Oct 27 12:55:53 2010 +0530 @@ -1,16 +1,16 @@ | S.No | Name | Units | Author | Review | Checklist | |---------+----------------------------------------+-------+----------+---------------------------------------+-----------| -| 1.2 LO: | getting started with =ipython= | 2 | Punch | Anoop (Done) | | +| 1.2 LO: | getting started with =ipython= | 2 | Punch | Pending | | | 1.3 LO: | using the =plot= command interactively | 2 | Amit | | | | 1.4 LO: | embellishing a plot | 2 | Nishanth | Anoop (Done) | | -| 1.5 LO: | saving plots | 2 | Anoop | | | +| 1.5 LO: | saving plots | 2 | Anoop | Punch (Done) | | | 1.6 LO: | multiple plots | 3 | Madhu | Nishanth (Done) | | | 1.7 LO: | additional features of IPython | 2 | Nishanth | Amit (Pending) | | | 1.8 LO: | module level assessment | 3 | Madhu | | | |---------+----------------------------------------+-------+----------+---------------------------------------+-----------| | 2.2 LO: | loading data from files | 3 | Punch | Nishanth (Done) | | | 2.3 LO: | plotting the data | 3 | Amit | | | -| 2.4 LO: | other types of plots | 3 | Anoop | Pending | | +| 2.4 LO: | other types of plots | 3 | Anoop | Punch (Done) | | | 2.5 LO: | module level assessment | 3 | Nishanth | | | |---------+----------------------------------------+-------+----------+---------------------------------------+-----------| | 3.1 LO: | getting started with lists | 2 | Amit | | | @@ -22,34 +22,33 @@ | 3.7 LO: | module level assessment | 3 | Madhu | | | |---------+----------------------------------------+-------+----------+---------------------------------------+-----------| | 4.1 LO: | getting started with arrays | 2 | Anoop | Punch (Done) | | -| 4.2 LO: | accessing parts of arrays | 4 | Punch | Anoop (Done) | | +| 4.2 LO: | accessing parts of arrays | 4 | Punch | Pending | | | 4.3 LO: | Matrices | 3 | Anoop | Punch (changes before further review) | | | 4.4 LO: | Least square fit | 2 | Nishanth | Punch (Done) | | | 4.5 LO: | Assessment | 3 | Punch | | | |---------+----------------------------------------+-------+----------+---------------------------------------+-----------| | 5.1 LO: | getting started with sage notebook | 3 | Madhu | | | | 5.2 LO: | getting started with symbolics | 3 | Amit | | | -| 5.3 LO: | using Sage | 4 | Punch | Anoop (Pending) | | +| 5.3 LO: | using Sage | 4 | Punch | Pending | | | 5.4 LO: | using sage to teach | 3 | Nishanth | | | | 5.5 LO: | Assessment | 3 | Anoop | | | |---------+----------------------------------------+-------+----------+---------------------------------------+-----------| | 6.1 LO: | basic datatypes & operators | 4 | Amit | Punch (Done) | | | 6.2 LO: | I/O | 1 | Nishanth | | | | 6.3 LO: | conditionals | 2 | Madhu | | | -| 6.4 LO: | loops | 2 | Puneeth | Anoop(Pending) | | +| 6.4 LO: | loops | 2 | Puneeth | | | | 6.5 LO: | Assessment | 3 | Anoop | | | |---------+----------------------------------------+-------+----------+---------------------------------------+-----------| | 7.1 LO: | manipulating lists | 3 | Madhu | | | -| 7.2 LO: | manipulating strings | 2 | Punch | Anoop (Pending) | | -| 7.2 LO: | manipulating strings | 2 | Punch | Anoop (Pending) | | +| 7.2 LO: | manipulating strings | 2 | Punch | Pending | | | 7.3 LO: | getting started with tuples | 2 | Nishanth | | | -| 7.4 LO: | dictionaries | 2 | Anoop | Pending | | +| 7.4 LO: | dictionaries | 2 | Anoop | Punch (Pending) | | | 7.5 LO: | sets | 2 | Nishanth | | | | 7.6 LO: | Assessment | 3 | Amit | | | |---------+----------------------------------------+-------+----------+---------------------------------------+-----------| | 8.1 LO: | getting started with functions | 3 | Nishanth | | | -| 8.2 LO: | advanced features of functions | 3 | Punch | Anoop (Pending) | | -| 8.3 LO: | using python modules | 3 | Anoop | Pending | | +| 8.2 LO: | advanced features of functions | 3 | Punch | Pending | | +| 8.3 LO: | using python modules | 3 | Anoop | Punch (Pending) | | | 8.4 LO: | writing python scripts | 2 | Nishanth | | | | 8.5 LO: | testing and debugging | 2 | Amit | | | | 8.6 LO: | Assessment | 3 | Madhu | | | diff -r 68ec23cfef49 -r 35fc94bf7673 savefig/questions.rst --- a/savefig/questions.rst Tue Oct 26 16:19:36 2010 +0530 +++ b/savefig/questions.rst Wed Oct 27 12:55:53 2010 +0530 @@ -102,6 +102,9 @@ Answer: Save the sine plot in file sine.png as a pdf file in page-size A4 and saves it into the current working directory +.. #[Puneeth: Good questions, but can we use it in quiz? most of it +.. has not been taught in the tutorial.] + Larger Questions ---------------- @@ -116,3 +119,5 @@ points. Title the plot as 'Tan plot' and the legend plot with 'tan(x)'. And save the plot as a svg file with the filename tangent_plot. + + diff -r 68ec23cfef49 -r 35fc94bf7673 savefig/script.rst --- a/savefig/script.rst Tue Oct 26 16:19:36 2010 +0530 +++ b/savefig/script.rst Wed Oct 27 12:55:53 2010 +0530 @@ -3,8 +3,8 @@ .. At the end of this tutorial, you will be able to -.. 1. Saving plots using ``savefig()`` function. -.. #. Saving plots in different formats. +.. 1. Save plots using ``savefig()`` function. +.. #. Save plots in different formats. .. Prerequisites @@ -19,6 +19,7 @@ External Reviewer : Checklist OK? : [2010-10-05] +.. #[Puneeth: Quickref missing.] ======= Savefig @@ -30,8 +31,10 @@ {{{ switch to next slide, outline slide }}} -In this tutorial you will learn how to save plots using Python. And -saving in different formats, and locating the file in the file system. +In this tutorial you will learn how to save plots using Python, saving +in different formats, and locating the file in the file system. + +.. #[Puneeth: file-system is too technical.] {{{ switch to next slide, a sine wave}}} @@ -39,8 +42,8 @@ ipython -pylab -It will start your IPython interpreter with the required python -modules for plotting and saving your plots. +As you know, it will start your IPython interpreter with the required +python modules for plotting and saving your plots. {{{ Open ipython }}} @@ -61,6 +64,10 @@ the plot for future use so that you can embed the plot in your reports. +.. #[Puneeth: All this is known stuff. You don't have to elaborate so +.. much on it. Just say, let us plot sin function from -3 pi to 3 +.. pi. Show the commands, and be done with it. ] + {{{ switch to next slide, savefig() }}} {{{ Switch the focus to IPython interpreter window }}} @@ -70,10 +77,12 @@ savefig('/home/fossee/sine.png') -Notice that ``savefig`` function takes one argument which is a string -which is the filename. The last 3 characters after the ``.`` in the -filename is the extension or type of the file which determines the -format in which you want to save. +Notice that ``savefig`` function takes one argument which is the +filename. The last 3 characters after the ``.`` in the filename is the +extension or type of the file which determines the format in which you +want to save. + +.. #[Puneeth: removed mention of string] {{{ Highlight the /home/fossee part using mouse movements }}} diff -r 68ec23cfef49 -r 35fc94bf7673 using python modules/script.rst --- a/using python modules/script.rst Tue Oct 26 16:19:36 2010 +0530 +++ b/using python modules/script.rst Wed Oct 27 12:55:53 2010 +0530 @@ -36,6 +36,8 @@ line, importing modules, importing scipy and pylab modules. And also see the Python standard library. +.. #[Punch: the sentence seems discontinuous.] + {{{ switch to next slide on executing python scripts from command line }}} Let us create a simple python script to print hello world. Open your @@ -121,8 +123,8 @@ python four_plot.py -Now it gave another error plot not defined, let us edit the file again -and add the line below the line we just added, +Now it gave another error -- plot not defined, let us edit the file +again and add the line below the line we just added, {{{ switch to next slide, fix ``plot`` problem }}} @@ -154,7 +156,7 @@ from scipy import * So in practice it is always good to use function names instead of -asterisk or star. As if we use asterisk to import from a particular +asterisk or star. If we use asterisk to import from a particular module then it will replace any existing functions with the same name in our name-space. @@ -208,8 +210,8 @@ {{{ switch to next slide, What is a module? }}} -So till now we have been learning about importing modules, now what is -a module? +Until now we have been learning about importing modules, now what is a +module? A module is simply a file containing Python definitions and statements. Definitions from a module can be imported into other @@ -217,10 +219,9 @@ {{{ switch to next slide, Python standard library }}} -Python has a very rich standard library of modules - -Python's standard library is very extensive, offering a wide range of -facilities. Some of the standard modules are, +Python has a very rich standard library of modules. It is very +extensive, offering a wide range of facilities. Some of the standard +modules are, for Math: math, random for Internet access: urllib2, smtplib