diff --git a/docs/examples/3d_blobs.rst b/docs/examples/3d_blobs.rst index a9c9cc8..f181159 100644 --- a/docs/examples/3d_blobs.rst +++ b/docs/examples/3d_blobs.rst @@ -34,8 +34,8 @@ We're now ready to instantiate and run the walk: .. code-block:: python - >>> rw = pt.RandomWalk(im) - >>> rw.run(nt=1e4, nw=1e4, same_start=False, stride=100, num_proc=10) + >>> rw = pt.RandomWalk(im) + >>> rw.run(nt=1e4, nw=1e4, same_start=False, stride=100, num_proc=10) >>> rw.plot_msd() The simulation should take no longer than 45 seconds when running on a single process and should produce an MSD plot like this: @@ -47,7 +47,7 @@ Unlike the previous examples, the MSD plot clearly shows that the axial square d .. code-block:: python - >>> rw.export_walk(image=rw.im, sample=1) + >>> rw.export_walk(image=rw.im, sample=1) This arguments ``image`` sets the image to be exported to be the original domain, optionally we could leave the argument as ``None`` in which case only the walker coordinated would be exported or we could set it to ``rw.im_big`` to export the domain encompassing all the walks. Caution should be exercised when using this function as larger domains produce very large files. The second argument ``sample`` tells the function to down-sample the coordinate data by this factor. We have already set a stride to only record every 100 steps which is useful for speeding up calculating the MSD and so the sample is left as the default of 1. The export function also accepts a ``path``, ``sub`` and ``prefix`` argument which lets you specify where to save the data and what to name the subfolder at this path location and also a prefix for the filenames to be saved. By default the current working directory is used as the path, ``data`` is used for the subdirectory and ``rw_`` is used as a prefix. After running the function, which takes a few seconds to complete, inspect your current working directory which should contain the exported data. There should be 101 files in the data folder: A small file containing the coordinates of each walker at each recorded time step with extention ``.vtu`` and larger file named ``rw_image.vti``. To load and view these files in Paraview take the following steps: diff --git a/docs/examples/sierpinski_carpet.rst b/docs/examples/sierpinski_carpet.rst index 69fdcd9..0de5a11 100644 --- a/docs/examples/sierpinski_carpet.rst +++ b/docs/examples/sierpinski_carpet.rst @@ -24,13 +24,13 @@ Assuming that you are now familiar with how to import and instantiate the simula .. code-block:: python >>> def tileandblank(image, n): - >>> if n > 0: - >>> n -= 1 - >>> shape = np.asarray(np.shape(image)) - >>> image = np.tile(image, (3, 3)) - >>> image[shape[0]:2*shape[0], shape[1]:2*shape[1]] = 0 - >>> image = tileandblank(image, n) - >>> return image + >>> if n > 0: + >>> n -= 1 + >>> shape = np.asarray(np.shape(image)) + >>> image = np.tile(image, (3, 3)) + >>> image[shape[0]:2*shape[0], shape[1]:2*shape[1]] = 0 + >>> image = tileandblank(image, n) + >>> return image >>> im = np.ones([1, 1], dtype=int) >>> im = tileandblank(im, 4) @@ -42,9 +42,9 @@ We're now ready to instantiate and run the walk, this time lets test the power o .. code-block:: python - >>> rw = pt.RandomWalk(im) - >>> rw.run(nt=2500, nw=1e6, same_start=False, stride=5, num_proc=10) - >>> rw.plot_walk_2d() + >>> rw = pt.RandomWalk(im) + >>> rw.run(nt=2500, nw=1e6, same_start=False, stride=5, num_proc=10) + >>> rw.plot_walk_2d() The simulation should take no longer than a minute when running on a single process and should produce a plot like this: @@ -55,7 +55,7 @@ Like the open space example the pattern is radial because the image is isotropic .. code-block:: python - >>> rw.plot_msd() + >>> rw.plot_msd() .. image:: https://imgur.com/6QPCXYq.png :align: center