diff --git a/examples/boid_flockers/boid_flockers/SimpleContinuousModule.py b/examples/boid_flockers/boid_flockers/SimpleContinuousModule.py index eabf077c8..42b3e9dd7 100644 --- a/examples/boid_flockers/boid_flockers/SimpleContinuousModule.py +++ b/examples/boid_flockers/boid_flockers/SimpleContinuousModule.py @@ -11,8 +11,8 @@ def __init__(self, portrayal_method=None, canvas_height=500, canvas_width=500): self.portrayal_method = portrayal_method self.canvas_height = canvas_height self.canvas_width = canvas_width - new_element = "new Simple_Continuous_Module({}, {})".format( - self.canvas_width, self.canvas_height + new_element = ( + f"new Simple_Continuous_Module({self.canvas_width}, {self.canvas_height})" ) self.js_code = "elements.push(" + new_element + ");" diff --git a/examples/virus_on_network/app.py b/examples/virus_on_network/app.py index cefb0059c..a9661a4de 100644 --- a/examples/virus_on_network/app.py +++ b/examples/virus_on_network/app.py @@ -41,9 +41,7 @@ def get_resistant_susceptible_ratio(model): ratio_text = r"$\infty$" if ratio is math.inf else f"{ratio:.2f}" infected_text = str(number_infected(model)) - return "Resistant/Susceptible Ratio: {}
Infected Remaining: {}".format( - ratio_text, infected_text - ) + return f"Resistant/Susceptible Ratio: {ratio_text}
Infected Remaining: {infected_text}" def make_plot(model): diff --git a/examples/virus_on_network/virus_on_network/server.py b/examples/virus_on_network/virus_on_network/server.py index afb5c1954..dcc7643f0 100644 --- a/examples/virus_on_network/virus_on_network/server.py +++ b/examples/virus_on_network/virus_on_network/server.py @@ -68,9 +68,7 @@ def get_resistant_susceptible_ratio(model): ratio_text = "∞" if ratio is math.inf else f"{ratio:.2f}" infected_text = str(number_infected(model)) - return "Resistant/Susceptible Ratio: {}
Infected Remaining: {}".format( - ratio_text, infected_text - ) + return f"Resistant/Susceptible Ratio: {ratio_text}
Infected Remaining: {infected_text}" model_params = { diff --git a/gis/geo_schelling_experimental/GIS_Schelling.ipynb b/gis/geo_schelling_experimental/GIS_Schelling.ipynb index a831c6006..3976be795 100644 --- a/gis/geo_schelling_experimental/GIS_Schelling.ipynb +++ b/gis/geo_schelling_experimental/GIS_Schelling.ipynb @@ -2,26 +2,31 @@ "cells": [ { "cell_type": "code", - "execution_count": null, - "id": "4f31395d-09c3-4479-8147-0dff9499cd71", - "metadata": {}, + "execution_count": 1, + "id": "37528711-4873-42e7-be7f-926130026dd8", + "metadata": { + "jupyter": { + "source_hidden": true + } + }, "outputs": [], "source": [ "import random\n", "\n", "import mesa\n", "import mesa_geo as mg\n", - "import mesa_geo.geoexperimental as mge\n", - "import geopandas as gpd\n", - "import ipyleaflet\n", - "import xyzservices.providers as xyz" + "import mesa_geo.geoexperimental as mge" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "27cac12c-515e-4ef4-83cc-d06918921c70", - "metadata": {}, + "metadata": { + "jupyter": { + "source_hidden": true + } + }, "outputs": [], "source": [ "class SchellingAgent(mg.GeoAgent):\n", @@ -70,9 +75,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "9c9a9738-7e8f-458c-b0aa-cfc69c04ee87", - "metadata": {}, + "metadata": { + "jupyter": { + "source_hidden": true + } + }, "outputs": [], "source": [ "class GeoSchelling(mesa.Model):\n", @@ -130,9 +139,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "0bf74b4c-36ab-416c-a4db-ab5104189d92", - "metadata": {}, + "metadata": { + "jupyter": { + "source_hidden": true + } + }, "outputs": [], "source": [ "def schelling_draw(agent):\n", @@ -177,12 +190,34 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "c8a2533e-95ba-4a2b-b21a-56e05fe3b7b2", - "metadata": {}, - "outputs": [], + "metadata": { + "jupyter": { + "source_hidden": true + } + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d4853c72527245678d5cb9d38d4a15ec", + "version_major": 2, + "version_minor": 0 + }, + "text/html": [ + "Cannot show widget. You probably want to rerun the code cell above (Click in the code cell, and press Shift+Enter +)." + ], + "text/plain": [ + "Cannot show ipywidgets in text" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "page = mge.JupyterViz(\n", + "page = mge.GeoJupyterViz(\n", " GeoSchelling,\n", " model_params,\n", " measures=[\"happy\"],\n", @@ -199,7 +234,11 @@ "cell_type": "code", "execution_count": null, "id": "eb7fbf17-30a9-4c02-a2b8-c211ab16d32b", - "metadata": {}, + "metadata": { + "jupyter": { + "source_hidden": true + } + }, "outputs": [], "source": [] } diff --git a/gis/geo_schelling_experimental/app.py b/gis/geo_schelling_experimental/app.py index ce39a91d8..33d45930c 100644 --- a/gis/geo_schelling_experimental/app.py +++ b/gis/geo_schelling_experimental/app.py @@ -14,16 +14,6 @@ def __init__(self): def render(self, model): return "Happy agents: " + str(model.happy) - -""" -model_params = { - "density": mesa.visualization.Slider("Agent density", 0.6, 0.1, 1.0, 0.1), - "minority_pc": mesa.visualization.Slider("Fraction minority", 0.2, 0.00, 1.0, 0.05), - "export_data": mesa.visualization.Checkbox("Export data after simulation", False), -} -""" - - def schelling_draw(agent): """ Portrayal Method for canvas @@ -63,7 +53,7 @@ def schelling_draw(agent): }, } -page = mge.JupyterViz( +page = mge.GeoJupyterViz( GeoSchelling, model_params, measures=["happy"],