Skip to content

Commit a6afd8d

Browse files
authored
Merge pull request #203 from rossbar/maint/deprecations-in-deps
MAINT: Handle warnings in tutorials
2 parents fd73d14 + db5a326 commit a6afd8d

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

content/save-load-arrays.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ print(load_xy.files)
127127
```
128128

129129
```{code-cell}
130-
whos
130+
%whos
131131
```
132132

133133
## Reassign the NpzFile arrays to `x` and `y`

content/tutorial-plotting-fractals.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,14 @@ For example, setting $c = \frac{\pi}{10}$ gives us a very elegant cloud shape, w
301301

302302
```{code-cell} ipython3
303303
output = julia(mesh, c=np.pi/10, num_iter=20)
304-
kwargs = {'title': 'f(z) = z^2 + \dfrac{\pi}{10}', 'cmap': 'plasma'}
304+
kwargs = {'title': r'f(z) = z^2 + \dfrac{\pi}{10}', 'cmap': 'plasma'}
305305
306306
plot_fractal(output, **kwargs);
307307
```
308308

309309
```{code-cell} ipython3
310310
output = julia(mesh, c=-0.75 + 0.4j, num_iter=20)
311-
kwargs = {'title': 'f(z) = z^2 - \dfrac{3}{4} + 0.4i', 'cmap': 'Greens_r'}
311+
kwargs = {'title': r'f(z) = z^2 - \dfrac{3}{4} + 0.4i', 'cmap': 'Greens_r'}
312312
313313
plot_fractal(output, **kwargs);
314314
```
@@ -334,7 +334,7 @@ def mandelbrot(mesh, num_iter=10, radius=2):
334334

335335
```{code-cell} ipython3
336336
output = mandelbrot(mesh, num_iter=50)
337-
kwargs = {'title': 'Mandelbrot \ set', 'cmap': 'hot'}
337+
kwargs = {'title': 'Mandelbrot \\ set', 'cmap': 'hot'}
338338
339339
plot_fractal(output, **kwargs);
340340
```
@@ -370,8 +370,6 @@ for deg, ax in enumerate(axes.ravel()):
370370
diverge_len = general_julia(mesh, f=power, num_iter=15)
371371
ax.imshow(diverge_len, extent=[-2, 2, -2, 2], cmap='binary')
372372
ax.set_title(f'$f(z) = z^{degree} -1$')
373-
374-
fig.tight_layout();
375373
```
376374

377375
Needless to say, there is a large amount of exploring that can be done by fiddling with the inputted function, value of $c$, number of iterations, radius and even the density of the mesh and choice of colours.
@@ -419,7 +417,7 @@ p.deriv()
419417

420418
```{code-cell} ipython3
421419
output = newton_fractal(mesh, p, p.deriv(), num_iter=15, r=2)
422-
kwargs = {'title': 'f(z) = z - \dfrac{(z^8 + 15z^4 - 16)}{(8z^7 + 60z^3)}', 'cmap': 'copper'}
420+
kwargs = {'title': r'f(z) = z - \dfrac{(z^8 + 15z^4 - 16)}{(8z^7 + 60z^3)}', 'cmap': 'copper'}
423421
424422
plot_fractal(output, **kwargs)
425423
```
@@ -443,7 +441,7 @@ def d_tan(z):
443441

444442
```{code-cell} ipython3
445443
output = newton_fractal(mesh, f_tan, d_tan, num_iter=15, r=50)
446-
kwargs = {'title': 'f(z) = z - \dfrac{sin(z)cos(z)}{2}', 'cmap': 'binary'}
444+
kwargs = {'title': r'f(z) = z - \dfrac{sin(z)cos(z)}{2}', 'cmap': 'binary'}
447445
448446
plot_fractal(output, **kwargs);
449447
```
@@ -475,7 +473,7 @@ We will denote this one 'Wacky fractal', as its equation would not be fun to try
475473

476474
```{code-cell} ipython3
477475
output = newton_fractal(small_mesh, sin_sum, d_sin_sum, num_iter=10, r=1)
478-
kwargs = {'title': 'Wacky \ fractal', 'figsize': (6, 6), 'extent': [-1, 1, -1, 1], 'cmap': 'terrain'}
476+
kwargs = {'title': 'Wacky \\ fractal', 'figsize': (6, 6), 'extent': [-1, 1, -1, 1], 'cmap': 'terrain'}
479477
480478
plot_fractal(output, **kwargs)
481479
```
@@ -550,7 +548,7 @@ def accident(z):
550548

551549
```{code-cell} ipython3
552550
output = general_julia(mesh, f=accident, num_iter=15, c=0, radius=np.pi)
553-
kwargs = {'title': 'Accidental \ fractal', 'cmap': 'Blues'}
551+
kwargs = {'title': 'Accidental \\ fractal', 'cmap': 'Blues'}
554552
555553
plot_fractal(output, **kwargs);
556554
```

content/tutorial-svd.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ After this tutorial, you should be able to:
3535

3636
## Content
3737

38-
In this tutorial, we will use a [matrix decomposition](https://en.wikipedia.org/wiki/Matrix_decomposition) from linear algebra, the Singular Value Decomposition, to generate a compressed approximation of an image. We'll use the `face` image from the [scipy.misc](https://docs.scipy.org/doc/scipy/reference/misc.html#module-scipy.misc) module:
38+
In this tutorial, we will use a [matrix decomposition](https://en.wikipedia.org/wiki/Matrix_decomposition) from linear algebra, the Singular Value Decomposition, to generate a compressed approximation of an image. We'll use the `face` image from the [scipy.datasets](https://docs.scipy.org/doc/scipy/reference/datasets.html) module:
3939

4040
```{code-cell}
41-
from scipy import misc
41+
# TODO: Rm try-except with scipy 1.10 is the minimum supported version
42+
try:
43+
from scipy.datasets import face
44+
except ImportError: # Data was in scipy.misc prior to scipy v1.10
45+
from scipy.misc import face
4246
43-
img = misc.face()
47+
img = face()
4448
```
4549

4650
**Note**: If you prefer, you can use your own image as you work through this tutorial. In order to transform your image into a NumPy array that can be manipulated, you can use the `imread` function from the [matplotlib.pyplot](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.html#module-matplotlib.pyplot) submodule. Alternatively, you can use the [imageio.imread](https://imageio.readthedocs.io/en/stable/userapi.html#imageio.imread) function from the `imageio` library. Be aware that if you use your own image, you'll likely need to adapt the steps below. For more information on how images are treated when converted to NumPy arrays, see [A crash course on NumPy for images](https://scikit-image.org/docs/stable/user_guide/numpy_images.html) from the `scikit-image` documentation.
@@ -91,7 +95,7 @@ img[:, :, 0]
9195
```
9296

9397
From the output above, we can see that every value in `img[:, :, 0]` is an integer value between 0 and 255, representing the level of red in each corresponding image pixel (keep in mind that this might be different if you
94-
use your own image instead of [scipy.misc.face](https://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.face.html#scipy.misc.face)).
98+
use your own image instead of [scipy.datasets.face](https://docs.scipy.org/doc/scipy/reference/generated/scipy.datasets.face.html)).
9599

96100
As expected, this is a 768x1024 matrix:
97101

environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ dependencies:
55
# For running the tutorials
66
- numpy
77
- scipy
8+
- pooch
89
- matplotlib
910
- pandas
1011
- imageio

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# For the tutorials
22
numpy
33
scipy
4+
pooch # for scipy.datasets
45
matplotlib
56
pandas
67
imageio

0 commit comments

Comments
 (0)