diff options
-rw-r--r-- | embellishing_a_plot/slides.org | 16 | ||||
-rw-r--r-- | embellishing_a_plot/slides.tex | 32 | ||||
-rw-r--r-- | loading_data_from_files/script.rst | 194 | ||||
-rw-r--r-- | loading_data_from_files/slides.org | 74 | ||||
-rw-r--r-- | loading_data_from_files/slides.tex | 97 | ||||
-rw-r--r-- | plotting_data/script.rst | 228 | ||||
-rw-r--r-- | plotting_data/slides.org | 191 | ||||
-rw-r--r-- | plotting_data/slides.tex | 261 |
8 files changed, 574 insertions, 519 deletions
diff --git a/embellishing_a_plot/slides.org b/embellishing_a_plot/slides.org index cbf5e01..b51dae0 100644 --- a/embellishing_a_plot/slides.org +++ b/embellishing_a_plot/slides.org @@ -74,6 +74,22 @@ MHRD, Govt. of India + Label x and y axes + Add annotations + Set the limits of axes +* Evaluation + 1. Draw a plot of cosine graph between -2pi to 2pi with line thickness 4. + + 2. Read thorugh the documentation and find out is there a way to modify the + alignment of text in the command ``ylabel``. + - Yes + - No + + 3. How do you set the title as x^2-5x+6 in LaTex style formatting. +* Solutions + 1. x = linspace(-2*pi, 2*pi) + plot(x, cos(x), linewidth=4) + + 2. No + + 3. title("$x^2-5x+6$") * Acknowledgement #+begin_latex diff --git a/embellishing_a_plot/slides.tex b/embellishing_a_plot/slides.tex index 8c82d1c..b8e83d1 100644 --- a/embellishing_a_plot/slides.tex +++ b/embellishing_a_plot/slides.tex @@ -1,4 +1,4 @@ -% Created 2011-05-03 Tue 14:38 +% Created 2011-05-06 Fri 12:24 \documentclass[presentation]{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} @@ -128,9 +128,37 @@ MHRD, Govt. of India \end{itemize} \end{frame} \begin{frame} -\frametitle{Acknowledgement} +\frametitle{Evaluation} \label{sec-11} + +\begin{enumerate} +\item Draw a plot of cosine graph between -2pi to 2pi with line thickness 4. +\item Read thorugh the documentation and find out is there a way to modify the + alignment of text in the command ``ylabel``. +\begin{itemize} +\item Yes +\item No +\end{itemize} +\item How do you set the title as x$^2$-5x+6 in LaTex style formatting. +\end{enumerate} +\end{frame} +\begin{frame} +\frametitle{Solutions} +\label{sec-12} + + +\begin{enumerate} +\item x = linspace(-2*pi, 2*pi) + plot(x, cos(x), linewidth=4) +\item No +\item title(``$x^2-5x+6$") +\end{enumerate} +\end{frame} +\begin{frame} +\frametitle{Acknowledgement} +\label{sec-13} + \begin{block}{} \begin{center} \textcolor{blue}{\Large THANK YOU!} diff --git a/loading_data_from_files/script.rst b/loading_data_from_files/script.rst index 029983d..0ff85c0 100644 --- a/loading_data_from_files/script.rst +++ b/loading_data_from_files/script.rst @@ -14,7 +14,6 @@ .. 1. getting started with ``ipython`` -.. #[Anand: author and internal reviewer not mentioned] .. Author : Puneeth Changanti Internal Reviewer : Nishanth Amuluru External Reviewer : @@ -24,131 +23,165 @@ Script ------ +.. L1 + {{{ Show the first slide containing title, name of the production team along with the logo of MHRD }}} +.. R1 + Hello Friends. Welcome to this tutorial on "loading data from files". +.. L2 + {{{ Show slide with objectives }}} -We often require to plot points obtained from experimental -observations. +.. R2 At the end of this tutorial, you will be able to, - 1. Read data from files, containing a single column of data using the ``loadtxt`` command. + 1. Read data from files, containing a single column of data #. Read multiple columns of data, separated by spaces or other delimiters. -{{{ switch to the terminal }}} +.. L3 -As usual, let us start IPython, using +{{{ switch to the terminal }}} :: - ipython -pylab + ipython -pylab + +.. R3 + +As usual, let us switch to the terminal and start IPython, using ipython -pylab + +.. R4 Now, Let us begin with reading the file primes.txt, which contains -just a list of primes listed in a column, using the loadtxt command. +a list of prime numbers listed in a column, using the loadtxt command. +Please make sure that you provide the correct path of the file 'primes.txt'. The file, in our case, is present in ``/home/fossee/primes.txt``. +.. L4 + {{{ Navigate to the path in the OS, open the file and show it }}} -.. #[punch: do we need a slide for showing the path?] +.. L5 +:: -.. We use the ``cat`` command to see the contents of this file. + cat /home/fossee/primes.txt -.. #[punch: should we show the cat command here? seems like a good place - to do it] :: +.. R5 - cat /home/fossee/primes.txt +Otherwise we can use the ``cat`` command to locate the file and read the contents of it. -.. #[Nishanth]: A problem for windows users. - Should we simply open the file and show them the data - so that we can be fine with GNU/Linux ;) and windows? +.. R6 Now let us read this list into the variable ``primes``. + +.. L6 :: - primes = loadtxt('/home/fossee/primes.txt') + primes = loadtxt('/home/fossee/primes.txt') + +.. R7 -``primes`` is now a sequence of primes, that was listed in the file, +``primes`` is now a sequence of prime numbers, that was listed in the file, ``primes.txt``. We now type, ``print primes`` to see the sequence printed. -We observe that all of the numbers end with a period. This is so, -because these numbers are actually read as ``floats``. We shall learn -about them, later. +.. L7 +:: -Now, let us use the ``loadtxt`` command to read a file that contains -two columns of data, ``pendulum.txt``. This file contains the length -of the pendulum in the first column and the corresponding time period -in the second. Note that ``loadtxt`` needs both the columns to have -equal number of rows. + print primes + +.. R8 + +We observe that all the numbers end with a period. This is so, +because these numbers are actually read as ``floats``. + +.. L8 + +{{{Highlight the output on the terminal}}} -.. Following is an exercise that you must do. +.. R9 -.. %%1%% Use the ``cat`` command to view the contents of this file. +Now, let us use the ``loadtxt`` command to read a file ``pendulum.txt`` that contains +two columns of data. This file contains the length +of the pendulum in the first column and the corresponding time period +in the second. Note that here ``loadtxt`` needs both the columns to have +equal number of rows. -.. Please, pause the video here. Do the exercise and then continue. +We use the ``cat`` command to view the contents of this file. -.. This is how we look at the contents of the file, ``pendulum.txt`` -.. :: +.. L9 +:: -.. cat /home/fossee/pendulum.txt + cat /home/fossee/pendulum.txt -.. #[Nishanth]: The first column is L values and second is T values - from a simple pendulum experiment. - Since you are using the variable names later in the - script. - Not necessary but can be included also. +.. R10 Let us, now, read the data into the variable ``pend``. Again, it is assumed that the file is in ``/home/fossee/`` + +.. L10 :: - pend = loadtxt('/home/fossee/pendulum.txt') + pend = loadtxt('/home/fossee/pendulum.txt') + +.. R11 Let us now print the variable ``pend`` and see what's in it. + +.. L11 :: - print pend + print pend + +.. R12 Notice that ``pend`` is not a simple sequence like ``primes``. It has two sequences, containing both the columns of the data file. Let us use an additional argument of the ``loadtxt`` command, to read it into two separate, simple sequences. + +.. L12 :: - L, T = loadtxt('/home/fossee/pendulum.txt', unpack=True) + L, T = loadtxt('/home/fossee/pendulum.txt', unpack=True) -.. #[Nishanth]: It has a sequence of items in which each item contains - two values. first is l and second is t +.. R13 Let us now, print the variables L and T, to see what they contain. + +.. L13 + :: - print L - print T + print L + print T -.. #[Nishanth]: Stress on ``unpack=True`` ?? +.. R14 Notice, that L and T now contain the first and second columns of data from the data file, ``pendulum.txt``, and they are both simple sequences. ``unpack=True`` has given us the two columns into two separate sequences instead of one complex sequence. -{{{ show the slide with loadtxt --- other features }}} +.. L14 + +.. R15 + +Till now, we have learnt the basic use of the ``loadtxt`` +command.Let us try an example. -In this tutorial, we have learnt the basic use of the ``loadtxt`` -command, which is capable of doing a lot more than we have used it for -until now. Let us look at an example, but before that do this -exercise. +Pause the video here, try out the following exercise and resume the video. -%%1%% Read the file ``pendulum_semicolon.txt`` which contains the same +Read the file ``pendulum_semicolon.txt`` which contains the same data as ``pendulum.txt``, but the columns are separated by semi-colons instead of spaces. Use the IPython help to see how to do this. -Please, pause the video here. Do the exercise and then continue. +.. L15 {{{ switch back to the terminal }}} :: @@ -159,20 +192,63 @@ Please, pause the video here. Do the exercise and then continue. print T -This brings us to the end of this tutorial. +.. L16 {{{ show the summary slide }}} -You should now be able to do the following, comfortably. +.. R16 + +This brings us to the end of this tutorial. +let's revise quickly what we have learnt today.In this tutorial we learnt, - + Read data from files, containing a single column of data using the + 1. To Read data from files, containing a single column of data using the ``loadtxt`` command. - + Read multiple columns of data, separated by spaces or other - delimiters. + #. To Read multiple columns of data, separated by spaces or other delimiters. + +.. L17 + +{{Show self assessment questions slide}} + +.. R17 + +1. ``loadtxt`` can read data only from a file with one column + only. True or False? + +2. Given a file ``data.txt`` with three columns of data separated by + spaces, read it into 3 separate simple sequences. + +3. Given a file ``data.txt`` with three columns of data separated by + ":", read it into 3 separate simple sequences. + + +.. L18 + +{{{solution of self assessment questions on slide}}} + +.. R18 + +And the answers, + +1. False. ``loadtxt`` command can read data from files having both single columns as well as + multiple columns. + +2. A file with three columns of data seperated by spaces to be read into 3 seperate sequences, + we use the loadtxt command as, +:: + + x = loadtxt("data.txt", unpack=True) + +3. If a file with three columns of data seperated by delimiters,we read it into three seperate sequences + by using an additional argument of delimiter in the loadtxt command +:: + + x = loadtxt("data.txt", unpack=True, delimiter=":") + +.. L19 -{{{ Show the "sponsored by FOSSEE" slide }}} +{{{ Show the Thankyou slide }}} -This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India +.. R19 Hope you have enjoyed and found it useful. Thank you! diff --git a/loading_data_from_files/slides.org b/loading_data_from_files/slides.org index 91c188a..4691c98 100644 --- a/loading_data_from_files/slides.org +++ b/loading_data_from_files/slides.org @@ -18,7 +18,7 @@ #+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, #+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries} -#+TITLE: Loading data from files +#+TITLE: #+AUTHOR: FOSSEE #+EMAIL: #+DATE: @@ -29,37 +29,61 @@ #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc -* Outline - + Read data from files with a single column of data - + Read data from files with multiple columns +* + #+begin_latex +\begin{center} +\textcolor{blue}{Loading Data from Files} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} +#+end_latex +* Objectives + At the end of this tutorial, you will be able to, + - Read data from files with a single column of data. + - Read data from files with multiple columns seperated by + spaces and other delimiters. * Question 1 - Read the file ~pendulum_semicolon.txt~ which contains the same data - as ~pendulum.txt~, but the columns are separated by semi-colons - instead of spaces. Use the IPython help to see how to do this. -* Solution 1 - #+begin_src python - In []: L, T = loadtxt('/home/fossee/pendulum_semicolon.txt', unpack=True, delimiter=';') - - In []: print L - - In []: print T - #+end_src + Read the file ~pendulum\_semicolon.txt~ which contains the same data + as ~pendulum.txt~ , but the columns are seperated by semi-colons instead + of spaces.Use the IPython help to see how to do this. * Summary - + Read data from files, containing a single column of data using the + In this tutorial,we have learnt to- + - Read data from files, containing a single column of data using the ~loadtxt~ command. - + Read multiple columns of data, separated by spaces or other - delimiters. -* Thank you! + - Read multiple columns of data, separated by spaces or other + delimiters by adding additional arguments to the ~loadtxt~ command. +* Evaluation + 1. ``loadtxt`` can read data only from a file with one column only. + True or False? + + 2. Given a file ``data.txt`` with three columns of data separated by + spaces, read it into 3 separate simple sequences. + + 3. Given a file ``data.txt`` with three columns of data separated by + ":", read it into 3 separate simple sequences. + +* Solutions + 1. False + + 2. x = loadtxt("data.txt", unpack=True) + + 3. x = loadtxt("data.txt", unpack=True, delimiter=":") +* Acknowledgement #+begin_latex - \begin{block}{} + \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} #+end_latex diff --git a/loading_data_from_files/slides.tex b/loading_data_from_files/slides.tex index 858d769..1a8cc3a 100644 --- a/loading_data_from_files/slides.tex +++ b/loading_data_from_files/slides.tex @@ -1,4 +1,4 @@ -% Created 2010-10-10 Sun 18:12 +% Created 2011-05-06 Fri 12:18 \documentclass[presentation]{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} @@ -23,14 +23,14 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Loading data from files} +\title{} \author{FOSSEE} \date{} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle + @@ -41,61 +41,92 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{frame} -\frametitle{Outline} -\label{sec-1} -\begin{itemize} -\item Read data from files with a single column of data -\item Read data from files with multiple columns -\end{itemize} +\begin{center} +\textcolor{blue}{Loading Data from Files} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} \end{frame} \begin{frame} -\frametitle{Question 1} +\frametitle{Objectives} \label{sec-2} - Read the file \texttt{pendulum\_semicolon.txt} which contains the same data - as \texttt{pendulum.txt}, but the columns are separated by semi-colons - instead of spaces. Use the IPython help to see how to do this. + At the end of this tutorial, you will be able to, + +\begin{itemize} +\item Read data from files with a single column of data. +\item Read data from files with multiple columns seperated by + spaces and other delimiters. +\end{itemize} \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 1} +\begin{frame} +\frametitle{Question 1} \label{sec-3} -\lstset{language=Python} -\begin{lstlisting} -In []: L, T = loadtxt('/home/fossee/pendulum_semicolon.txt', unpack=True, delimiter=';') - -In []: print L - -In []: print T -\end{lstlisting} + Read the file \verb~pendulum\_semicolon.txt~ which contains the same data + as \verb~pendulum.txt~ , but the columns are seperated by semi-colons instead + of spaces.Use the IPython help to see how to do this. \end{frame} \begin{frame} \frametitle{Summary} \label{sec-4} + In this tutorial,we have learnt to- + \begin{itemize} \item Read data from files, containing a single column of data using the - \texttt{loadtxt} command. + \verb~loadtxt~ command. \item Read multiple columns of data, separated by spaces or other - delimiters. + delimiters by adding additional arguments to the \verb~loadtxt~ command. \end{itemize} \end{frame} \begin{frame} -\frametitle{Thank you!} +\frametitle{Evaluation} \label{sec-5} - \begin{block}{} + +\begin{enumerate} +\item ``loadtxt`` can read data only from a file with one column only. + True or False? +\item Given a file ``data.txt`` with three columns of data separated by + spaces, read it into 3 separate simple sequences. +\item Given a file ``data.txt`` with three columns of data separated by + ``:'', read it into 3 separate simple sequences. +\end{enumerate} + +\end{frame} +\begin{frame} +\frametitle{Solutions} +\label{sec-6} + + +\begin{enumerate} +\item False +\item x = loadtxt(``data.txt'', unpack=True) +\item x = loadtxt(``data.txt'', unpack=True, delimiter='':'') +\end{enumerate} +\end{frame} +\begin{frame} +\frametitle{Acknowledgement} +\label{sec-7} + + \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} \end{frame} -\end{document} +\end{document}
\ No newline at end of file diff --git a/plotting_data/script.rst b/plotting_data/script.rst index f2a0a29..17003bf 100644 --- a/plotting_data/script.rst +++ b/plotting_data/script.rst @@ -28,191 +28,233 @@ Plotting Experimental Data =============================== -{{{ Show the slide containing title }}} +.. L1 -Hello and welcome , this tutorial on Plotting Experimental data is -presented by the fossee team. +{{{ Show the first slide containing title, name of the production +team along with the logo of MHRD }}} -{{{ Show the Outline Slide }}} +.. R1 -.. #[[Anoop: outline slide is missing]] +Hello Friens.Welcome to this tutorial on "Plotting Experimental data" -Here we will discuss plotting Experimental data. - -1. We will see how we can represent a sequence of numbers in Python. +.. L2 + +{{{ Show the Objectives Slide }}} -2. We will also become familiar with elementwise squaring of such a -sequence. +.. R2 -3. How to plot data points using python. +At the end of this tutorial, you will be able to, -4. We will also see how we can use our graph to indicate Error. + 1. Define a list of numbers. + #. perform elementwise squaring of the list. + #. Plot data points. + #. plot errorbars. -One needs to be familiar with the concepts of plotting -mathematical functions in Python. +.. R3 -We will use data from a Simple Pendulum Experiment to illustrate. +We will use data from a Simple Pendulum Experiment to illustrate. -.. #[[Anoop: what do you mean by points here? if you mean the - points/numbered list in outline slide, then remove the usage point - from here.]] +.. L3 {{{ Simple Pendulum data Slide }}} -.. #[[Anoop: slides are incomplete, work on slides and context - switches]] - - -As we know for a simple pendulum length,L is directly proportional to -the square of time,T. We shall be plotting L and T^2 values. +.. R4 +As we know for a simple pendulum, length L is directly proportional to +the square of time T. We shall be plotting L and T^2 values. First we will have to initiate L and T values. We initiate them as sequence of values. We define a sequence by comma seperated values inside two square brackets. -This is also called List.Lets create two sequences L and t. - -.. #[[Anoop: instead of saying "to tell ipython a sequence of values" - and make it complicated, we can tell, we define a sequence as]] - -.. #[[Anoop: sentence is incomplete, can be removed]] +This is also called a List.Let's create two sequences L and t. -{{{ Show the initializing L&T slide }}} - -Type in ipython shell :: +.. L4 + +:: L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9] - t= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94] + T= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94] - -To obtain the square of sequence t we will use the function square -with argument t.This is saved into the variable tsquare.:: +.. R5 - tsquare=square(t) - tsqaure - array([ 0.4761, 0.81 , 1.4161, 1.69 , 2.1609, 2.4964, 3.1329, - 3.3489, 3.7636]) +To obtain the square of sequence T we will use the function square +with argument T.This is saved into the variable tsquare. -.. #[[Anoop: how do you get the array([ 0.4761 ....]) output?]] +.. L5 - -Now to plot L vs T^2 we will simply type :: +:: - plot(L,tsquare,'.') + Tsquare=square(T) + Tsqaure + array([ 0.4761, 0.81 , 1.4161, 1.69 , 2.1609, 2.4964, 3.1329, + 3.3489, 3.7636]) -.. #[[Anoop: be consistent with the spacing and all.]] +.. R6 -'.' here represents to plot use small dots for the point. :: +Now to plot L vs T^2, we will simply type - clf() +.. L6 -You can also specify 'o' for big dots.:: - - plot(L,tsquare,'o') +:: - clf() + plot(L,Tsquare,'.') +.. R7 -Following are exercises that you must do. +here '.' represents to plot use small dots for the point. +You can also specify 'o' for big dots. -%% %% Plot the given experimental data with large dots.The data is -on your screen. - -%% %% Plot the given experimental data with small dots. -The data is on your screen +.. L7 +:: + + clf() + plot(L,Tsquare,'o') + clf() +.. L8 -Please, pause the video here. Do the exercises and then continue. +.. R8 +For any experimental there is always an error in measurements due to +instrumental and human constraints.Now we shall try and take these errors into +account in our plots . +.. L9 +{{{ Show the slide 'Question 1' }}} +.. R9 -.. #[[Anoop: Make sure code is correct, corrected plot(L,t,o) to - plot(L,t,'o')]] +Pause the video here, try out the following exercise and resume the video. +Plot the given experimental data with large dots.The data is +on your screen. +.. L10 -.. #[[Anoop: again slides are incomplete.]] +{{{ Show slide "Question 1 data' }}} -For any experimental there is always an error in measurements due to -instrumental and human constaraints.Now we shall try and take into -account error into our plots . The Error values for L and T are on -your screen.We shall again intialize the sequence values in the same -manner as we did for L and t +.. R10 The error data we will use is on your screen. -{{{ Show the Adding Error Slide }}} -.. #[[Anoop: give introduction to error and say what we are going to - do]] +.. R11 + +We shall again intialize the sequence values in the same manner as we did for L and T. + +.. L11 :: delta_L= [0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01] delta_T= [0.04,0.08,0.03,0.05,0.03,0.03,0.04,0.07,0.08] + +.. R12 -Now to plot L vs T^2 with an error bar we use the function errorbar() +Now to plot L vs T^2 with an error bar we use the function ``errorbar()``. -The syntax of the command is as given on the screen. :: +.. L12 +:: - - errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='b.') + errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='bo') + +.. R13 This gives a plot with error bar for x and y axis. The dots are of blue color. The parameters xerr and yerr are error on x and y axis and fmt is the format of the plot. +similarly we can draw the same error bar with small red dots just change +the parameters of fmt to 'r.'. -similarly we can draw the same error bar with big red dots just change -the parameters to fmt to 'ro'. :: +.. L13 +:: clf() - errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='ro') + errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='r.') +.. R14 +you can explore other options to errorbar using the documentation +of errorbar. -thats it. you can explore other options to errorbar using the documentation -of errorbar.:: +.. L14 - errorbar? +:: -Following is an exercise that you must do. + errorbar? -%% %% Plot the given experimental data with large green dots.Also include -the error in your plot. +.. L15 -Please, pause the video here. Do the exercise and then continue. +{{{ Show slide with 'Question 2' }}} +.. R15 + +Pause the video here, try out the following exercise and resume the video. + +Plot the given experimental data with small dots.Also include +the error in your plot. +.. L16 +{{{ Show slide 'Question 2 data' }}} +.. R16 +The data is on your screen +.. L17 {{{ Show Summary Slide }}} -In this tutorial we have learnt : +.. R17 +let's revise quickly what we have learnt today.In this tutorial we learnt +1. to declare a sequence of numbers using the function ``array``. +#. to perform elemtwise squaring using the ``square`` function. +#. to use the various options available for plotting like dots,lines. +#. to Plot experimental data such that we can also represent error by using the + ``errorbar()`` function. -1. How to declare a sequence of numbers. +.. R18 -2. Plotting experimental data. +Here are some self assessment questions for you to solve -#. The various options available for plotting dots instead of lines. +1. Square the following sequence. + + distance_values=[2.1,4.6,8.72,9.03] -#. Plotting experimental data such that we can also represent error. +2. Plot L v/s T in red plusses. +.. L18 + +{{Show self assessment questions slide}} +.. L19 - {{{ Show the "sponsored by FOSSEE" slide }}} +(solution of self assessment questions on slide) -.. #[[Anoop: again slides are incomplete]] +.. R19 -This tutorial was created as a part of FOSSEE project. +And the answers, -Hope you have enjoyed and found it useful. +1. To square a sequence of values, we use the function ``square`` +:: + + square(distance_values) + +2. We pass an additional argument stating the desired parameter +:: + + plot(L,T,'r+') + +.. L20 +{{{ Show the Thankyou slide }}} + +.. R20 + +Hope you have enjoyed and found it useful. Thank You! diff --git a/plotting_data/slides.org b/plotting_data/slides.org index e0daeaa..72f5386 100644 --- a/plotting_data/slides.org +++ b/plotting_data/slides.org @@ -18,10 +18,10 @@ #+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, #+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries} -#+TITLE: Plotting Experimental Data -#+AUTHOR: FOSSEE -#+DATE: 2010-09-14 Tue -#+EMAIL: info@fossee.in +#+TITLE: +#+AUTHOR: FOSSEE +#+DATE: +#+EMAIL: #+DESCRIPTION: #+KEYWORDS: @@ -29,12 +29,26 @@ #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc -* Outline - - Defining sequence of numbers - - Squaring sequence of numbers - - Plotting Data Points - - Indicating Error through Errorbars - +* + #+begin_latex +\begin{center} +\textcolor{blue}{Plotting Data} +\end{center} + \begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} +#+end_latex +* Objectives + At the end of this tutorial, you will be able to, + - Define a list of numbers. + - Perform elementwise squaring of the list. + - Plot data points. + - Plot errorbars. + * Simple Pendulum Data #+ORGTBL: L vs T^2 orgtbl-to-latex @@ -50,49 +64,28 @@ | 0.8 | 1.83 | | 0.9 | 1.94 | - -* Initializing L & T - : L = [0.1, 0.2, 0.3, 0.4, 0.5, - : 0.6, 0.7, 0.8, 0.9] - : t = [0.69, 0.90, 1.19, - : 1.30, 1.47, 1.58, - : 1.77, 1.83, 1.94] - - - * Question 1 - - Plot the given experimental data with large dots. - The data is on your screen. + Plot the given experimental data with large dots. + - * Question 1 Data #+ORGTBL: L vs T^2 orgtbl-to-latex - | S | n | - | 0.19 | 10.74 | - | 0.38 | 14.01 | - | 0.57 | 18.52 | - | 0.77 | 20.23 | - | 0.96 | 22.88 | - | 1.15 | 24.59 | - | 1.34 | 27.55 | - | 1.54 | 28.48 | - | 1.73 | 30.20 | + | L | T | + | 0.08 | 0.04 | + | 0.09 | 0.08 | + | 0.07 | 0.03 | + | 0.05 | 0.05 | + | 0.06 | 0.03 | + | 0.00 | 0.03 | + | 0.06 | 0.04 | + | 0.06 | 0.07 | + | 0.01 | 0.08 | - -* Solution 1 - - : S=[0.19,0.38,0.57,0.77,0.96, - : 1.15,1.34,1.54,1.73] - : n=[10.74,14.01,18.52,20.23, - : 22.88,24.59,27.55,28.48,30.20] - : plot(S,n,'o') - * Question 2 - - Plot the given experimental data with small dots. - The data is on your screen. + Plot the given experimental data with small dots. * Question 2 Data @@ -109,91 +102,35 @@ | 11.8 | 1.82 | | 13.3 | 1.93 | -* Solution 2 - - : P=[1.48,2.96,4.44,5.92,7.40, - : 8.88,10.3,11.8,13.3] - : D=[0.68,0.89,1.18,1.29,1.46, - : 1.57,1.76,1.82,1.93] - : plot(P,D,'.') - -* Adding Error - -#+ORGTBL: L vs T^2 orgtbl-to-latex - - | L | T | \delta L | \delta T | - | 0.1 | 0.69 | 0.08 | 0.04 | - | 0.2 | 0.90 | 0.09 | 0.08 | - | 0.3 | 1.19 | 0.07 | 0.03 | - | 0.4 | 1.30 | 0.05 | 0.05 | - | 0.5 | 1.47 | 0.06 | 0.03 | - | 0.6 | 1.58 | 0.00 | 0.03 | - | 0.7 | 1.77 | 0.06 | 0.04 | - | 0.8 | 1.83 | 0.06 | 0.07 | - | 0.9 | 1.94 | 0.01 | 0.08 | - - -* Plotting Error bar - - : errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, - : fmt='b.') - - -* Question 1 - - - Plot the given experimental data with large green dots.Also include - the error in your plot. - - -* Question 1 Data - - #+ORGTBL: L vs T^2 orgtbl-to-latex - - | S | n | \delta S | \delta n | - | 0.19 | 10.74 | 0.006 | 0.61 | - | 0.38 | 14.01 | 0.006 | 0.69 | - | 0.57 | 18.52 | 0.005 | 0.53 | - | 0.77 | 20.23 | 0.003 | 0.38 | - | 0.96 | 22.88 | 0.004 | 0.46 | - | 1.15 | 24.59 | 0.007 | 0.37 | - | 1.34 | 27.55 | 0.004 | 0.46 | - | 1.54 | 28.48 | 0.004 | 0.46 | - | 1.73 | 30.20 | 0.007 | 0.37 | - - - - -* Solution 1 - - : S=[0.19,0.38,0.57,0.77,0.96, - : 1.15,1.34,1.54,1.73] - : n=[10.74,14.01,18.52,20.23, - : 22.88,24.59,27.55,28.48,30.20] - : delta_S=[0.006,0.006,0.005,0.003, - : 0.004,0.007,0.004,0.004,0.007] - : delta_n=[0.61,0.69,0.53,0.38,0.46, - : 0.37,0.46,0.46,0.37] - : errorbar(S,n,xerr=delta_S, yerr=delta_n, - : fmt='go') - * Summary - : L = [0.1, 0.2, 0.3, 0.4, 0.5, - : 0.6, 0.7, 0.8, 0.9] - : plot(x,y,'o') - : plot(x,y,'.') -* Thank you! + In this tutorial, we have learnt to – + - Declare a sequence of numbers using the function ``array``. + - Perform elemtwise squaring using the ``square`` function. + - Use the various options available for plotting like dots,lines. + - Plot experimental data such that we can also represent error by using the + ``errorbar()`` function. +* Evaluation + 1. Square the following sequence. + - distance\_values=[2.1,4.6,8.72,9.03] + + 2. Plot L v/s T in red plusses. +* Solutions + 1. square(distance\_values) + + 2. plot(L,T,'r+') +* Acknowledgement #+begin_latex - \begin{block}{} - \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the - \end{center} - \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. - \end{center} - \end{block} + \begin{block}{} + \begin{center} + \textcolor{blue}{\Large THANK YOU!} + \end{center} + \end{block} +\begin{block}{} + \begin{center} + For more Information, visit our website\\ + \url{http://fossee.in/} + \end{center} + \end{block} #+end_latex diff --git a/plotting_data/slides.tex b/plotting_data/slides.tex index 575632f..0a1bfbb 100644 --- a/plotting_data/slides.tex +++ b/plotting_data/slides.tex @@ -1,6 +1,6 @@ -% Created 2010-11-10 Wed 02:09 +% Created 2011-05-06 Fri 17:36 \documentclass[presentation]{beamer} -\usepackage[latin1]{inputenc} +\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} @@ -8,7 +8,6 @@ \usepackage{float} \usepackage{wrapfig} \usepackage{soul} -\usepackage{t1enc} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} @@ -24,14 +23,13 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Plotting Experimental Data} +\title{} \author{FOSSEE} -\date{2010-09-14 Tue} +\date{} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle @@ -41,20 +39,37 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} + +\begin{frame} + +\begin{center} +\textcolor{blue}{Plotting Data} +\end{center} + \begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} +\end{frame} \begin{frame} -\frametitle{Outline} -\label{sec-1} +\frametitle{Objectives} +\label{sec-2} + + At the end of this tutorial, you will be able to, \begin{itemize} -\item Defining sequence of numbers -\item Squaring sequence of numbers -\item Plotting Data Points -\item Indicating Error through Errorbars +\item Define a list of numbers. +\item Perform elementwise squaring of the list. +\item Plot data points. +\item Plot errorbars. \end{itemize} + \end{frame} \begin{frame} \frametitle{Simple Pendulum Data} -\label{sec-2} +\label{sec-3} @@ -77,27 +92,12 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \end{frame} -\begin{frame}[fragile] -\frametitle{Initializing L \& T} -\label{sec-3} - -\begin{verbatim} - L = [0.1, 0.2, 0.3, 0.4, 0.5, - 0.6, 0.7, 0.8, 0.9] - t = [0.69, 0.90, 1.19, - 1.30, 1.47, 1.58, - 1.77, 1.83, 1.94] -\end{verbatim} -\end{frame} \begin{frame} \frametitle{Question 1} \label{sec-4} -\begin{itemize} -\item Plot the given experimental data with large dots. -\end{itemize} - - The data is on your screen. + Plot the given experimental data with large dots. + \end{frame} \begin{frame} @@ -110,48 +110,31 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{center} \begin{tabular}{rr} - S & n \\ - 0.19 & 10.74 \\ - 0.38 & 14.01 \\ - 0.57 & 18.52 \\ - 0.77 & 20.23 \\ - 0.96 & 22.88 \\ - 1.15 & 24.59 \\ - 1.34 & 27.55 \\ - 1.54 & 28.48 \\ - 1.73 & 30.20 \\ + L & T \\ + 0.08 & 0.04 \\ + 0.09 & 0.08 \\ + 0.07 & 0.03 \\ + 0.05 & 0.05 \\ + 0.06 & 0.03 \\ + 0.00 & 0.03 \\ + 0.06 & 0.04 \\ + 0.06 & 0.07 \\ + 0.01 & 0.08 \\ \end{tabular} \end{center} \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 1} -\label{sec-6} - - -\begin{verbatim} - S=[0.19,0.38,0.57,0.77,0.96, - 1.15,1.34,1.54,1.73] - n=[10.74,14.01,18.52,20.23, - 22.88,24.59,27.55,28.48,30.20] - plot(S,n,'o') -\end{verbatim} -\end{frame} \begin{frame} \frametitle{Question 2} -\label{sec-7} - -\begin{itemize} -\item Plot the given experimental data with small dots. -\end{itemize} +\label{sec-6} - The data is on your screen. + Plot the given experimental data with small dots. \end{frame} \begin{frame} \frametitle{Question 2 Data} -\label{sec-8} +\label{sec-7} @@ -174,140 +157,58 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 2} -\label{sec-9} - - -\begin{verbatim} - P=[1.48,2.96,4.44,5.92,7.40, - 8.88,10.3,11.8,13.3] - D=[0.68,0.89,1.18,1.29,1.46, - 1.57,1.76,1.82,1.93] - plot(P,D,'.') -\end{verbatim} -\end{frame} \begin{frame} -\frametitle{Adding Error} -\label{sec-10} - - - - -\begin{center} -\begin{tabular}{rrrr} - L & T & $\delta$ L & $\delta$ T \\ - 0.1 & 0.69 & 0.08 & 0.04 \\ - 0.2 & 0.90 & 0.09 & 0.08 \\ - 0.3 & 1.19 & 0.07 & 0.03 \\ - 0.4 & 1.30 & 0.05 & 0.05 \\ - 0.5 & 1.47 & 0.06 & 0.03 \\ - 0.6 & 1.58 & 0.00 & 0.03 \\ - 0.7 & 1.77 & 0.06 & 0.04 \\ - 0.8 & 1.83 & 0.06 & 0.07 \\ - 0.9 & 1.94 & 0.01 & 0.08 \\ -\end{tabular} -\end{center} - +\frametitle{Summary} +\label{sec-8} - - -\end{frame} -\begin{frame}[fragile] -\frametitle{Plotting Error bar} -\label{sec-11} + In this tutorial, we have learnt to – - -\begin{verbatim} - errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, - fmt='b.') -\end{verbatim} +\begin{itemize} +\item Declare a sequence of numbers using the function ``array``. +\item Perform elemtwise squaring using the ``square`` function. +\item Use the various options available for plotting like dots,lines. +\item Plot experimental data such that we can also represent error by using the + ``errorbar()`` function. +\end{itemize} \end{frame} \begin{frame} -\frametitle{Question 1} -\label{sec-12} +\frametitle{Evaluation} +\label{sec-9} +\begin{enumerate} +\item Square the following sequence. \begin{itemize} -\item Plot the given experimental data with large green dots.Also include +\item distance\_values=[2.1,4.6,8.72,9.03] \end{itemize} - - the error in your plot. - - +\item Plot L v/s T in red plusses. +\end{enumerate} \end{frame} \begin{frame} -\frametitle{Question 1 Data} -\label{sec-13} - - - \#+ORGTBL: L vs T$^2$ orgtbl-to-latex - - -\begin{center} -\begin{tabular}{rrrr} - S & n & $\delta$ S & $\delta$ n \\ - 0.19 & 10.74 & 0.006 & 0.61 \\ - 0.38 & 14.01 & 0.006 & 0.69 \\ - 0.57 & 18.52 & 0.005 & 0.53 \\ - 0.77 & 20.23 & 0.003 & 0.38 \\ - 0.96 & 22.88 & 0.004 & 0.46 \\ - 1.15 & 24.59 & 0.007 & 0.37 \\ - 1.34 & 27.55 & 0.004 & 0.46 \\ - 1.54 & 28.48 & 0.004 & 0.46 \\ - 1.73 & 30.20 & 0.007 & 0.37 \\ -\end{tabular} -\end{center} - +\frametitle{Solutions} +\label{sec-10} - - - -\end{frame} -\begin{frame}[fragile] -\frametitle{Solution 1} -\label{sec-14} - -\begin{verbatim} - S=[0.19,0.38,0.57,0.77,0.96, - 1.15,1.34,1.54,1.73] - n=[10.74,14.01,18.52,20.23, - 22.88,24.59,27.55,28.48,30.20] - delta_S=[0.006,0.006,0.005,0.003, - 0.004,0.007,0.004,0.004,0.007] - delta_n=[0.61,0.69,0.53,0.38,0.46, - 0.37,0.46,0.46,0.37] - errorbar(S,n,xerr=delta_S, yerr=delta_n, - fmt='go') -\end{verbatim} -\end{frame} -\begin{frame}[fragile] -\frametitle{Summary} -\label{sec-15} - -\begin{verbatim} - L = [0.1, 0.2, 0.3, 0.4, 0.5, - 0.6, 0.7, 0.8, 0.9] - plot(x,y,'o') - plot(x,y,'.') -\end{verbatim} +\begin{enumerate} +\item square(distance\_values) +\item plot(L,T,'r+') +\end{enumerate} \end{frame} \begin{frame} -\frametitle{Thank you!} -\label{sec-16} - - \begin{block}{} - \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the - \end{center} - \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. - \end{center} - \end{block} +\frametitle{Acknowledgement} +\label{sec-11} + + \begin{block}{} + \begin{center} + \textcolor{blue}{\Large THANK YOU!} + \end{center} + \end{block} +\begin{block}{} + \begin{center} + For more Information, visit our website\\ + \url{http://fossee.in/} + \end{center} + \end{block} \end{frame} -\end{document} +\end{document}
\ No newline at end of file |