Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update intro_tutorial.ipynb #234

Merged
merged 2 commits into from
Aug 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions docs/tutorials/intro_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,27 @@
" (You can use the table of contents button on the left side of the interface to skip to any specific part)\n",
"\n",
"\n",
"Users can use Google Colab (Please ensure you run the Colab dependency import cell) \n",
"Users can use Google Colab\\* (Please ensure you run the Colab dependency import cell- below) \n",
"\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/projectmesa/mesa-geo/blob/main/docs/tutorials/intro_tutorial.ipynb)\n"
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/projectmesa/mesa-geo/blob/main/docs/tutorials/intro_tutorial.ipynb)\n",
"\n",
"\\*Based on a recent Google Colab update currently, Solara visuals are not rendering. However, the link still provides a easy way to download the jupyter file. You can see the issue on the [Solara GitHub site](https://github.com/widgetti/solara/issues/323)\n",
"\n",
"You can also [download the file directly from GitHub](https://github.com/projectmesa/mesa-geo/blob/main/docs/tutorials/intro_tutorial.ipynb)\n"
]
},
{
"cell_type": "raw",
"id": "c0c702b3-c307-4f00-9530-468e29f53184",
"cell_type": "code",
"execution_count": null,
"id": "0b0dc4bb-cf8a-4c21-82aa-4a1cc43f1871",
"metadata": {},
"outputs": [],
"source": [
"#Run this if in colab\n",
"#Run this if in colab or if you need to install mesa and mesa-geo in your local environment. \n",
"!pip install mesa --quiet\n",
"!pip install mesa-geo --quiet\n",
"!mkdir -p data\n",
"!wget -P data https://raw.githubusercontent.com/projectmesa/mesa-geo/tree/main/docs/tutorials/data/TorontoNeighbourhoods.geojson"
"!wget -P data https://raw.githubusercontent.com/projectmesa/mesa-geo/main/docs/tutorials/data/TorontoNeighbourhoods.geojson"
]
},
{
Expand Down Expand Up @@ -93,7 +99,7 @@
"\n",
"import mesa\n",
"import mesa_geo as mg\n",
"import mesa_geo.visualization as mgv\n"
"import mesa_geo.visualization as mgv # the warning that appears from Solara is fixed in Mesa 3.0 you can install the pre-release with pip install -U --pre-mesa\n"
]
},
{
Expand Down Expand Up @@ -336,6 +342,7 @@
" self, pop_size=30, mobility_range=500, init_infection=0.2, exposure_dist=500, max_infection_risk=0.2,\n",
" max_recovery_time=5\n",
" ):\n",
" super().__init__()\n",
" self.schedule = mesa.time.RandomActivationByType(self)\n",
" self.space = mg.GeoSpace(warn_crs_conversion=False)\n",
" \n",
Expand Down Expand Up @@ -632,10 +639,7 @@
"execution_count": null,
"id": "50aab416-959f-4d72-abd9-844ed42c784d",
"metadata": {
"has_explanation": true,
"jupyter": {
"source_hidden": true
}
"has_explanation": true
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -769,6 +773,7 @@
" self, pop_size=30, mobility_range=500, init_infection=0.2, exposure_dist=500, max_infection_risk=0.2,\n",
" max_recovery_time=5\n",
" ):\n",
" super().__init__()\n",
" #Scheduler\n",
" self.schedule = mesa.time.RandomActivationByType(self)\n",
" #Space\n",
Expand Down Expand Up @@ -1087,6 +1092,14 @@
"# This is required to render the visualization in the Jupyter notebook\n",
"page"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "324cabe0-68be-4aab-a70d-10ffcd328114",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -1105,7 +1118,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down