summaryrefslogtreecommitdiff
path: root/additional_features_of_ipython/slides.org
diff options
context:
space:
mode:
authorJovina2011-05-04 12:05:01 +0530
committerJovina2011-05-04 12:05:01 +0530
commit8f769af90d747f7e12e4ef64ec2ee9dabf19b727 (patch)
tree23b5de3ab7c201220de16da2fcbaf6a54e128a0f /additional_features_of_ipython/slides.org
parent19c8f29fa0be1c8697078fbeae780c5aa52b0676 (diff)
downloadst-scripts-8f769af90d747f7e12e4ef64ec2ee9dabf19b727.tar.gz
st-scripts-8f769af90d747f7e12e4ef64ec2ee9dabf19b727.tar.bz2
st-scripts-8f769af90d747f7e12e4ef64ec2ee9dabf19b727.zip
Modified files in module1.
Diffstat (limited to 'additional_features_of_ipython/slides.org')
-rw-r--r--additional_features_of_ipython/slides.org79
1 files changed, 28 insertions, 51 deletions
diff --git a/additional_features_of_ipython/slides.org b/additional_features_of_ipython/slides.org
index 4f315fc..e899837 100644
--- a/additional_features_of_ipython/slides.org
+++ b/additional_features_of_ipython/slides.org
@@ -32,7 +32,7 @@
*
#+begin_latex
\begin{center}
-\textcolor{blue}{Additional Features of \texttt{ipython}}
+\textcolor{blue}{Additional Features of \texttt{ipython}}
\end{center}
\begin{center}
\includegraphics[scale=0.25]{../images/iitb-logo.png}\\
@@ -42,82 +42,62 @@ 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,
- - Retrieve the ipython history.
+
+ - Retrieve your ipython history.
- View a part of the history.
- - Save (relevant) parts of the history to a file.
+ - Save a part of your history to a file.
- Run a script from within ipython.
* Question 1
- Read through the documentation of ~%hist~ and find out how to list
- all the commands between 5 and 10
-* Solution 1
- #+begin_src python
- In []: %hist 5 10
- #+end_src
+ Read through the documentation of =%hist= and find out how to
+ list all the commands between 5 and 10.
* Question 2
Change the label on y-axis to "y" and save the lines of code
accordingly
-* Solution 2
- #+begin_src python
- In []: ylabel("y")
- In []: %save /home/fossee/example_plot.py 1 3-6 10
- #+end_src
* Question 3
- Use =%hist= and =%save= and create a script that has show in it and
- run it to produce and show the plot.
-
-* Solution 3
- #+begin_src python
- In []: %hist 20
-
- In []: %save /home/fossee/show_included.py 1 3-6 8 10 13
- In []: %run -i /home/fossee/show_included.py
- #+end_src
+ Use =%hist= and =%save= and create a script that has the function show()
+ in it.Run the script to produce the plot and display the same.
+
* Question 4
Run the script without using the -i option. Do you find any
difference?
* Solution 4
We see that it raises ~NameError~ saying the name ~linspace~ is not
found.
-
* Summary
In this tutorial, we have learnt to –
- - Retrieve history using =%hist= command.
- - View only a part of history by passing an argument to =%hist=.
- - Sav the required lines of code in the required order using =%save=.
- - Use =%run -i= command to run the saved script.
-
+ - Retrieve the history using =%hist= command.
+ - View only a part of history by passing an argument to %hist.
+ - Save the required lines of code in required order using %save command.
+ - Use %run -i command to run the saved script.
* Evaluation
- 1. How do you retrieve the recent 5 commands
-
- - ``%hist``
- - ``%hist -5``
- - ``%hist 5``
- - ``%hist 5-10``
+ 1. How do you retrieve the recent 5 commands
+
+ - ``%hist``
+ - ``%hist -5``
+ - ``%hist 5``
+ - ``%hist 5-10``
2. How do you save the lines 2 3 4 5 7 9 10 11
- - ``%save filepath 2-5 7 9-11``
- - ``%save filepath 2-11``
- - ``%save filepath``
- - ``%save 2-5 7 9 10 11``
+ - ``%save filepath 2-5 7 9-11``
+ - ``%save filepath 2-11``
+ - ``%save filepath``
+ - ``%save 2-5 7 9 10 11``
3. What will the command ``%hist 5 10`` display.
- - The recently typed commands from 5 to 10 inclusive of
- the history command
- - The recently typed commands from 5 to 10 excluding
- the history command
-
+ - The recently typed commands from 5 to 10 inclusive of
+ the history command
+ - The recently typed commands from 5 to 10 excluding
+ the history command
* Solutions
1. %hist 5
-
+
2. %save filepath 2-5 7 9-11
3. %hist 5 10
-
* Acknowledgement
#+begin_latex
\begin{block}{}
@@ -134,6 +114,3 @@ MHRD, Govt. of India
#+end_latex
-
-
-