Skip to content

Commit

Permalink
gis: use make_geospace_component in SolaraViz
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-boyu committed Dec 25, 2024
1 parent 0c93dc5 commit 2316635
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions gis/agents_and_networks/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys

from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from mesa_geo.visualization import make_geospace_component
from src.model.model import AgentsAndNetworks
from src.visualization.utils import agent_draw, make_plot_clock

Expand Down Expand Up @@ -54,7 +54,7 @@ def parse_args():
page = SolaraViz(
model,
[
make_geospace_leaflet(agent_draw, zoom=campus_params[campus]["zoom"]),
make_geospace_component(agent_draw, zoom=campus_params[campus]["zoom"]),
make_plot_clock,
make_plot_component(["status_home", "status_work", "status_traveling"]),
make_plot_component(["friendship_home", "friendship_work"]),
Expand Down
2 changes: 1 addition & 1 deletion gis/agents_and_networks/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-e .

# external requirements
mesa-geo~=0.9.0a0
mesa-geo~=0.9.0
geopandas
numpy
pandas
Expand Down
4 changes: 2 additions & 2 deletions gis/geo_schelling/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import solara
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from mesa_geo.visualization import make_geospace_component
from model import GeoSchelling


Expand Down Expand Up @@ -33,7 +33,7 @@ def schelling_draw(agent):
page = SolaraViz(
model,
[
make_geospace_leaflet(schelling_draw, zoom=4),
make_geospace_component(schelling_draw, zoom=4),
make_plot_component(["happy"]),
make_plot_happiness,
],
Expand Down
2 changes: 1 addition & 1 deletion gis/geo_schelling/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mesa-geo~=0.9.0a0
mesa-geo~=0.9.0
4 changes: 2 additions & 2 deletions gis/geo_schelling_points/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from geo_schelling_points.agents import PersonAgent, RegionAgent
from geo_schelling_points.model import GeoSchellingPoints
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from mesa_geo.visualization import make_geospace_component


def make_plot_happiness(model):
Expand Down Expand Up @@ -35,7 +35,7 @@ def schelling_draw(agent):
page = SolaraViz(
model,
[
make_geospace_leaflet(schelling_draw, zoom=4),
make_geospace_component(schelling_draw, zoom=4),
make_plot_component(["happy", "unhappy"]),
make_plot_happiness,
],
Expand Down
2 changes: 1 addition & 1 deletion gis/geo_schelling_points/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mesa-geo~=0.9.0a0
mesa-geo~=0.9.0
4 changes: 2 additions & 2 deletions gis/geo_sir/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from geo_sir.agents import PersonAgent
from geo_sir.model import GeoSir
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from mesa_geo.visualization import make_geospace_component

model_params = {
"pop_size": Slider("Population size", 30, 10, 100, 10),
Expand Down Expand Up @@ -32,7 +32,7 @@ def infected_draw(agent):
page = SolaraViz(
model,
[
make_geospace_leaflet(infected_draw, zoom=12),
make_geospace_component(infected_draw, zoom=12),
make_plot_component(["infected", "susceptible", "recovered", "dead"]),
],
name="Basic agent-based SIR model",
Expand Down
2 changes: 1 addition & 1 deletion gis/geo_sir/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mesa-geo~=0.9.0a0
mesa-geo~=0.9.0
4 changes: 2 additions & 2 deletions gis/population/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mesa_geo as mg
import solara
from mesa.visualization import SolaraViz
from mesa_geo.visualization import make_geospace_leaflet
from mesa_geo.visualization import make_geospace_component
from population.model import Population
from population.space import UgandaCell
from shapely.geometry import Point, Polygon
Expand Down Expand Up @@ -33,7 +33,7 @@ def agent_portrayal(agent):
page = SolaraViz(
model,
[
make_geospace_leaflet(agent_portrayal),
make_geospace_component(agent_portrayal),
make_plot_num_agents,
],
name="Population Model",
Expand Down
2 changes: 1 addition & 1 deletion gis/population/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mesa-geo~=0.9.0a1
mesa-geo~=0.9.0
4 changes: 2 additions & 2 deletions gis/rainfall/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Tuple

from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from mesa_geo.visualization import make_geospace_component
from rainfall.model import Rainfall
from rainfall.space import LakeCell

Expand Down Expand Up @@ -32,7 +32,7 @@ def cell_portrayal(cell: LakeCell) -> Tuple[float, float, float, float]:
page = SolaraViz(
model,
[
make_geospace_leaflet(cell_portrayal, zoom=11),
make_geospace_component(cell_portrayal, zoom=11),
make_plot_component(
["Total Amount of Water", "Total Contained", "Total Outflow"]
),
Expand Down
2 changes: 1 addition & 1 deletion gis/rainfall/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mesa-geo~=0.9.0a1
mesa-geo~=0.9.0
4 changes: 2 additions & 2 deletions gis/urban_growth/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import solara
from mesa.visualization import Slider, SolaraViz, make_plot_component
from mesa_geo.visualization import make_geospace_leaflet
from mesa_geo.visualization import make_geospace_component
from urban_growth.model import UrbanGrowth
from urban_growth.space import UrbanCell

Expand Down Expand Up @@ -36,7 +36,7 @@ def make_plot_urbanized(model):
page = SolaraViz(
model,
[
make_geospace_leaflet(cell_portrayal, zoom=12.1),
make_geospace_component(cell_portrayal, zoom=12.1),
make_plot_component(["Percentage Urbanized"]),
make_plot_urbanized,
],
Expand Down
2 changes: 1 addition & 1 deletion gis/urban_growth/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mesa-geo~=0.9.0a1
mesa-geo~=0.9.0

0 comments on commit 2316635

Please sign in to comment.