Skip to content

Commit c61da8e

Browse files
committed
Updating README requirements, example script and links to notebooks.
1 parent 06212bd commit c61da8e

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

README.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,25 @@ This Python package allows simulation of dynamic 2D odour concentration fields w
1010

1111
### Installation and requirements
1212

13-
`pompy` was developed in Python 2.7. For basic usage of the models the two dependencies are NumPy and SciPy. For the demonstrations Matplotlib is also required. To install in the current Python environment run
13+
`pompy` was developed in Python 2.7 though it may be compatible with newer Python versions. For basic usage of the models the two dependencies are NumPy and SciPy. For the demonstrations in the `pompy.demo` module Matplotlib is also required. The [`requirements.txt`](requirements.txt) file lists versions of NumPy, SciPy and Matplotlib known to work with `pompy`. A Jupyter notebook server installation will also be required to run the example notebooks locally.
14+
15+
To install `pompy` in the current Python environment run
1416

1517
```
1618
python setup.py install
1719
```
1820

19-
### Example usage
21+
and to install the Python requirements using `pip` run
22+
23+
```
24+
pip install -r requirements.txt
25+
```
26+
27+
### Documentation
28+
29+
Two Jupyter notebooks showing examples of using the package are included in the repository root directory. The [`Farrell et al. (2002) example.ipynb`](Farrell%20et%20al.%20%282002%29%20example.ipynb) notebook file illustrates an example of using the `pompy` package to generate an animation of an odour plume using the simulation parameters described in Farrell et al. (2002) and includes keys to match the symbols used to define the parameter in the paper with the relevant `pompy` class attributes. The [`Demonstration.ipynb`](Demonstrations.ipynb) and accompanying module `pompy.demos` give several other examples of setting up plume models using `pompy` and visualising the simulations.
2030

21-
See also `pompy/demos.py` module. The below script will generate a 20 second MP4 animation (see above for GIF version) of a generated plume with model parameters consistent with those proposed in the Farrell et al. (2002) paper
31+
The below script will generate a 20 second MP4 animation (see above for GIF version) of a generated plume with model parameters consistent with those proposed in the Farrell et al. (2002) paper.
2232

2333
```python
2434
from pompy import models, processors
@@ -30,25 +40,28 @@ from matplotlib.animation import FuncAnimation
3040
seed = 20180517
3141
rng = np.random.RandomState(seed)
3242

43+
# Define wind model simulation region
44+
wind_region = models.Rectangle(x_min=0., x_max=100., y_min=-50., y_max=50.)
45+
3346
# Define wind model parameters
34-
wind_model_params = {
35-
'sim_region': models.Rectangle(x_min=0., x_max=100., y_min=-50., y_max=50.),
47+
wind_model_params = {
3648
'n_x': 21,
3749
'n_y': 21,
3850
'u_av': 1.,
3951
'v_av': 0.,
40-
'k_x': 2.,
41-
'k_y': 2.,
52+
'k_x': 10.,
53+
'k_y': 10.,
4254
'noise_gain': 20.,
4355
'noise_damp': 0.1,
4456
'noise_bandwidth': 0.2,
57+
'use_original_noise_updates': True
4558
}
4659

4760
# Create wind model object
48-
wind_model = models.WindModel(rng=rng, **wind_model_params)
61+
wind_model = models.WindModel(wind_region, rng=rng, **wind_model_params)
4962

5063
# Define plume simulation region
51-
# This is a subset of the wind simulation region to minimise boundary effects
64+
# This is a subset of the wind simulation region
5265
sim_region = models.Rectangle(x_min=0., x_max=50., y_min=-12.5, y_max=12.5)
5366

5467
# Define plume model parameters
@@ -92,6 +105,10 @@ conc_im = ax.imshow(
92105
# Simulation timestep
93106
dt = 0.01
94107

108+
# Run wind model forward to equilibrate
109+
for k in range(2000):
110+
wind_model.update(dt)
111+
95112
# Define animation update function
96113
def update(i):
97114
# Do 10 time steps per frame update

plume.gif

17.3 KB
Loading

0 commit comments

Comments
 (0)