From 1f366d908dd6356f5bcd9b093b10c7f86dc0a593 Mon Sep 17 00:00:00 2001 From: Azalee Bostroem Date: Fri, 15 May 2015 21:34:44 -0700 Subject: [PATCH 1/2] adding ipythonblocks show_color example to fix last FIXME --- discussion.md | 2 +- fig/ipythonblocks_show_color_example.png | Bin 0 -> 4478 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 fig/ipythonblocks_show_color_example.png diff --git a/discussion.md b/discussion.md index 9a923f708..d5b79f82c 100644 --- a/discussion.md +++ b/discussion.md @@ -295,7 +295,7 @@ from ipythonblocks import show_color show_color(214, 90, 127) ~~~ -FIXME: color image +![](fig/ipythonblocks_show_color_example.png) It also provides a table of standard colors: diff --git a/fig/ipythonblocks_show_color_example.png b/fig/ipythonblocks_show_color_example.png new file mode 100644 index 0000000000000000000000000000000000000000..779875efbc36dad915397543d00a7655f5633558 GIT binary patch literal 4478 zcmeHJhf`B+vrj^h-jptCKnS9cAVme~Ed)?NK?$8uLl=;M8k!V=AiXLe9i%EK2!>w8 zkBD@YCcR6M7LXg%_l21|bN_++otblHpWXfK?r+bt&pDwwHxUf9+_V4yfB~tlati>U z5FyLz)F;SKQUkXe06?pVQC8MLDl0>D++1uhj@D!|Luvw6@AeRT2$67=@aZHUL|}va z0S)Byb#*qdZYa`E2NWC#^;Dr$V`UM#W2ILQM1=5JsRA=)Rh?5z}XaKAq zx3K{uwpBpAdj#3!t_CXaYm+ zYJz0^4WeLHw1K{TP3tk=sdOo&y1@!tq_yoQgaK-h6G5Bsh zgDV}qA3}jPxIt4CIO30?4*0>$mZ|tMianbtS*f4-v>~;(vZBs4R*Dwo&?x2@g`H2( ze9nuHUuG!l$ZnkX;I5`NdA$3A>Jvob#6A!g$dUx=v0xYky!9I@yUs(6XzUzQ@nU;U z#ZmutT%(FzjEV*DR?V*E9cx|$an5Fc$rk4YN$<6!D-;&h*|=?82^~cliCFeb7h|ea(KCwdUCu!S5@4okp5!*Mf42fYBs4S zcCKaP+$>>(##+GIXz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vmclo7K3frw6I0DZ)?eF2iac9+-ZUox_dncT*KGnaY2B zaBbgi-*RyxQ;=5sV%kgj;{Cqu0h)}Y|$OfKODLjlI1l<@@u7b`!}6t ztY#;Bu$YzHys(kNTKP@?{S1=jMqBjUqV~3Se0qdD_7TnAnitf`W_olhaGfM3jq)M? zQ_{Gqquc=ix>JWY5Rmem6953_VDt<;3~p#iTe>*GEUaA6)-W$8SF$$%Amb%X7M-j; zEFfM^j?V7VUb1|@J*3IafDUMZNK}Lz&h4{Iez-ZYfmoNAmvb0R%Y!yIe}E=?7(6UKWM%$u zV;~CuZOotT`2SKd pcp-*QuRTT_jW@(q0P?>>!Py9Oq3s?k Date: Fri, 15 May 2015 21:35:13 -0700 Subject: [PATCH 2/2] regenerating html --- discussion.html | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/discussion.html b/discussion.html index e8909d1bf..772c5349a 100644 --- a/discussion.html +++ b/discussion.html @@ -80,7 +80,7 @@

The Call Stack

The big idea here is encapsulation, and it’s the key to writing correct, comprehensible programs. A function’s job is to turn several operations into one so that we can think about a single function call instead of a dozen or a hundred statements each time we want to do something. That only works if functions don’t interfere with each other; if they do, we have to pay attention to the details once again, which quickly overloads our short-term memory.

-

Following the call stack

+

Following the call stack

We previously wrote functions called fence and outer. Draw a diagram showing how the call stack changes when we run the following:

@@ -96,7 +96,6 @@

Image Grids

grid.show()
-

Just like a NumPy array, an ImageGrid has some properties that hold information about it:

print 'grid width:', grid.width
@@ -107,8 +106,7 @@ 

Image Grids

grid lines on: True

The obvious thing to do with a grid like this is color in its cells, but in order to do that, we need to know how computers represent color. The most common schemes are RGB, which is short for “red, green, blue”. RGB is an additive color model: every shade is some combination of red, green, and blue intensities. We can think of these three values as being the axes in a cube:

-RGB Color Cube -

RGB Color Cube

+RGB Color Cube

RGB Color Cube

An RGB color is an example of a multi-part value: like a Cartesian coordinate, it is one thing with several parts. We can represent such a value in Python using a tuple, which we write using parentheses instead of the square brackets used for a list:

position = (12.3, 45.6)
@@ -144,12 +142,13 @@ 

Image Grids

row.show()
-

Simple color values like (0,255,0) are easy enough to decipher with a bit of practice, but what color is (214,90,127)? To help us, ipythonblocks provides a function called show_color:

from ipythonblocks import show_color
 show_color(214, 90, 127)
-

FIXME: color image

+
+ +

It also provides a table of standard colors:

from ipythonblocks import colors
 c = ImageGrid(3, 2)
@@ -162,11 +161,10 @@ 

Image Grids

c.show()
-
-

Making a colorbar

+

Making a colorbar

Fill in the ____ in the code below to create a bar that changes color from dark blue to black.

@@ -178,7 +176,7 @@

Makin

-

Why RGB?

+

Why RGB?

Why do computers use red, green, and blue as their primary colors?

@@ -186,7 +184,7 @@

Why RGB?

-

Nested loops

+

Nested loops

Will changing the nesting of the loops in the code above — i.e., wrapping the Y-axis loop around the X-axis loop — change the final image? Why or why not?

@@ -194,7 +192,7 @@

Nested loo

-

Where to change data

+

Where to change data

Why did we transpose our data outside our heat map function? Why not have the function perform the transpose?

@@ -202,7 +200,7 @@

Wh

-

Design choice: return versus display

+

Design choice: return versus display

Why does the heat map function return the grid rather than displaying it immediately? Do you think this is a good or bad design choice?