From f10247c6f254ca7b05f630f8c44a800c3a3b6323 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Thu, 26 Sep 2024 08:55:00 +0200 Subject: [PATCH] Update __repr__ with hoodnum --- docs/tutorials/intro_tutorial.ipynb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/tutorials/intro_tutorial.ipynb b/docs/tutorials/intro_tutorial.ipynb index 0b36cfc9..48aac386 100644 --- a/docs/tutorials/intro_tutorial.ipynb +++ b/docs/tutorials/intro_tutorial.ipynb @@ -249,7 +249,7 @@ " )\n", "\n", " def __repr__(self):\n", - " return f\"Neighbourhood {self.unique_id}\"\n", + " return f\"Neighbourhood {self.HOODNUM}\"\n", " \n", " def step(self):\n", " \"\"\"Advance agent one step.\"\"\"\n", @@ -278,7 +278,7 @@ }, "source": [ "\n", - "First, we name our class in this case GeoSIR and we inherit the model class from Mesa. We store the path to our GeoJSON file in the object geojson regions. As JSONs mirror Pythons dictionary structure, we store the key for the neighbourhood id (\"HOODNUM\") in the variable unique_id (TODO: Update).\n", + "First, we name our class in this case GeoSIR and we inherit the model class from Mesa. We store the path to our GeoJSON file in the object geojson regions. As JSONs mirror Pythons dictionary structure, we store the key for the neighbourhood id (\"HOODNUM\") as attribute, and update the __repr__ function to print out the neighbourhood id.\n", "\n", "Second, we set up the python initializer to initiate our model class. To do this we will, set up key word arguments or kwargs of the parameters we want for our model. In this case we will use: \n", "- population size (pop_size): An integer that determines the number of person agents\n", @@ -352,7 +352,6 @@ " # Set up the Neighbourhood patches for every region in file\n", " ac = mg.AgentCreator(NeighbourhoodAgent, model=self)\n", " neighbourhood_agents = ac.from_file(self.geojson_regions)\n", - " # TODO: Check if the HOODNUM still needed, and if so, is read correctly\n", " \n", " #Add neighbourhood agents to space\n", " self.space.add_agents(neighbourhood_agents)\n", @@ -450,7 +449,7 @@ "\n", "You can also see all the person agents are called and then the neighbourhood agents. This will become important later as we want to update the neighbourhood status later based on its PersonAgent status. \n", "\n", - "If you are curious about the numbers for the neighbourhood agents, you can open up the GeoJSON in the data folder and see that each neighborhood gets a unique id identified by `HOODNUM` to ensure this number does not cause a conflict with our agent numbers, we add a \"P\" to their ID. \n", + "If you are curious about the numbers for the neighbourhood agents, you can open up the GeoJSON in the data folder and see that each neighborhood gets a `HOODNUM` attribute assigned.\n", "\n" ] }, @@ -758,7 +757,6 @@ "\n", " # Geographical parameters for desired map\n", " geojson_regions = \"data/TorontoNeighbourhoods.geojson\"\n", - " unique_id = \"HOODNUM\" # TODO: Either use or remove\n", "\n", " def __init__(\n", " self, pop_size=30, mobility_range=500, init_infection=0.2, exposure_dist=500, max_infection_risk=0.2,\n",