summaryrefslogtreecommitdiff
path: root/loading_data_from_files
diff options
context:
space:
mode:
authorJovina2011-05-23 16:03:03 +0530
committerJovina2011-05-23 16:03:03 +0530
commitd3b14f3adda43847a11d26e6cda2cd65a291cc58 (patch)
treec7249384d95ba84b078a87fa8ec08dfde5d1aa28 /loading_data_from_files
parent55dd6a16a1955e46487110e71305323335839e27 (diff)
downloadst-scripts-d3b14f3adda43847a11d26e6cda2cd65a291cc58.tar.gz
st-scripts-d3b14f3adda43847a11d26e6cda2cd65a291cc58.tar.bz2
st-scripts-d3b14f3adda43847a11d26e6cda2cd65a291cc58.zip
Modified scripts & slides in module 2.
Diffstat (limited to 'loading_data_from_files')
-rw-r--r--loading_data_from_files/script.rst79
-rw-r--r--loading_data_from_files/slides.org4
-rw-r--r--loading_data_from_files/slides.tex22
3 files changed, 60 insertions, 45 deletions
diff --git a/loading_data_from_files/script.rst b/loading_data_from_files/script.rst
index fd05ed3..b0d3245 100644
--- a/loading_data_from_files/script.rst
+++ b/loading_data_from_files/script.rst
@@ -30,7 +30,7 @@ team along with the logo of MHRD }}}
.. R1
-Hello Friends. Welcome to this tutorial on "loading data from files".
+Hello Friends and Welcome to this tutorial on "loading data from files".
.. L2
@@ -41,7 +41,8 @@ Hello Friends. Welcome to this tutorial on "loading data from files".
At the end of this tutorial, you will be able to,
1. Read data from files, containing a single column of data
- #. Read multiple columns of data, separated by spaces or other delimiters.
+ #. Read multiple columns of data, separated by spaces or other
+ delimiters.
.. L3
@@ -58,7 +59,8 @@ Let us switch to the terminal and start IPython, using ipython -pylab
Now, Let us begin with reading the file primes.txt, which contains
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'.
+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
@@ -72,7 +74,8 @@ The file, in our case, is present in ``/home/fossee/primes.txt``.
.. R5
-Otherwise we can use the ``cat`` command to locate the file and read the contents of it.
+Otherwise we can use the ``cat`` command to locate the file and read the
+contents of it.
.. R6
@@ -85,8 +88,8 @@ Now let us read this list into the variable ``primes``.
.. R7
-``primes`` is now a sequence of prime numbers, that was listed in the file,
-``primes.txt``.
+``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.
@@ -106,11 +109,11 @@ because these numbers are actually read as ``floats``.
.. R9
-Now, let us use the ``loadtxt`` command to read a file ``pendulum.txt`` that contains
-two columns of data. This file contains the length
+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.
+in the second. Note that here ``loadtxt`` needs both the columns to
+have equal number of rows.
We use the ``cat`` command to view the contents of this file.
@@ -170,6 +173,10 @@ separate sequences instead of one complex sequence.
.. L14
+.. L15
+
+{{{ Show slide with exercise 1 }}}
+
.. R15
Till now, we have learnt the basic use of the ``loadtxt``
@@ -181,35 +188,39 @@ 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.
-.. L15
+.. L16
{{{ switch back to the terminal }}}
::
- L, T = loadtxt('/home/fossee/pendulum_semicolon.txt', unpack=True, delimiter=';')
+ L, T = loadtxt('/home/fossee/pendulum_semicolon.txt', unpack=True,
+ delimiter=';')
+
+ print L
- print L
+ print T
- print T
+.. R16
-.. L16
+.. L17
{{{ show the summary slide }}}
-.. R16
+.. R17
-This brings us to the end of this tutorial.
-let's revise quickly what we have learnt today.In this tutorial we learnt,
+This brings us to the end of this tutorial.In this tutorial,
+we have learnt to,
- 1. To Read data from files, containing a single column of data using the
- ``loadtxt`` command.
- #. To Read multiple columns of data, separated by spaces or other delimiters.
+ 1. To Read data from files, containing a single column of data
+ using the ``loadtxt`` command.
+ #. To Read multiple columns of data, separated by spaces or other
+ delimiters.
-.. L17
+.. L18
{{Show self assessment questions slide}}
-.. R17
+.. R18
1. ``loadtxt`` can read data from a file with one column
only. True or False?
@@ -221,35 +232,37 @@ let's revise quickly what we have learnt today.In this tutorial we learnt,
":", read it into 3 separate simple sequences.
-.. L18
+.. L19
{{{solution of self assessment questions on slide}}}
-.. R18
+.. R19
And the answers,
-1. False. ``loadtxt`` command can read data from files having both single columns as well as
- multiple columns.
+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,
+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
+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
+.. L20
{{{ Show the Thankyou slide }}}
-.. R19
+.. R20
-Hope you have enjoyed and found it useful.
+Hope you have enjoyed this tutorial and found it useful.
Thank you!
diff --git a/loading_data_from_files/slides.org b/loading_data_from_files/slides.org
index ae693ac..ae92a06 100644
--- a/loading_data_from_files/slides.org
+++ b/loading_data_from_files/slides.org
@@ -33,7 +33,7 @@
#+begin_latex
\begin{center}
\vspace{12pt}
-\textcolor{blue}{\huge Loading Data from Files}}
+\textcolor{blue}{\huge Loading Data from Files}
\end{center}
\vspace{18pt}
\begin{center}
@@ -51,7 +51,7 @@
- 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
+* Exercise 1
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.
diff --git a/loading_data_from_files/slides.tex b/loading_data_from_files/slides.tex
index 1a8cc3a..00e0df5 100644
--- a/loading_data_from_files/slides.tex
+++ b/loading_data_from_files/slides.tex
@@ -1,4 +1,4 @@
-% Created 2011-05-06 Fri 12:18
+% Created 2011-05-23 Mon 14:23
\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
@@ -43,14 +43,18 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries}
\begin{frame}
\begin{center}
-\textcolor{blue}{Loading Data from Files}
+\vspace{12pt}
+\textcolor{blue}{\huge Loading Data from Files}
\end{center}
+\vspace{18pt}
\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
+\vspace{10pt}
+\includegraphics[scale=0.95]{../images/fossee-logo.png}\\
+\vspace{5pt}
+\scriptsize Developed by FOSSEE Team, IIT-Bombay. \\
+\scriptsize Funded by National Mission on Education through ICT\\
+\scriptsize MHRD,Govt. of India\\
+\includegraphics[scale=0.30]{../images/iitb-logo.png}\\
\end{center}
\end{frame}
\begin{frame}
@@ -66,7 +70,7 @@ MHRD, Govt. of India
\end{itemize}
\end{frame}
\begin{frame}
-\frametitle{Question 1}
+\frametitle{Exercise 1}
\label{sec-3}
Read the file \verb~pendulum\_semicolon.txt~ which contains the same data
@@ -113,8 +117,6 @@ MHRD, Govt. of India
\end{enumerate}
\end{frame}
\begin{frame}
-\frametitle{Acknowledgement}
-\label{sec-7}
\begin{block}{}
\begin{center}