Skip to content

Commit

Permalink
Expand docstring example
Browse files Browse the repository at this point in the history
  • Loading branch information
mdpiper committed Sep 8, 2023
1 parent ab9b045 commit 710ffae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lessons/python/ivy-diffusion/ivy_diffusion/diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@ class Diffusion:
>>> from .diffusion import Diffusion
>>> m = Diffusion(diffusivity=0.25)
>>> m.concentration = np.zeros(m.shape)
>>> m.concentration[int(m.shape/2)] = 5
>>> m.concentration[m.shape//2] = 5
>>> m.concentration
array([0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0])
>>> m.time_step
1.0
>>> m.time
0.0
>>> m.update()
>>> m.time
1.0
>>> m.concentration
array([0.0, 0.0, 0.0, 0.0, 1.2, 2.5, 1.2, 0.0, 0.0, 0.0])
>>> m.update()
>>> m.time
2.0
>>> m.concentration
array([0.0, 0.0, 0.0, 0.3, 1.2, 1.9, 1.2, 0.3, 0.0, 0.0])
"""

def __init__(self, shape=10, spacing=1.0, diffusivity=1.0):
Expand Down

0 comments on commit 710ffae

Please sign in to comment.