181
|
1 |
1 Module 1: Basic Plotting (16)
|
|
2 |
================================
|
|
3 |
|
|
4 |
1.1 ABCD
|
|
5 |
---------
|
|
6 |
* Audience
|
|
7 |
+ same
|
|
8 |
* Behaviour
|
|
9 |
- should be able to generate plots with any combination of built-in
|
|
10 |
mathematical functions provided by pylab
|
|
11 |
* Condition
|
|
12 |
- being learnt in a self-study tutorial.
|
|
13 |
- have python setup in their machine
|
|
14 |
* Degree
|
|
15 |
- RBT - Ap
|
|
16 |
|
|
17 |
|
|
18 |
1.2 LO: getting started with =ipython= (2) [punch]
|
|
19 |
---------------------------------------------------
|
|
20 |
* Objective
|
|
21 |
Participants will be able to invoke and use basic features of ipython.
|
|
22 |
* ABCD
|
|
23 |
+ Condition
|
|
24 |
- have =python= & =ipython= setup in their machine. no mention of =pylab=
|
|
25 |
* Assessment Strategy
|
|
26 |
Built-in interspersed exercises
|
|
27 |
- workbook
|
|
28 |
+ errors, make connection with error message
|
|
29 |
* Outline
|
|
30 |
+ invoking ipython
|
|
31 |
if there's a problem, pre-requisites are not met.
|
|
32 |
+ getting out
|
|
33 |
+ explain the prompt
|
|
34 |
+ typing commands
|
|
35 |
- 1+2
|
|
36 |
* careful wording to differentiate from print
|
|
37 |
- print 1+2
|
|
38 |
- history (up, down arrows)
|
|
39 |
- backspace, delete key
|
|
40 |
- tab completion
|
|
41 |
* ab
|
|
42 |
* a
|
|
43 |
* rou
|
|
44 |
* ro
|
|
45 |
* r
|
|
46 |
+ =abs?=, =round?=
|
|
47 |
+ handling typing errors
|
|
48 |
- round(2.48,
|
|
49 |
+ close it
|
|
50 |
+ use ^C
|
|
51 |
|
|
52 |
1.3 LO: using the =plot= command interactively (2) [amit]
|
|
53 |
----------------------------------------------------------
|
|
54 |
* Outline
|
|
55 |
+ ipython -pylab
|
|
56 |
- pylab brings in the libraries necessary for Scientific Computing.
|
|
57 |
+ =linspace=,
|
|
58 |
+ =len=
|
|
59 |
+ =clf=
|
|
60 |
+ =plot=
|
|
61 |
+ using the plot ui
|
|
62 |
|
|
63 |
1.4 LO: embellishing a plot (2) [nishanth]
|
|
64 |
-------------------------------------------
|
|
65 |
* Outline
|
|
66 |
+ [X]line width, color, style
|
|
67 |
+ [X]Title
|
|
68 |
+ [X]Label
|
|
69 |
+ [X]annotations
|
|
70 |
|
|
71 |
1.5 LO: saving plots (2) [anoop]
|
|
72 |
---------------------------------
|
|
73 |
* Outline
|
|
74 |
+ basic savefig
|
|
75 |
+ png, pdf, ps, eps, svg
|
|
76 |
+ going to OS and looking at the file
|
|
77 |
|
|
78 |
1.6 LO: multiple plots (3) [madhu]
|
|
79 |
-----------------------------------
|
|
80 |
* Outline
|
|
81 |
+ overlays
|
|
82 |
- linspace
|
|
83 |
* give one with very few points, more points
|
|
84 |
* show smoothness of the curve
|
|
85 |
+ legend
|
|
86 |
+ figure 1, figure2
|
|
87 |
+ subplots
|
|
88 |
|
|
89 |
1.7 LO: additional features of IPython (2) [nishanth]
|
|
90 |
------------------------------------------------------
|
|
91 |
* Outline
|
|
92 |
+ =%save=, =%history=, =%run=
|
|
93 |
|
|
94 |
1.8 LO: module level assessment (3) [madhu]
|
|
95 |
--------------------------------------------
|
|
96 |
* 10-12 question, time the questions
|
|
97 |
* pause & and play when ready to look at answers
|
|
98 |
* show the answers
|
|
99 |
* one large or two medium questions
|
|
100 |
* ex: four_plot
|
|
101 |
|
|
102 |
|
|
103 |
2 Module 2: Plotting Experimental Data (12)
|
|
104 |
============================================
|
|
105 |
|
|
106 |
2.1 ABCD
|
|
107 |
---------
|
|
108 |
* Audience
|
|
109 |
+ same
|
|
110 |
* Behaviour
|
|
111 |
- should be able to generate plots with numeric data from files.
|
|
112 |
* Condition
|
|
113 |
- being learnt in a self-study tutorial.
|
|
114 |
- have python setup in their machine
|
|
115 |
* Degree
|
|
116 |
- Same
|
|
117 |
|
|
118 |
2.2 LO: loading data from files (3) [punch]
|
|
119 |
--------------------------------------------
|
|
120 |
* loadtxt with unpack=True
|
|
121 |
+ primes.list (one col)
|
|
122 |
+ pendulum.txt (two col)
|
|
123 |
|
|
124 |
2.3 LO: plotting the data (3) [amit]
|
|
125 |
-------------------------------------
|
|
126 |
* plot L vs. T^2
|
|
127 |
+ using square function
|
|
128 |
* problem with 3 cols
|
|
129 |
+ 3rd column is error
|
|
130 |
+ error bar
|
|
131 |
|
|
132 |
2.4 LO: other types of plots (3) [anoop]
|
|
133 |
-----------------------------------------
|
|
134 |
* scatter
|
|
135 |
* pie chart
|
|
136 |
* bar chart
|
|
137 |
* log
|
|
138 |
* illustration of other plots, matplotlib help
|
|
139 |
|
|
140 |
2.5 LO: module level assessment (3) [nishanth]
|
|
141 |
-----------------------------------------------
|
|
142 |
* pos.txt is evaluation
|
|
143 |
|
|
144 |
|
|
145 |
3 Module 3: Handling Large Data Files (17)
|
|
146 |
===========================================
|
|
147 |
|
|
148 |
3.1 LO: getting started with lists (2) [amit]
|
|
149 |
----------------------------------------------
|
|
150 |
* empty
|
|
151 |
* filled lists
|
|
152 |
+ heterogenity
|
|
153 |
* accessing
|
|
154 |
* len
|
|
155 |
* =append= elements
|
|
156 |
* del (+ remove)
|
|
157 |
|
|
158 |
3.2 LO: getting started with =for= (2) [anoop]
|
|
159 |
-----------------------------------------------
|
|
160 |
* blocks in python
|
|
161 |
+ (indentation)
|
|
162 |
* blocks in ipython
|
|
163 |
+ ... prompt
|
|
164 |
+ hitting enter
|
|
165 |
* =for= with a list
|
|
166 |
* =range= function
|
|
167 |
|
|
168 |
3.3 LO: getting started with strings (2) [madhu]
|
|
169 |
-------------------------------------------------
|
|
170 |
* strings
|
|
171 |
+ single, double, triple quoted
|
|
172 |
* accessing elements
|
|
173 |
* show immutability
|
|
174 |
* tell that there are methods for manipulation
|
|
175 |
|
|
176 |
3.4 LO: getting started with files (3) [punch]
|
|
177 |
-----------------------------------------------
|
|
178 |
* show file object
|
|
179 |
* read the file with =read=
|
|
180 |
* closing the file
|
|
181 |
* for line in file:
|
|
182 |
* print a line
|
|
183 |
* append the lines to a list
|
|
184 |
|
|
185 |
3.5 LO: parsing data (3) [nishanth]
|
|
186 |
------------------------------------
|
|
187 |
* explain what is parsing
|
|
188 |
* strip (with strings)
|
|
189 |
* split (with strings)
|
|
190 |
+ with delimiters
|
|
191 |
- specify space as delimiter
|
|
192 |
* datatype conversion
|
|
193 |
* reading from files
|
|
194 |
+ do the same problem done with loadtxt (for pendulum)
|
|
195 |
+ basic parse sslc text
|
|
196 |
|
|
197 |
3.6 LO: statistics (2) [amit]
|
|
198 |
------------------------------
|
|
199 |
* mean
|
|
200 |
+ summing
|
|
201 |
* median
|
|
202 |
* std
|
|
203 |
|
|
204 |
3.7 LO: module level assessment (3) [madhu]
|
|
205 |
--------------------------------------------
|
|
206 |
* mean g
|
|
207 |
|
|
208 |
|
|
209 |
4 Module 4: Arrays and Matrices (14)
|
|
210 |
=====================================
|
|
211 |
|
|
212 |
4.1 LO: getting started with arrays (2) [anoop]
|
|
213 |
------------------------------------------------
|
|
214 |
* why arrays
|
|
215 |
+ speed - simply say
|
|
216 |
+ array level operations
|
|
217 |
* creating arrays
|
|
218 |
+ direct data
|
|
219 |
+ list conversion
|
|
220 |
+ homogeneous
|
|
221 |
+ builtins - identitiy, zeros,
|
|
222 |
* array operations
|
|
223 |
+ =+ - * /=
|
|
224 |
|
|
225 |
4.2 LO: accessing parts of arrays (4) [punch]
|
|
226 |
----------------------------------------------
|
|
227 |
* accessing individual elements
|
|
228 |
* slicing, striding
|
|
229 |
* image manipulation
|
|
230 |
|
|
231 |
4.3 LO: Matrices (3) [anoop]
|
|
232 |
-----------------------------
|
|
233 |
* creating matrices
|
|
234 |
+ direct data
|
|
235 |
+ list conversion
|
|
236 |
+ builtins - identitiy, zeros,
|
|
237 |
* matrix operations
|
|
238 |
+ + - * /
|
|
239 |
+ dot
|
|
240 |
+ inv
|
|
241 |
+ det
|
|
242 |
+ eig
|
|
243 |
+ norm
|
|
244 |
+ svd
|
|
245 |
|
|
246 |
4.4 LO: Least square fit (2) [nishanth]
|
|
247 |
----------------------------------------
|
|
248 |
* show pendulum
|
|
249 |
+ use loadtxt
|
|
250 |
* lstsq
|
|
251 |
|
|
252 |
4.5 LO: Assessment (3) [punch]
|
|
253 |
-------------------------------
|
|
254 |
* extract faces from a group photograph
|
|
255 |
|
|
256 |
5 Module 5: using Sage (13)
|
|
257 |
============================
|
|
258 |
|
|
259 |
5.1 LO: getting started with sage notebook (3) [madhu]
|
|
260 |
-------------------------------------------------------
|
|
261 |
* about sage
|
|
262 |
+ ...
|
|
263 |
* starting the notebook server
|
|
264 |
* using the UI
|
|
265 |
+ typesetting & print
|
|
266 |
+ selecting language
|
|
267 |
- sage
|
|
268 |
- LaTeX
|
|
269 |
- python
|
|
270 |
+ help
|
|
271 |
- sum(<tab>
|
|
272 |
- ?
|
|
273 |
|
|
274 |
5.2 LO: getting started with symbolics (3) [amit]
|
|
275 |
--------------------------------------------------
|
|
276 |
* symbolic expressions
|
|
277 |
+ built-in constants & functions
|
|
278 |
+ algebraic expressions,
|
|
279 |
+ series
|
|
280 |
+ integration, differentiation
|
|
281 |
+ matrices
|
|
282 |
* symbolic functions
|
|
283 |
+ defining
|
|
284 |
* simplification
|
|
285 |
* finding roots & factors
|
|
286 |
* substituting expressions
|
|
287 |
* output formats
|
|
288 |
|
|
289 |
5.3 LO: using Sage (4) [punch]
|
|
290 |
-------------------------------
|
|
291 |
* ABCD
|
|
292 |
+ Degree
|
|
293 |
- RBT - U
|
|
294 |
* Calculus
|
|
295 |
+ limits
|
|
296 |
+ differentiation
|
|
297 |
+ integration
|
|
298 |
- indefinite
|
|
299 |
- definite
|
|
300 |
+ piece-wise functions
|
|
301 |
+ differential equations
|
|
302 |
+ maxima, minima
|
|
303 |
* Linear Algebra
|
|
304 |
+ Vectors and Matrices
|
|
305 |
- constructions
|
|
306 |
+ Vector Operations
|
|
307 |
- linear combination
|
|
308 |
- dot
|
|
309 |
- cross
|
|
310 |
- pairwise
|
|
311 |
+ Matrix Operations
|
|
312 |
- linear combination
|
|
313 |
- matrix multiplication
|
|
314 |
- inverse
|
|
315 |
- transpose
|
|
316 |
- adjoint
|
|
317 |
- rank
|
|
318 |
- determinant
|
|
319 |
- trace
|
|
320 |
- norm
|
|
321 |
+ Solving equations
|
|
322 |
+ Eigenvalues, eigenvectors
|
|
323 |
* Graph Theory
|
|
324 |
* Number Theory
|
|
325 |
|
|
326 |
5.4 LO: using sage to teach (3) [nishanth]
|
|
327 |
-------------------------------------------
|
|
328 |
* @interact
|
|
329 |
* 2D, 3D graphics
|
|
330 |
* Graph Theory
|
|
331 |
* Share, Publish
|
|
332 |
* print
|
|
333 |
|
|
334 |
5.5 LO: Assessment (3) [anoop]
|
|
335 |
-------------------------------
|
|
336 |
* 5 questions
|
|
337 |
* choice of exercises from one area
|
|
338 |
|
|
339 |
6 Module 6: Python Language: Basics (12)
|
|
340 |
=======================================
|
|
341 |
|
|
342 |
6.1 LO: basic datatypes & operators (4) [amit]
|
|
343 |
----------------------------------------------
|
|
344 |
* int
|
|
345 |
+ L, long
|
|
346 |
* float
|
|
347 |
+ repr, str
|
|
348 |
* complex
|
|
349 |
+ methods like imag, real
|
|
350 |
* boolean
|
|
351 |
+ short circuit logic
|
|
352 |
* conversion functions
|
|
353 |
* sequence datatypes & mutability
|
|
354 |
+ list available sequence datatypes
|
|
355 |
- string
|
|
356 |
- list
|
|
357 |
- tuple
|
|
358 |
+ mutability
|
|
359 |
+ conversion
|
|
360 |
+ common stuff
|
|
361 |
- len
|
|
362 |
- in
|
|
363 |
- max, min, sum, sorted, reversed
|
|
364 |
- accessing individual elements
|
|
365 |
- slicing, striding
|
|
366 |
- containership
|
|
367 |
|
|
368 |
6.2 LO: I/O (1) [nishanth]
|
|
369 |
--------------------------
|
|
370 |
* print statement
|
|
371 |
* raw_input
|
|
372 |
|
|
373 |
6.3 LO: conditionals (2) [Madhu]
|
|
374 |
--------------------------------
|
|
375 |
* if, elif, else
|
|
376 |
* pass
|
|
377 |
* ternary operator
|
|
378 |
|
|
379 |
6.4 LO: loops (2) [punch]
|
|
380 |
-------------------------
|
|
381 |
* while
|
|
382 |
* for
|
|
383 |
* pass, break, continue
|
|
384 |
|
|
385 |
6.5 LO: Assessment (3) [Anoop]
|
|
386 |
------------------------------
|
|
387 |
* 10 Questions
|
|
388 |
* One of collatz or armstrong numbers
|
|
389 |
|
|
390 |
|
|
391 |
7 Module 7: Python Language: Datastructures (14)
|
|
392 |
================================================
|
|
393 |
|
|
394 |
7.1 LO: manipulating lists (3) [Madhu]
|
|
395 |
--------------------------------------
|
|
396 |
* concatenation
|
|
397 |
* slicing
|
|
398 |
* striding
|
|
399 |
* .sort
|
|
400 |
* sorted
|
|
401 |
* .reverse
|
|
402 |
* reversed
|
|
403 |
|
|
404 |
7.2 LO: manipulating strings (2) [punch]
|
|
405 |
----------------------------------------
|
|
406 |
* upper, lower,
|
|
407 |
* replace
|
|
408 |
* slicing
|
|
409 |
* [::-1]
|
|
410 |
* reversed
|
|
411 |
* palindrome check
|
|
412 |
|
|
413 |
7.3 LO: getting started with tuples (2) [nishanth]
|
|
414 |
--------------------------------------------------
|
|
415 |
* immutability
|
|
416 |
* tuple packing, unpacking
|
|
417 |
+ a, b = b, a
|
|
418 |
* accessing individual elements
|
|
419 |
* slicing, striding
|
|
420 |
|
|
421 |
7.4 LO: dictionaries (2) [anoop]
|
|
422 |
--------------------------------
|
|
423 |
* empty
|
|
424 |
* filled
|
|
425 |
* accessing via keys
|
|
426 |
* .values(), .keys()
|
|
427 |
* in
|
|
428 |
* iteration
|
|
429 |
|
|
430 |
7.5 LO: sets (2) [nishanth]
|
|
431 |
---------------------------
|
|
432 |
* Operations
|
|
433 |
+ Union
|
|
434 |
+ Intersection
|
|
435 |
+ Complement
|
|
436 |
+ Symmetric Difference
|
|
437 |
* Containership
|
|
438 |
* Subset
|
|
439 |
* len
|
|
440 |
|
|
441 |
7.6 LO: Assessment (3) [amit]
|
|
442 |
-----------------------------
|
|
443 |
* 10 Questions
|
|
444 |
* Anagrams for sets and dictionaries
|
|
445 |
* A problem for lists and strings
|
|
446 |
|
|
447 |
8 Module 8: Python Language: Advanced (16)
|
|
448 |
==========================================
|
|
449 |
|
|
450 |
8.1 LO: getting started with functions (3) [nishanth]
|
|
451 |
-----------------------------------------------------
|
|
452 |
* defining function
|
|
453 |
* arguments
|
|
454 |
* docstrings
|
|
455 |
* return values
|
|
456 |
+ can return multiple values
|
|
457 |
* code reading exercises
|
|
458 |
|
|
459 |
8.2 LO: advanced features of functions (3) [punch]
|
|
460 |
--------------------------------------------------
|
|
461 |
* default arguments
|
|
462 |
* keyword arguments
|
|
463 |
* built-in functions show off
|
|
464 |
|
|
465 |
8.3 LO: using python modules (3) [anoop]
|
|
466 |
----------------------------------------
|
|
467 |
* executing python scripts from command line
|
|
468 |
* import
|
|
469 |
* scipy
|
|
470 |
* pylab
|
|
471 |
* sys
|
|
472 |
* STDLIB modules show off
|
|
473 |
|
|
474 |
8.4 LO: writing python scripts (2) [nishanth]
|
|
475 |
----------------------------------------------
|
|
476 |
* importing our own modules
|
|
477 |
* if __name__ == '__main__'
|
|
478 |
|
|
479 |
8.5 LO: testing and debugging (2) [amit]
|
|
480 |
----------------------------------------
|
|
481 |
* Types of errors and exceptions
|
|
482 |
* Strategy for debugging
|
|
483 |
+ Using print
|
|
484 |
|
|
485 |
8.6 LO: Assessment (3) [punch]
|
|
486 |
------------------------------
|
|
487 |
* 10 Questions
|
|
488 |
* Find four digit numbers whose digits are all even
|
|
489 |
* Write a script to use methods from pylab (like plot, show and other commands) and execute it as a stand-alone script
|
|
490 |
|
|
491 |
|