diff --git a/content/save-load-arrays.md b/content/save-load-arrays.md index 434c7370..6768d938 100644 --- a/content/save-load-arrays.md +++ b/content/save-load-arrays.md @@ -127,7 +127,7 @@ print(load_xy.files) ``` ```{code-cell} -whos +%whos ``` ## Reassign the NpzFile arrays to `x` and `y` diff --git a/content/tutorial-plotting-fractals.md b/content/tutorial-plotting-fractals.md index e97b0cbe..a1921cea 100644 --- a/content/tutorial-plotting-fractals.md +++ b/content/tutorial-plotting-fractals.md @@ -301,14 +301,14 @@ For example, setting $c = \frac{\pi}{10}$ gives us a very elegant cloud shape, w ```{code-cell} ipython3 output = julia(mesh, c=np.pi/10, num_iter=20) -kwargs = {'title': 'f(z) = z^2 + \dfrac{\pi}{10}', 'cmap': 'plasma'} +kwargs = {'title': r'f(z) = z^2 + \dfrac{\pi}{10}', 'cmap': 'plasma'} plot_fractal(output, **kwargs); ``` ```{code-cell} ipython3 output = julia(mesh, c=-0.75 + 0.4j, num_iter=20) -kwargs = {'title': 'f(z) = z^2 - \dfrac{3}{4} + 0.4i', 'cmap': 'Greens_r'} +kwargs = {'title': r'f(z) = z^2 - \dfrac{3}{4} + 0.4i', 'cmap': 'Greens_r'} plot_fractal(output, **kwargs); ``` @@ -334,7 +334,7 @@ def mandelbrot(mesh, num_iter=10, radius=2): ```{code-cell} ipython3 output = mandelbrot(mesh, num_iter=50) -kwargs = {'title': 'Mandelbrot \ set', 'cmap': 'hot'} +kwargs = {'title': 'Mandelbrot \\ set', 'cmap': 'hot'} plot_fractal(output, **kwargs); ``` @@ -370,8 +370,6 @@ for deg, ax in enumerate(axes.ravel()): diverge_len = general_julia(mesh, f=power, num_iter=15) ax.imshow(diverge_len, extent=[-2, 2, -2, 2], cmap='binary') ax.set_title(f'$f(z) = z^{degree} -1$') - -fig.tight_layout(); ``` 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() ```{code-cell} ipython3 output = newton_fractal(mesh, p, p.deriv(), num_iter=15, r=2) -kwargs = {'title': 'f(z) = z - \dfrac{(z^8 + 15z^4 - 16)}{(8z^7 + 60z^3)}', 'cmap': 'copper'} +kwargs = {'title': r'f(z) = z - \dfrac{(z^8 + 15z^4 - 16)}{(8z^7 + 60z^3)}', 'cmap': 'copper'} plot_fractal(output, **kwargs) ``` @@ -443,7 +441,7 @@ def d_tan(z): ```{code-cell} ipython3 output = newton_fractal(mesh, f_tan, d_tan, num_iter=15, r=50) -kwargs = {'title': 'f(z) = z - \dfrac{sin(z)cos(z)}{2}', 'cmap': 'binary'} +kwargs = {'title': r'f(z) = z - \dfrac{sin(z)cos(z)}{2}', 'cmap': 'binary'} plot_fractal(output, **kwargs); ``` @@ -475,7 +473,7 @@ We will denote this one 'Wacky fractal', as its equation would not be fun to try ```{code-cell} ipython3 output = newton_fractal(small_mesh, sin_sum, d_sin_sum, num_iter=10, r=1) -kwargs = {'title': 'Wacky \ fractal', 'figsize': (6, 6), 'extent': [-1, 1, -1, 1], 'cmap': 'terrain'} +kwargs = {'title': 'Wacky \\ fractal', 'figsize': (6, 6), 'extent': [-1, 1, -1, 1], 'cmap': 'terrain'} plot_fractal(output, **kwargs) ``` @@ -550,7 +548,7 @@ def accident(z): ```{code-cell} ipython3 output = general_julia(mesh, f=accident, num_iter=15, c=0, radius=np.pi) -kwargs = {'title': 'Accidental \ fractal', 'cmap': 'Blues'} +kwargs = {'title': 'Accidental \\ fractal', 'cmap': 'Blues'} plot_fractal(output, **kwargs); ``` diff --git a/content/tutorial-svd.md b/content/tutorial-svd.md index a1fe60a4..3798636a 100644 --- a/content/tutorial-svd.md +++ b/content/tutorial-svd.md @@ -35,12 +35,16 @@ After this tutorial, you should be able to: ## Content -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: +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: ```{code-cell} -from scipy import misc +# TODO: Rm try-except with scipy 1.10 is the minimum supported version +try: + from scipy.datasets import face +except ImportError: # Data was in scipy.misc prior to scipy v1.10 + from scipy.misc import face -img = misc.face() +img = face() ``` **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] ``` 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 -use your own image instead of [scipy.misc.face](https://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.face.html#scipy.misc.face)). +use your own image instead of [scipy.datasets.face](https://docs.scipy.org/doc/scipy/reference/generated/scipy.datasets.face.html)). As expected, this is a 768x1024 matrix: diff --git a/environment.yml b/environment.yml index 137b04ca..509d1bc7 100644 --- a/environment.yml +++ b/environment.yml @@ -5,6 +5,7 @@ dependencies: # For running the tutorials - numpy - scipy + - pooch - matplotlib - pandas - imageio diff --git a/requirements.txt b/requirements.txt index 0ec30181..dd03cc89 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ # For the tutorials numpy scipy +pooch # for scipy.datasets matplotlib pandas imageio
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: