Skip to main content

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).

Usage

Install and Run

It's required to firstly install GDAL on your computer.

To install the package, run pip install compass-school.

To run a demo with web-based GUI, run python run.py from the root directory of the project. 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.

Metadata

Release files for compass-school 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compass-school 1.1.0
File Size Uploaded
compass-school-1.1.0.tar.gz 41.1 kB Details

Release files / compass-school-1.1.0.tar.gz

Download URL compass-school-1.1.0.tar.gz
Size 41.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cb064c3b28903a73121cf49395cb14b387425acac47d86d63096f313bc1eb9cb
BLAKE2b-256 checksum
How to use checksums
2660714d1813cd6637d6547d31bb734217576c9c0f33bb76bd2ccca0efe96250
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

1.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page