-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass1.html
408 lines (348 loc) · 14.5 KB
/
class1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>BIOF309 Course website</title>
<meta name="description" content="Course website for the Introduction to Python Class given at FAES">
<meta name="author" content="Christopher Coletta">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>BIOF 309</h1>
<h3>Class 1: Introduction and Installation</h3>
<h3>Christopher Coletta</h3>
</section>
<section data-markdown id="talk_outline">
<script type="text/template">
## Class 1 Outline
1. About Me <!-- .element: class="fragment" -->
2. Goals for the course<!-- .element: class="fragment" -->
2. About the course<!-- .element: class="fragment" -->
2. How to get help<!-- .element: class="fragment" -->
3. Discussion of programming language ecosystem and where Python fits in<!-- .element: class="fragment" -->
4. What makes Python distinctive<!-- .element: class="fragment" -->
5. The Python data analysis stack: core Python + essential 3rd party modules<!-- .element: class="fragment" -->
6. Setup of Environment<!-- .element: class="fragment" -->
7. Using Python interactively via IPython notebook<!-- .element: class="fragment" -->
8. Running a program<!-- .element: class="fragment" -->
9. Homework: Email me the magic number.<!-- .element: class="fragment" -->
</script>
</section>
<section data-markdown id="aboutme">
<script type="text/template">
## About Me
* Computer Scientist
* NIH FTE
* National Institute on Aging, JHU Bayview Campus
* Laboratory of Genetics, David Schlessinger, Chief
* Image Informatics and Computational Biology Unit, Ilya Goldberg, Head
* Specialize in computer vision, machine learning
* Project: [WND-CHARM](https://github.com/wnd-charm/wnd-charm)
* Software Engineer writing software professionally since 2006
</script>
</section>
<section data-markdown id="goals">
<script type="text/template">
## Goals for BIOF309
- To teach you how to write programs that provide insight into your data <!-- .element: class="fragment" -->
- To teach you how to think like a computer <!-- .element: class="fragment" -->
- Teach you HOW to learn other programming languages in the future. <!-- .element: class="fragment" -->
</script>
</section>
<section data-markdown id="about">
<script type="text/template">
## About the course
* Target audience: Research professionals who have not programmed before <!-- .element: class="fragment" -->
* Style of course is linear: one concept builds on the next <!-- .element: class="fragment" -->
* Screencast lectures <!-- .element: class="fragment" -->
* No required textbook <!-- .element: class="fragment" -->
* Final grade: 80% homework, 20% final project <!-- .element: class="fragment" -->
* Use Test-Driven Development paradigm for homework <!-- .element: class="fragment" -->
* I provide the homework test, so you'll know if your program works or not before you pass it in <!-- .element: class="fragment" -->
* All questions related to material and logistics: use google groups email list <!-- .element: class="fragment" -->
* Any file submission: follow naming convention lastname_firstinitial_hw99_STUFF.py <!-- .element: class="fragment" -->
</script>
</section>
<section>
<section>
<h2>How to get help</h2>
<p>
<figure>
<img src="stress_reduction_kit.png">
</figure>
</p>
</section>
<section data-markdown id="help">
<script type="text/template">
## How to get help
* If you get an error message, READ THE ERROR MESSAGE <!-- .element: class="fragment" -->
* Google error message, or google your question "How do I ..." <!-- .element: class="fragment" -->
* Trial and error <!-- .element: class="fragment" -->
* "Worst thing that can happen is that it won't work" - Coglianti <!-- .element: class="fragment" -->
* help() in the console <!-- .element: class="fragment" -->
* Email the group<!-- .element: class="fragment" -->
* BTW, links: <!-- .element: class="fragment" -->
* [Instructional Videos](http://showmedo.com) <!-- .element: class="fragment" -->
* [Beginner's Guide for non-programmers](http://wiki.python.org/moin/BeginnersGuide/NonProgrammers) <!-- .element: class="fragment" -->
* [How to think like a computer scientist](http://interactivepython.org/courselib/static/thinkcspy/index.html) <!-- .element: class="fragment" -->
* [Online Python Tutor](http://www.pythontutor.com/) <!-- .element: class="fragment" -->
* [Learn Python The Hard Way](http://learnpythonthehardway.org) <!-- .element: class="fragment" -->
</script>
</section>
</section>
<section> <!-- outer -->
<section>
<h2>Programming Languages</h2>
</section>
<section data-markdown id="expressiveness">
<script type="text/template">
##Expressiveness
![Expressiveness table](expressiveness.png "Expressiveness Table")
Figure from *"Comparison of programming languages"* [wiki article](http://en.wikipedia.org/wiki/Comparison_of_programming_languages#Expressiveness)
</script>
</section>
<section data-markdown id="static">
<script type="text/template">
##Static Programming Languages
* Examples: C, C++, Java
* FAST to run, slow to develop, difficult to "try things outs"
* Compiled into machine code before you run the program
</script>
</section>
<section>
<h2>Compiling xkcd Comic</h2>
<p>
<figure>
<a class="image" href="http://xkcd.com/303/"><img src="http://imgs.xkcd.com/comics/compiling.png"></a>
</figure>
</p>
</section>
<section data-markdown id="dynamic">
<script type="text/template">
## Dynamic Programming Languages
### a.k.a "scripting languages"
* [Dynamic programming language Wiki article](http://en.wikipedia.org/wiki/Dynamic_programming_language)
* Often used as "glue" to piece together different programs into one program
* Code not compiled ahead of time but interpreted at run time
* Slower than compiled languages
* Dynamic concept has strong overlap with "high-level programming language" concept
* Pros: Easier to use interactively (type statements in one-at-a-time, examine outputs, try things out)
* Cons: Abstraction penalty
</script>
</section>
<section data-markdown >
<script type="text/template">
## Best of Both Worlds (Advanced)
1. Write the code C and wrap it in Python
* E.g., Python packages Numpy & Scipy (and R, I think)
2. [LLVM](http://en.wikipedia.org/wiki/Low_Level_Virtual_Machine) - Compiler infrastructure that does language-agnostic program optimization
* Python package Numba does this
</script>
</section>
<section data-markdown>
<script type="text/template">
## TIOBE Index
* Measures how widely used programming languages are
* [website](http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html)
</script>
</section>
</section><!-- end outer -->
<section> <!-- begin python sect -->
<section>
<h2>Python</h2>
<p>
<figure>
<img src="python-logo-master-v3-TM.png">
</figure>
</p>
</section>
<section>
<h2>Python xkcd Comic</h2>
<p>
<figure>
<a class="image" href="http://xkcd.com/353/"><img height="441" width="389" src="http://imgs.xkcd.com/comics/python.png"></a>
</figure>
<figcaption>Randall Munroe's caption: <q>I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you.</q></figcaption>
</p>
</section>
<section>
<p>
<figure>
<img src="200px-Guido_van_Rossum_OSCON_2006.jpg">
</figure>
<figcaption>Guido van Rossum - Python Inventor and B.D.F.L.</figcaption>
</p>
</section>
<section data-markdown >
<script type="text/template">
## Brief History of Python
* Not named after the snake, but Monty Python -> FUN!
* Published in 1991, 1.0 in 1994
* Explicitly created as a teaching language
* "low-brow language," low barriers to entry, natural language syntax
* A person who programs in Python is a "Pythonista"
* The collective noun of a group of Pythonistas is [an "indentation."](https://gist.github.com/mariusGundersen/6925246)
</script>
</section>
<section data-markdown >
<script type="text/template">
## What makes python "Pythonic"
* indentation style
```python
def perm(l):
"""Compute the list of all permutations"""
if len(l) <= 1:
return [l]
r = []
for i in range(len(l)):
s = l[:i] + l[i+1:]
p = perm(s)
for x in p:
r.append(l[i:i+1] + x)
return r
```
</script>
</section>
<section data-markdown>
<script type="text/template">
## Moar "Pythonic"
* <code>import this</code>
* List comprehension
* Lambda functions
* Large core library with great types sets, dicts, etc
* Everything is an object
* Exceptions
* Built to be interactive
* Read-Evaluate-Print - one command at a time
</script>
</section>
<section>
<h2>Python Data Analysis Stack</h2>
<p>
<figure>
<img width="573" height="381" src="python_data_analysis_stack.png">
</figure>
<figcaption>Figure: Karissa McKelvey</figcaption>
</p>
</section>
<section>
<h2>Python Essential 3rd Party Modules</h2>
<p>
<figure>
<img class="stretch" src="core_3rd_party_modules.png">
</figure>
<figcaption>Figure: Karissa McKelvey</figcaption>
</p>
</section>
</section> <!-- end python sect -->
<section><!-- begin interactive-->
<section data-markdown>
<script type="text/template">
## Interactive Python
* You talking directly to the computer! <!-- .element: class="fragment" -->
* The computer talks back! <!-- .element: class="fragment" -->
* Scotty from Star Trek IV Video: <!-- .element: class="fragment" -->
* Crew of the Starship Enterprise travels back in time from the 23rd-century to the mid-1980's because blah blah blah... <!-- .element: class="fragment" -->
* Scotty, the engineer of the Enterprise, is posing as a professor with Dr. McCoy because blah blah blah... <!-- .element: class="fragment" -->
</script>
</section>
<section>
<iframe class="stretch" data-autoplay src="http://www.youtube.com/embed/v9kTVZiJ3Uc" frameborder="0" allowfullscreen></iframe>
</section>
<section data-markdown>
<script type="text/template">
## IPython Notebook
* Ideal for trying stuff out <!-- .element: class="fragment" -->
* One command at a time, one statement per line <!-- .element: class="fragment" -->
* The "kernel" - Python "engine" running in the backgorund <!-- .element: class="fragment" -->
* That what the open terminal is, just leave it be <!-- .element: class="fragment" -->
* The function and purpose of Ctrl-C <!-- .element: class="fragment" -->
* Exceptions <!-- .element: class="fragment" -->
* <code>%quickref</code> <!-- .element: class="fragment" -->
* Output cache: Out[4] or _4 for example <!-- .element: class="fragment" -->
</script>
</section>
</section><!-- end interactive -->
<section><!-- begin choice of editor -->
<section data-markdown>
<script type="text/template">
## Code Editor
* IPython Notebook
* Spyder - comes with Anaconda
* [Mac only: Sublime Text](http://www.sublimetext.com/)
* Notebook/TextEdit (for n00bs)
</script>
</section>
<section>
<p>
<figure>
<img class="stretch" src="Angelina_Jolie_hackers.jpg">
</figure>
<figcaption>vim/emacs: hax0rz only!</figcaption>
</p>
</section>
</section> <!-- end choice of editor -->
<section data-markdown>
<script type="text/template">
## In-class Exercise
* Fire up IPython Notebook
* Run [Magic Number](homework/hw1/biof309_hw1.py) program
</script>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Parallax scrolling
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
// parallaxBackgroundSize: '2100px 900px',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23176059-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>