Skip to content

Commit

Permalink
remove examples and their tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-boyu authored and rht committed Sep 11, 2023
1 parent 2df3e85 commit 66831b6
Show file tree
Hide file tree
Showing 52 changed files with 114 additions and 2,669 deletions.
24 changes: 20 additions & 4 deletions docs/examples/geo_schelling.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,24 @@
allowfullscreen>
</iframe>

```{include} ../../examples/geo_schelling/README.md
---
start-line: 3
---
## Summary

This is a geoversion of a simplified Schelling example. For the original implementation details please see the Mesa Schelling examples.

### GeoSpace

Instead of an abstract grid space, we represent the space using NUTS-2 regions to create the GeoSpace in the model.

### GeoAgent

NUTS-2 regions are the GeoAgents. The neighbors of a polygon are considered those polygons that touch its border (i.e., edge neighbours). During the running of the model, a polygon queries the colors of the surrounding polygon and if the ratio falls below a certain threshold (e.g., 40% of the same color), the agent moves to an uncolored polygon.

## How to Run

To run the model interactively, run `mesa runserver` in [this directory](https://github.com/projectmesa/mesa-examples/tree/main/gis/geo_schelling). e.g.

```bash
mesa runserver
```

Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press `Start`.
24 changes: 20 additions & 4 deletions docs/examples/geo_schelling_points.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,24 @@
allowfullscreen>
</iframe>

```{include} ../../examples/geo_schelling_points/README.md
---
start-line: 3
---
## Summary

This is a geoversion of a simplified Schelling example.

### GeoSpace

The NUTS-2 regions are considered as a shared definition of neighborhood among all people agents, instead of a locally defined neighborhood such as Moore or von Neumann.

### GeoAgent

There are two types of GeoAgents: people and regions. Each person resides in a randomly assigned region, and checks the color ratio of its region against a pre-defined "happiness" threshold at every time step. If the ratio falls below a certain threshold (e.g., 40%), the agent is found to be "unhappy", and randomly moves to another region. People are represented as points, with locations randomly chosen within their regions. The color of a region depends on the color of the majority population it contains (i.e., point in polygon calculations).

## How to run

To run the model interactively, run `mesa runserver` in [this directory](https://github.com/projectmesa/mesa-examples/tree/main/gis/geo_schelling_points). e.g.

```bash
mesa runserver
```

Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press `Start`.
25 changes: 21 additions & 4 deletions docs/examples/geo_sir.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,25 @@
allowfullscreen>
</iframe>

```{include} ../../examples/geo_sir/README.md
---
start-line: 3
---
## Summary

This is a geoversion of a simple agent-based pandemic SIR model, as an example to show the capabilities of mesa-geo.

It uses geographical data of Toronto's regions on top of a an Leaflet map to show the location of agents (in a continuous space).

Person agents are initially located in random positions in the city, then start moving around unless they die.
A fraction of agents start with an infection and may recover or die in each step.
Susceptible agents (those who have never been infected) who come in proximity with an infected agent may become infected.

Neighbourhood agents represent neighbourhoods in the Toronto, and become hot-spots (colored red) if there are infected agents inside them.
Data obtained from [this link](http://adamw523.com/toronto-geojson/).

## How to run

To run the model interactively, run `mesa runserver` in [this directory](https://github.com/projectmesa/mesa-examples/tree/main/gis/geo_sir). e.g.

```bash
mesa runserver
```

Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press `Start`.
24 changes: 20 additions & 4 deletions docs/examples/population.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,24 @@
allowfullscreen>
</iframe>

```{include} ../../examples/population/README.md
---
start-line: 3
---
## Summary

This is an implementation of the [Uganda Example](https://github.com/abmgis/abmgis/tree/master/Chapter05-GIS/Models/UgandaExample) in Python, using [Mesa](https://github.com/projectmesa/mesa) and [Mesa-Geo](https://github.com/projectmesa/mesa-geo).

### GeoSpace

The GeoSpace consists of both a raster and a vector layer. The raster layer contains population data for each cell, and it is this data that is used for model initialisation, in the sense creating the agents. The vector layer shown in blue color represents a lake in Uganda. It overlays with the raster layer to mask out the cells that agents cannot move into.

### GeoAgent

The GeoAgents are people, created based on the population data. As this is a simple example model, the agents only move randomly to neighboring cells at each time step. To make the simulation more realistic and visually appealing, the agents in the same cell have a randomized position within the cell, so that they don’t stand on top of each other at exactly the same coordinate.

## How to run

To run the model interactively, run `mesa runserver` in [this directory](https://github.com/projectmesa/mesa-examples/tree/main/gis/population). e.g.

```bash
mesa runserver
```

Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press `Start`.
24 changes: 20 additions & 4 deletions docs/examples/rainfall.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,24 @@
allowfullscreen>
</iframe>

```{include} ../../examples/rainfall/README.md
---
start-line: 3
---
## Summary

This is an implementation of the [Rainfall Model](https://github.com/abmgis/abmgis/tree/master/Chapter06-IntegratingABMandGIS/Models/Rainfall) in Python, using [Mesa](https://github.com/projectmesa/mesa) and [Mesa-Geo](https://github.com/projectmesa/mesa-geo). Inspired by the NetLogo [Grand Canyon model](http://ccl.northwestern.edu/netlogo/models/GrandCanyon), this is an example of how a digital elevation model (DEM) can be used to create an artificial world.

### GeoSpace

The GeoSpace contains a raster layer representing elevations. It is this elevation value that impacts how the raindrops move over the terrain. Apart from `elevation`, each cell of the raster layer also has a `water_level` attribute that is used to track the amount of water it contains.

### GeoAgent

In this example, the raindrops are the GeoAgents. At each time step, raindrops are randomly created across the landscape to simulate rainfall. The raindrops flow from cells of higher elevation to lower elevation based on their eight surrounding cells (i.e., Moore neighbourhood). The raindrop also has its own height, which allows them to accumulate, gain height and flow if they are trapped at places such as potholes, pools, or depressions. When they reach the boundary of the GeoSpace, they are removed from the model as outflow.

## How to run

To run the model interactively, run `mesa runserver` in [this directory](https://github.com/projectmesa/mesa-examples/tree/main/gis/rainfall). e.g.

```bash
mesa runserver
```

Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press `Start`.
16 changes: 12 additions & 4 deletions docs/examples/urban_growth.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@
allowfullscreen>
</iframe>

```{include} ../../examples/urban_growth/README.md
---
start-line: 3
---
## Summary

This is an implementation of the [UrbanGrowth Model](https://github.com/abmgis/abmgis/tree/master/Chapter06-IntegratingABMandGIS/Models/UrbanGrowth) in Python, using [Mesa](https://github.com/projectmesa/mesa) and [Mesa-Geo](https://github.com/projectmesa/mesa-geo).

## How to run

To run the model interactively, run `mesa runserver` in [this directory](https://github.com/projectmesa/mesa-examples/tree/main/gis/urban_growth). e.g.

```bash
mesa runserver
```

Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press `Start`.
16 changes: 0 additions & 16 deletions examples/README.md

This file was deleted.

25 changes: 0 additions & 25 deletions examples/geo_schelling/README.md

This file was deleted.

Loading

0 comments on commit 66831b6

Please sign in to comment.