Skip to content

Commit

Permalink
make Schelling follow the example standard
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed May 14, 2018
1 parent 8d7014e commit 4bf8e5b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/Schelling/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def step(self):
self.model.happy += 1


class SchellingModel(Model):
class Schelling(Model):
'''
Model class for the Schelling segregation model.
'''

def __init__(self, height, width, density, minority_pc, homophily):
def __init__(self, height=20, width=20, density=0.8, minority_pc=0.2, homophily=3):
'''
'''

Expand Down
4 changes: 2 additions & 2 deletions examples/Schelling/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
TextData, TextGrid, TextVisualization
)

from model import SchellingModel
from model import Schelling


class SchellingTextVisualization(TextVisualization):
Expand Down Expand Up @@ -76,7 +76,7 @@ def schelling_draw(agent):
"homophily": UserSettableParameter("slider", "Homophily", 3, 0, 8, 1)
}

server = ModularServer(SchellingModel,
server = ModularServer(Schelling,
[canvas_element, happy_element, happy_chart],
"Schelling", model_params)
server.launch()
7 changes: 0 additions & 7 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ def test_examples(self):
model = Model()
(model.step() for _ in range(100))

def test_Schelling(self):
with self.active_example_dir('Schelling'):
from model import SchellingModel
model = SchellingModel(height=20, width=20, density=0.8,
minority_pc=0.2, homophily=3)
(model.step() for _ in range(100))

def test_bank_reserves(self):
with self.active_example_dir('bank_reserves'):
from bank_reserves.model import BankReservesModel
Expand Down

0 comments on commit 4bf8e5b

Please sign in to comment.