Skip to content

Commit

Permalink
Style (commas after , and around +)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naereen authored Jun 7, 2017
1 parent 21499d1 commit 922b98d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions uniform_quantization_experience.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
}
],
"source": [
"block = img_slice[80:88,40:48]\n",
"block = img_slice[80:88, 40:48]\n",
"\n",
"quantize_step = 5\n",
"\n",
Expand Down Expand Up @@ -194,7 +194,7 @@
}
],
"source": [
"plt.imshow(dct_slice, interpolation='nearest',cmap=plt.cm.Paired)\n",
"plt.imshow(dct_slice, interpolation='nearest', cmap=plt.cm.Paired)\n",
"plt.colorbar(shrink=1)"
]
},
Expand Down Expand Up @@ -224,7 +224,7 @@
],
"source": [
"# a 8x8 block\n",
"block = img_slice[80:88,40:48]\n",
"block = img_slice[80:88, 40:48]\n",
"\n",
"# a 2D DCT\n",
"dct_slice = fftpack.dct(fftpack.dct(block.T, norm='ortho').T, norm='ortho')\n",
Expand All @@ -234,8 +234,8 @@
"# keeps only the top left 5 element triangle\n",
"for u in range(8):\n",
" for v in range(8):\n",
" if (u+v) >5:\n",
" dct_slice[u,v] = 0\n",
" if (u + v) > 5:\n",
" dct_slice[u, v] = 0\n",
"\n",
"print(\"It compressed \", 100 - ((np.count_nonzero(dct_slice)/64) * 100), \"% of the block.\")"
]
Expand Down Expand Up @@ -273,7 +273,7 @@
}
],
"source": [
"np.set_printoptions(precision=1,linewidth=140, suppress=True)\n",
"np.set_printoptions(precision=1, linewidth=140, suppress=True)\n",
"block"
]
},
Expand Down Expand Up @@ -385,11 +385,11 @@
"\n",
"plt1.axis('off');\n",
"plt1.set_title('Original')\n",
"plt1.imshow(block, cmap='gray',interpolation='nearest')\n",
"plt1.imshow(block, cmap='gray', interpolation='nearest')\n",
"\n",
"plt2.axis('off');\n",
"plt2.set_title('Quantized')\n",
"plt2.imshow(idct_slice, cmap='gray',interpolation='nearest')"
"plt2.imshow(idct_slice, cmap='gray', interpolation='nearest')"
]
},
{
Expand Down

0 comments on commit 922b98d

Please sign in to comment.