Skip to main content

This Python implementation tries to model school choice and resulting school segregation based on the work of Schelling (1971) and Stoica & Flache (2014).

Project description

Computational Modelling of Primary School Segregation (COMPASS)

DOI

This Python implementation tries to model school choice and resulting school segregation based on the work of Schelling (1971) and Stoica & Flache (2014).

NB: This repo is folked from and improved based on the original GitLab repo, where the dataset used can be found here.

Usage

Install and Run

In a terminal, navigate to the project folder, install all the dependencies by running

pip install -r requirements

and run the program within a GUI by running

python run.py

This will start a local server to automatically open your web browser and show the program as a webpage. If not seeing the webpage open, manually input http://localhost:5004/ in the link bar.

Update Documentation

Install pdoc3 if you haven't already done so. Browse to the compassproject folder in your terminal and run pdoc3 --html --force --output-dir docs compass. The documentation should be updated now.

Overview

The repository consists of:

  • run.py: a script that runs the model interactively with a visualisation (browser)
  • testrun.py: a test script (work in progress)
  • household.py: the household class
  • student.py: the student class
  • neighbourhood.py: the neighbourhood class
  • school.py the school class
  • allocator.py: allocates the students to their school of choice
  • agents_base.py: overarching agent used for inheritance
  • model.py: initialises the entire system and all of its components
  • parameters.py: contains all the parameter values for the simulation
  • scheduler.py: takes care of the activation, sequence and placement of all agents
  • visualisation.py: browser based visualisation
  • utils.py: containing all measurements
  • functions.py: containing some math functions to be used by the classes

Simulations

Information on how to run the code here.

Testing and development

Setup a virtualenv with the required dependencies.

$ python -m venv env
$ . env/bin/activate
$ pip install -r requirements.txt

Install the package locally (in developement, or editing mode):

$ pip install -e .

Then run the tests with:

$ pytest

Profiling

Some profiling result can be found in this notebook. Also, some scaling graphs can be found in this notebook.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compass-school-1.0.1.tar.gz (41.0 kB view details)

Uploaded Source

File details

Details for the file compass-school-1.0.1.tar.gz.

File metadata

  • Download URL: compass-school-1.0.1.tar.gz
  • Upload date:
  • Size: 41.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for compass-school-1.0.1.tar.gz
Algorithm Hash digest
SHA256 31bc146175170074e9841ec7d22ee59c54fb6ed5782dd9415d8dacb3e37597f6
MD5 cd29663cd0b6d3da3b801c69c5d432e3
BLAKE2b-256 cc499a3da5f27eb3cc4f4ad80cd0453275723096027d40a9c35c19c3c1cf5562

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page