Skip to content

Commit 65feccd

Browse files
committed
PEP 8
1 parent c21f77c commit 65feccd

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ htmlhelp:
7373
@echo "Build finished; now you can run HTML Help Workshop with the" \
7474
".hhp project file in build/htmlhelp."
7575

76-
latex:
76+
latex: cleandoctrees
7777
mkdir -p build/latex build/doctrees
7878
$(SPHINXBUILD) -b $@ $(ALLSPHINXOPTS) build/latex
7979
@echo
@@ -109,7 +109,7 @@ zip: html pdf
109109
cp ScipyLectures.pdf build/scipy_lecture_notes;
110110
zip -r build/scipy_lecture_notes.zip build/scipy_lecture_notes
111111

112-
install: cleandoctrees pdf html
112+
install: cleandoctrees html pdf
113113
rm -rf build/scipy-lectures.github.com
114114
cd build/ && \
115115
git clone [email protected]:scipy-lectures/scipy-lectures.github.com.git && \

intro/image_processing/image_processing.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ Image filtering
5252
>>> lena = misc.lena()
5353
>>> import numpy as np
5454
>>> noisy_lena = np.copy(lena).astype(np.float)
55-
>>> noisy_lena += lena.std()*0.5*np.random.standard_normal(lena.shape)
55+
>>> noisy_lena += lena.std() * 0.5 * np.random.standard_normal(lena.shape)
5656
>>> blurred_lena = ndimage.gaussian_filter(noisy_lena, sigma=3)
5757
>>> median_lena = ndimage.median_filter(blurred_lena, size=5)
5858
>>> from scipy import signal
59-
>>> wiener_lena = signal.wiener(blurred_lena, (5,5))
59+
>>> wiener_lena = signal.wiener(blurred_lena, (5, 5))
6060

6161
.. figure:: image_processing/filtered_lena.png
6262
:align: center
@@ -89,7 +89,7 @@ in order to modify other geometrical structures.
8989
Let us first generate a structuring element ::
9090

9191
>>> el = ndimage.generate_binary_structure(2, 1)
92-
>>> el# doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
92+
>>> el # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
9393
array([[False, True, False],
9494
[...True, True, True],
9595
[False, True, False]], dtype=bool)
@@ -100,7 +100,7 @@ Let us first generate a structuring element ::
100100

101101
* **Erosion** ::
102102

103-
>>> a = np.zeros((7,7), dtype=np.int)
103+
>>> a = np.zeros((7, 7), dtype=np.int)
104104
>>> a[1:6, 2:5] = 1
105105
>>> a
106106
array([[0, 0, 0, 0, 0, 0, 0],
@@ -147,16 +147,17 @@ Let us first generate a structuring element ::
147147

148148
* **Opening** ::
149149

150-
>>> a = np.zeros((5,5), dtype=np.int)
151-
>>> a[1:4, 1:4] = 1; a[4, 4] = 1
150+
>>> a = np.zeros((5, 5), dtype=np.int)
151+
>>> a[1:4, 1:4] = 1
152+
>>> a[4, 4] = 1
152153
>>> a
153154
array([[0, 0, 0, 0, 0],
154155
[0, 1, 1, 1, 0],
155156
[0, 1, 1, 1, 0],
156157
[0, 1, 1, 1, 0],
157158
[0, 0, 0, 0, 1]])
158159
>>> # Opening removes small objects
159-
>>> ndimage.binary_opening(a, structure=np.ones((3,3))).astype(np.int)
160+
>>> ndimage.binary_opening(a, structure=np.ones((3, 3))).astype(np.int)
160161
array([[0, 0, 0, 0, 0],
161162
[0, 1, 1, 1, 0],
162163
[0, 1, 1, 1, 0],
@@ -183,7 +184,7 @@ image. ::
183184

184185
>>> a = np.zeros((50, 50))
185186
>>> a[10:-10, 10:-10] = 1
186-
>>> a += 0.25*np.random.standard_normal(a.shape)
187+
>>> a += 0.25 * np.random.standard_normal(a.shape)
187188
>>> mask = a>=0.5
188189
>>> opened_mask = ndimage.binary_opening(mask)
189190
>>> closed_mask = ndimage.binary_closing(opened_mask)
@@ -203,9 +204,9 @@ For *gray-valued* images, eroding (resp. dilating) amounts to replacing
203204
a pixel by the minimal (resp. maximal) value among pixels covered by the
204205
structuring element centered on the pixel of interest. ::
205206

206-
>>> a = np.zeros((7,7), dtype=np.int)
207+
>>> a = np.zeros((7, 7), dtype=np.int)
207208
>>> a[1:6, 1:6] = 3
208-
>>> a[4,4] = 2; a[2,3] = 1
209+
>>> a[4, 4] = 2; a[2, 3] = 1
209210
>>> a
210211
array([[0, 0, 0, 0, 0, 0, 0],
211212
[0, 3, 3, 3, 3, 3, 0],
@@ -214,7 +215,7 @@ structuring element centered on the pixel of interest. ::
214215
[0, 3, 3, 3, 2, 3, 0],
215216
[0, 3, 3, 3, 3, 3, 0],
216217
[0, 0, 0, 0, 0, 0, 0]])
217-
>>> ndimage.grey_erosion(a, size=(3,3))
218+
>>> ndimage.grey_erosion(a, size=(3, 3))
218219
array([[0, 0, 0, 0, 0, 0, 0],
219220
[0, 0, 0, 0, 0, 0, 0],
220221
[0, 0, 1, 1, 1, 0, 0],
@@ -230,7 +231,7 @@ Measurements on images
230231
Let us first generate a nice synthetic binary image. ::
231232

232233
>>> x, y = np.indices((100, 100))
233-
>>> sig = np.sin(2*np.pi*x/50.)*np.sin(2*np.pi*y/50.)*(1+x*y/50.**2)**2
234+
>>> sig = np.sin(2*np.pi*x/50.) * np.sin(2*np.pi*y/50.) * (1+x*y/50.**2)**2
234235
>>> mask = sig > 1
235236

236237
Now we look for various information about the objects in the image::

0 commit comments

Comments
 (0)