You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,68 @@ SpatialPy provides simple object-oriented abstractions for defining a model of a
74
74
75
75
The `run()` method can be customized using keyword arguments to select different solvers, random seed, data return type and more. For more detailed examples on how to use SpatialPy, please see the Jupyter notebooks contained in the [examples](https://github.com/StochSS/SpatialPy/tree/main/examples) subdirectory.
76
76
77
+
### _Simple example to illustrate the use of SpatialPy_
78
+
79
+
In SpatialPy, a model is expressed as an object. Components, such as the domains, reactions, biochemical species, and characteristics such as the time span for simulation, are all defined within the model. The following Python code represents our spatial birth death model using SpatialPy's facility:
80
+
81
+
```python
82
+
defcreate_birth_death(parameter_values=None):
83
+
# First call the gillespy2.Model initializer.
84
+
model = spatialpy.Model(name='Spatial Birth-Death')
85
+
86
+
# Define Domain Type IDs as constants of the Model
87
+
model.HABITAT="Habitat"
88
+
89
+
# Define domain points and attributes of a regional space for simulation.
Given the model creation function above, the model can be simulated by first instantiating the model object, and then invoking the run() method on the object. The following code will run the model once to produce a sample trajectory:
123
+
124
+
```python
125
+
model = create_birth_death()
126
+
results = model.run()
127
+
```
128
+
129
+
The results are then stored in a class `Results` object for single trajectory or for multiple trajectories. Results can be plotted with plotly (offline) using `plot_species()` or in matplotlib using `plot_species(use_matplotlib=True)`. For additional plotting options such as plotting from a selection of species, or statistical plotting, please see the documentation.:
The files in this directory are runnable Python examples of using [SpatialPy](https://github.com/StochSS/SpatialPy) to perform spatial deterministic/stochastic reaction-diffusion-advection simulations. In terms of biology, they are overly simplistic and do not capture the real-life complexity of the process being modeled – the aim is not biological realism but rather to illustrate basic usage of [SpatialPy](https://github.com/StochSS/SpatialPy).
5
+
6
+
*[Start Here](Start_Here.ipynb)– a [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/stable/) demonstrating the use of SpatialPy on a simple spatial Birth Death model.
7
+
8
+
*[3D Cylinder Demo](3D_Cylinder_Demo.ipynb)– a [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/stable/) demonstrating reaction diffusion simulations using SpatialPy.
9
+
10
+
*[Gravity](Gravity.ipynb) and [Weir](Weir.ipynb)– are [Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/stable/) demonstrating fluid dynamics simulations using SpatialPy.
11
+
12
+
Full documentation for SpatialPy can be found at https://stochss.github.io/SpatialPy/index.html
0 commit comments