Skip to content

Commit 57c7547

Browse files
added most of the ipyhton notebook samples
1 parent bc9fa66 commit 57c7547

13 files changed

Lines changed: 1142 additions & 95 deletions

File tree

556 Bytes
Binary file not shown.
9.82 KB
Binary file not shown.

‎week-06/build/slides/_sources/numpy.txt‎

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,56 @@
33
hieroglyph-quickstart on Sun Apr 27 15:13:20 2014.
44

55

6-
***************
7-
Intro to Numpy
8-
***************
6+
**********************
7+
Intro to Numpy / Scipy
8+
**********************
9+
10+
- Chris Barker
11+
12+
(April 29, 2014)
913

1014
.. Contents:
1115

1216
.. .. toctree::
1317
.. :maxdepth: 2
1418

1519

20+
Scipy
21+
-----
22+
23+
The scipy "Stack" is a collection of core packages used for scientific / numerical computing.
24+
25+
http://www.scipy.org/stackspec.html
26+
27+
Many other domain-specific packages area available:
28+
29+
Core "stack" is what most people will want, regardless of domain.
1630

31+
What's in the scipy stack?
32+
--------------------------
33+
34+
* Python (http://www.python.org)
35+
* NumPy (http://www.numpy.org)
36+
* SciPy library (http://www.scipy.org)
37+
* Matplotlib (http://matplotlib.org/)
38+
* IPython (http://ipython.org/)
39+
40+
* nose (https://nose.readthedocs.org)
41+
* pandas (http://pandas.pydata.org/)
42+
* Sympy (http://sympy.org/)
1743

1844
numpy
1945
-----
2046

21-
numpy
47+
numpy is the core package that the rest of the scipy stack is built on. Mostly what I'll talk about here.
2248

2349
Not just for lots of numbers!
2450
(but it's great for that!)
2551

26-
http://www.numpy.org/}
52+
http://www.numpy.org/
2753

28-
what is numpy?
29-
--------------
3054

31-
An N-Dimensional array object}
55+
An N-Dimensional array object
3256

3357
A whole pile of tools for operations on/with that object.
3458

@@ -84,7 +108,8 @@ What is an nd array?
84108
* PEP 3118 -- Revising the buffer protocol
85109

86110

87-
demos: ``memory.py`` and ``structure.py``
111+
demo: ``mem_struct.ipynb``
112+
88113

89114
Built-in Data Types
90115
-------------------
@@ -97,20 +122,19 @@ Built-in Data Types
97122
64, 128, 192, 256 bits
98123
* String and unicode
99124
Static length
100-
* Bool
101-
8 bit
125+
* Bool -- 8 bit
102126
* Python Object
103127
Really a pointer
104128

129+
demo: ``object.ipnb``
105130

106-
demo: ``object.py`` }
107131

108-
Compund dtypes
132+
Compound dtypes
109133
--------------
110134

111135

112136
* Can define any combination of other types
113-
Still Homogenous: Array of structs.
137+
Still Homogeneous: Array of structs.
114138
* Can name the fields
115139
* Can be like a database table
116140
* Useful for reading binary data
@@ -122,27 +146,23 @@ Array Constructors:
122146
-------------------
123147

124148
From scratch:
149+
* ``ones(), zeros(), empty(), arange(), linspace(), logspace()``
125150

126-
``ones(), zeros(), empty(), arange(), linspace(), logspace()``
127-
128-
( Default dtype: ``np.float64`` )
151+
( Default dtype: ``np.float64`` )
129152

130153
From sequences:
154+
* ``array(), asarray()`` ( Build from any sequence )
131155

132-
``array(), asarray()``
133-
134-
( Build from any sequence )
135-
136-
From binary data:
137-
138-
``fromstring(), frombuffer(), fromfile()``
156+
From binary data:
157+
* ``fromstring(), frombuffer(), fromfile()``
139158

140159
Assorted linear algebra standards:
141160

142161
``eye(), diag()``, etc.
143162

144163
demo: ``constructors.py``
145164

165+
146166
Broadcasting:
147167
-------------
148168

@@ -202,20 +222,34 @@ Tools:
202222

203223
Example of numpy+cython: http://wiki.cython.org/examples/mandelbrot
204224

205-
numpy persistance:
225+
Text File I/O
226+
--------------
227+
228+
Loading from text (CSV, etc):
229+
230+
* ``np.loadtxt``
231+
* ``np.genfromtxt`` ( a few more features )
232+
233+
Saving as text (CSV):
234+
235+
* ``np.savetxt()``
236+
237+
238+
Numpy Persistence:
206239
------------------
207240

208-
``.tofile() / fromfile()``
241+
``np.tofile() / np.fromfile()``
209242

210243
-- Just the raw bytes, no metadata
211244

212245
pickle
213246

214-
``savez()`` -- numpy zip format
247+
``np.savez()`` -- numpy zip format
215248

216249
Compact: binary dump plus metadata
217250

218251
netcdf
252+
* NetCDF4
219253

220254
Hdf
221255
* Pyhdf

‎week-06/build/slides/numpy.html‎

Lines changed: 95 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<head>
66
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
77

8-
<title>Intro to Numpy &mdash; numpy</title>
8+
<title>Intro to Numpy / Scipy &mdash; numpy</title>
99

1010
<link rel="stylesheet" href="_static/basic.css" type="text/css" />
1111
<link rel="stylesheet" href="_static/styles.css" type="text/css" />
@@ -45,33 +45,61 @@
4545

4646

4747

48-
<article class="slide level-1" id="intro-to-numpy">
48+
<article class="slide level-1" id="intro-to-numpy-scipy">
4949

50-
<h1>Intro to Numpy</h1>
50+
<h1>Intro to Numpy / Scipy</h1>
5151

52+
<ul class="simple">
53+
<li>Chris Barker</li>
54+
</ul>
55+
<p>(April 29, 2014)</p>
5256

5357

5458

5559

5660
</article>
57-
<article class="slide level-2" id="numpy">
61+
<article class="slide level-2" id="scipy">
5862

59-
<h2>numpy</h2>
63+
<h2>Scipy</h2>
6064

61-
<p>numpy</p>
62-
<p>Not just for lots of numbers!
63-
(but it's great for that!)</p>
64-
<p><a class="reference external" href="http://www.numpy.org/">http://www.numpy.org/</a>}</p>
65+
<p>The scipy &quot;Stack&quot; is a collection of core packages used for scientific / numerical computing.</p>
66+
<p><a class="reference external" href="http://www.scipy.org/stackspec.html">http://www.scipy.org/stackspec.html</a></p>
67+
<p>Many other domain-specific packages area available:</p>
68+
<blockquote>
69+
<div>Core &quot;stack&quot; is what most people will want, regardless of domain.</div></blockquote>
6570

6671

6772

6873

6974
</article>
70-
<article class="slide level-2" id="what-is-numpy">
75+
<article class="slide level-2" id="what-s-in-the-scipy-stack">
7176

72-
<h2>what is numpy?</h2>
77+
<h2>What's in the scipy stack?</h2>
7378

74-
<p>An N-Dimensional array object}</p>
79+
<ul class="simple">
80+
<li>Python (<a class="reference external" href="http://www.python.org">http://www.python.org</a>)</li>
81+
<li>NumPy (<a class="reference external" href="http://www.numpy.org">http://www.numpy.org</a>)</li>
82+
<li>SciPy library (<a class="reference external" href="http://www.scipy.org">http://www.scipy.org</a>)</li>
83+
<li>Matplotlib (<a class="reference external" href="http://matplotlib.org/">http://matplotlib.org/</a>)</li>
84+
<li>IPython (<a class="reference external" href="http://ipython.org/">http://ipython.org/</a>)</li>
85+
<li>nose (<a class="reference external" href="https://nose.readthedocs.org">https://nose.readthedocs.org</a>)</li>
86+
<li>pandas (<a class="reference external" href="http://pandas.pydata.org/">http://pandas.pydata.org/</a>)</li>
87+
<li>Sympy (<a class="reference external" href="http://sympy.org/">http://sympy.org/</a>)</li>
88+
</ul>
89+
90+
91+
92+
93+
</article>
94+
<article class="slide level-2" id="numpy">
95+
96+
<h2>numpy</h2>
97+
98+
<p>numpy is the core package that the rest of the scipy stack is built on. Mostly what I'll talk about here.</p>
99+
<p>Not just for lots of numbers!
100+
(but it's great for that!)</p>
101+
<p><a class="reference external" href="http://www.numpy.org/">http://www.numpy.org/</a></p>
102+
<p>An N-Dimensional array object</p>
75103
<p>A whole pile of tools for operations on/with that object.</p>
76104

77105

@@ -160,7 +188,7 @@ <h2>What is an nd array?</h2>
160188
</li>
161189
</ul>
162190
</div></blockquote>
163-
<p>demos: <tt class="docutils literal"><span class="pre">memory.py</span></tt> and <tt class="docutils literal"><span class="pre">structure.py</span></tt></p>
191+
<p>demo: <tt class="docutils literal"><span class="pre">mem_struct.ipynb</span></tt></p>
164192

165193

166194

@@ -196,11 +224,7 @@ <h2>Built-in Data Types</h2>
196224
</dd>
197225
</dl>
198226
</li>
199-
<li><dl class="first docutils">
200-
<dt>Bool</dt>
201-
<dd><p class="first last">8 bit</p>
202-
</dd>
203-
</dl>
227+
<li><p class="first">Bool -- 8 bit</p>
204228
</li>
205229
<li><dl class="first docutils">
206230
<dt>Python Object</dt>
@@ -210,21 +234,21 @@ <h2>Built-in Data Types</h2>
210234
</li>
211235
</ul>
212236
</div></blockquote>
213-
<p>demo: <tt class="docutils literal"><span class="pre">object.py</span></tt> }</p>
237+
<p>demo: <tt class="docutils literal"><span class="pre">object.ipnb</span></tt></p>
214238

215239

216240

217241

218242
</article>
219-
<article class="slide level-2" id="compund-dtypes">
243+
<article class="slide level-2" id="compound-dtypes">
220244

221-
<h2>Compund dtypes</h2>
245+
<h2>Compound dtypes</h2>
222246

223247
<blockquote>
224248
<div><ul>
225249
<li><dl class="first docutils">
226250
<dt>Can define any combination of other types</dt>
227-
<dd><p class="first last">Still Homogenous: Array of structs.</p>
251+
<dd><p class="first last">Still Homogeneous: Array of structs.</p>
228252
</dd>
229253
</dl>
230254
</li>
@@ -246,15 +270,24 @@ <h2>Compund dtypes</h2>
246270

247271
<h2>Array Constructors:</h2>
248272

249-
<p>From scratch:</p>
250-
<p><tt class="docutils literal"><span class="pre">ones(),</span> <span class="pre">zeros(),</span> <span class="pre">empty(),</span> <span class="pre">arange(),</span> <span class="pre">linspace(),</span> <span class="pre">logspace()</span></tt></p>
251-
<p>( Default dtype: <tt class="docutils literal"><span class="pre">np.float64</span></tt> )</p>
252-
<p>From sequences:</p>
253-
<p><tt class="docutils literal"><span class="pre">array(),</span> <span class="pre">asarray()</span></tt></p>
254-
<p>( Build from any sequence )</p>
255-
<blockquote>
256-
<div>From binary data:</div></blockquote>
257-
<p><tt class="docutils literal"><span class="pre">fromstring(),</span> <span class="pre">frombuffer(),</span> <span class="pre">fromfile()</span></tt></p>
273+
<dl class="docutils">
274+
<dt>From scratch:</dt>
275+
<dd><ul class="first simple">
276+
<li><tt class="docutils literal"><span class="pre">ones(),</span> <span class="pre">zeros(),</span> <span class="pre">empty(),</span> <span class="pre">arange(),</span> <span class="pre">linspace(),</span> <span class="pre">logspace()</span></tt></li>
277+
</ul>
278+
<p class="last">( Default dtype: <tt class="docutils literal"><span class="pre">np.float64</span></tt> )</p>
279+
</dd>
280+
<dt>From sequences:</dt>
281+
<dd><ul class="first last simple">
282+
<li><tt class="docutils literal"><span class="pre">array(),</span> <span class="pre">asarray()</span></tt> ( Build from any sequence )</li>
283+
</ul>
284+
</dd>
285+
<dt>From binary data:</dt>
286+
<dd><ul class="first last simple">
287+
<li><tt class="docutils literal"><span class="pre">fromstring(),</span> <span class="pre">frombuffer(),</span> <span class="pre">fromfile()</span></tt></li>
288+
</ul>
289+
</dd>
290+
</dl>
258291
<p>Assorted linear algebra standards:</p>
259292
<p><tt class="docutils literal"><span class="pre">eye(),</span> <span class="pre">diag()</span></tt>, etc.</p>
260293
<p>demo: <tt class="docutils literal"><span class="pre">constructors.py</span></tt></p>
@@ -333,18 +366,44 @@ <h2>Working with compiled code</h2>
333366

334367

335368
</article>
336-
<article class="slide level-2" id="numpy-persistance">
369+
<article class="slide level-2" id="text-file-i-o">
370+
371+
<h2>Text File I/O</h2>
372+
373+
<p>Loading from text (CSV, etc):</p>
374+
<blockquote>
375+
<div><ul class="simple">
376+
<li><tt class="docutils literal"><span class="pre">np.loadtxt</span></tt></li>
377+
<li><tt class="docutils literal"><span class="pre">np.genfromtxt</span></tt> ( a few more features )</li>
378+
</ul>
379+
</div></blockquote>
380+
<p>Saving as text (CSV):</p>
381+
<blockquote>
382+
<div><ul class="simple">
383+
<li><tt class="docutils literal"><span class="pre">np.savetxt()</span></tt></li>
384+
</ul>
385+
</div></blockquote>
386+
387+
388+
389+
390+
</article>
391+
<article class="slide level-2" id="numpy-persistence">
337392

338-
<h2>numpy persistance:</h2>
393+
<h2>Numpy Persistence:</h2>
339394

340-
<p><tt class="docutils literal"><span class="pre">.tofile()</span> <span class="pre">/</span> <span class="pre">fromfile()</span></tt></p>
395+
<p><tt class="docutils literal"><span class="pre">np.tofile()</span> <span class="pre">/</span> <span class="pre">np.fromfile()</span></tt></p>
341396
<blockquote>
342397
<div>-- Just the raw bytes, no metadata</div></blockquote>
343398
<p>pickle</p>
344-
<p><tt class="docutils literal"><span class="pre">savez()</span></tt> -- numpy zip format</p>
399+
<p><tt class="docutils literal"><span class="pre">np.savez()</span></tt> -- numpy zip format</p>
345400
<p>Compact: binary dump plus metadata</p>
346-
<p>netcdf</p>
347401
<dl class="docutils">
402+
<dt>netcdf</dt>
403+
<dd><ul class="first last simple">
404+
<li>NetCDF4</li>
405+
</ul>
406+
</dd>
348407
<dt>Hdf</dt>
349408
<dd><ul class="first last simple">
350409
<li>Pyhdf</li>

‎week-06/build/slides/searchindex.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)