Skip to content

Commit a897f23

Browse files
author
Daniel Precioso, PhD
committed
Add Gray-Scott model implementations and update documentation
- Introduced `gray_scott.py` for 2D Gray-Scott model simulation with interactive visualization using Matplotlib. - Added `gray_scott_art.py` for an artistic version of the Gray-Scott model that utilizes an image mask for simulation. - Updated references in documentation to point to the new file structure for the Gray-Scott and Gierer-Meinhardt models. - Adjusted import paths in various `.qmd` files to reflect the new module organization.
1 parent 4cb8178 commit a897f23

13 files changed

Lines changed: 43 additions & 16 deletions

amlab/pdes/__init__.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
"""Shared PDE models and interactive demos for the Applied Math Lab package."""
1+
"""Backward-compatible re-exports from amlab.pdes_1d and amlab.pdes_2d."""
22

3-
from .gierer_meinhardt_1d import (
3+
from amlab.pdes_1d.gierer_meinhardt_1d import (
44
find_unstable_spatial_modes as find_unstable_spatial_modes_1d,
55
)
6-
from .gierer_meinhardt_1d import gierer_meinhardt_pde as gierer_meinhardt_pde_1d
7-
from .gierer_meinhardt_1d import is_turing_instability
8-
from .gierer_meinhardt_2d import (
6+
from amlab.pdes_1d.gierer_meinhardt_1d import (
7+
gierer_meinhardt_pde as gierer_meinhardt_pde_1d,
8+
)
9+
from amlab.pdes_1d.gierer_meinhardt_1d import is_turing_instability
10+
from amlab.pdes_2d.gierer_meinhardt_2d import (
911
find_unstable_spatial_modes as find_unstable_spatial_modes_2d,
1012
)
11-
from .gierer_meinhardt_2d import gierer_meinhardt_pde as gierer_meinhardt_pde_2d
12-
from .gray_scott import gray_scott_pde
13+
from amlab.pdes_2d.gierer_meinhardt_2d import (
14+
gierer_meinhardt_pde as gierer_meinhardt_pde_2d,
15+
)
16+
from amlab.pdes_2d.gray_scott import gray_scott_pde
1317

1418
__all__ = [
1519
"find_unstable_spatial_modes_1d",

amlab/pdes_1d/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""1D PDE models for the Applied Math Lab package."""
2+
3+
from .gierer_meinhardt_1d import (
4+
find_unstable_spatial_modes,
5+
gierer_meinhardt_pde,
6+
is_turing_instability,
7+
)
8+
9+
__all__ = [
10+
"find_unstable_spatial_modes",
11+
"gierer_meinhardt_pde",
12+
"is_turing_instability",
13+
]

amlab/pdes_2d/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""2D PDE models and interactive demos for the Applied Math Lab package."""
2+
3+
from .gierer_meinhardt_2d import find_unstable_spatial_modes, gierer_meinhardt_pde
4+
from .gray_scott import gray_scott_pde
5+
6+
__all__ = [
7+
"find_unstable_spatial_modes",
8+
"gierer_meinhardt_pde",
9+
"gray_scott_pde",
10+
]

modules/pde-1d/gierer-meinhardt-1d.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ where $u(x,t)$ is the activator, $v(x,t)$ is the inhibitor, and $d$ is the diffu
3131
import matplotlib.pyplot as plt
3232
import numpy as np
3333
34-
from amlab.pdes.gierer_meinhardt_1d import gierer_meinhardt_pde
34+
from amlab.pdes_1d.gierer_meinhardt_1d import gierer_meinhardt_pde
3535
3636
np.random.seed(3)
3737
@@ -390,7 +390,7 @@ You now have a working 1D solver. The next question is theoretical: for which pa
390390
[Turing Instability](turing-instability.qmd){.btn .btn-primary}
391391
392392
::: {.callout-tip}
393-
Reference code is available in [amlab/pdes/gierer_meinhardt_1d.py](https://github.com/daniprec/BAM-Applied-Math-Lab/blob/main/amlab/pdes/gierer_meinhardt_1d.py).
393+
Reference code is available in [amlab/pdes_1d/gierer_meinhardt_1d.py](https://github.com/daniprec/BAM-Applied-Math-Lab/blob/main/amlab/pdes_1d/gierer_meinhardt_1d.py).
394394
395395
The hosted Streamlit version is available at [bam-applied-math-lab.streamlit.app](https://bam-applied-math-lab.streamlit.app/).
396396
:::

modules/pde-1d/turing-instability.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You can follow the theory on this page while running the [interactive 1D Gierer-
2626
import matplotlib.pyplot as plt
2727
import numpy as np
2828
29-
from amlab.pdes.gierer_meinhardt_1d import is_turing_instability
29+
from amlab.pdes_1d.gierer_meinhardt_1d import is_turing_instability
3030
3131
arr_a = np.linspace(0, 1, 400)
3232
arr_d = np.linspace(0, 100, 400)
@@ -308,5 +308,5 @@ Now that you know how to predict pattern-forming parameter regimes, close the 1D
308308
[PDEs in 2D](../pde-2d/index.qmd){.btn .btn-primary}
309309
310310
::: {.callout-tip}
311-
Reference code is available in [amlab/pdes/gierer_meinhardt_1d.py](https://github.com/daniprec/BAM-Applied-Math-Lab/blob/main/amlab/pdes/gierer_meinhardt_1d.py).
311+
Reference code is available in [amlab/pdes_1d/gierer_meinhardt_1d.py](https://github.com/daniprec/BAM-Applied-Math-Lab/blob/main/amlab/pdes_1d/gierer_meinhardt_1d.py).
312312
:::

0 commit comments

Comments
 (0)