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

Modifications for Greater London #61

Merged
merged 21 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,9 @@ logs/

# pyright config
pyrightconfig.json

# scratch
notebooks/scratch*

# AcBM config
config/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.0"
rev: "v0.7.0"
hooks:
# first, lint + autofix
- id: ruff
Expand Down
14 changes: 12 additions & 2 deletions config/base.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
[parameters]
seed = 0
region = "leeds"
number_of_households = 10000
number_of_households = 5000
zone_id = "OA21CD"
travel_times = true # Only set to true if you have travel time matrix at the level specified in boundary_geography
travel_times = true # Only set to true if you have travel time matrix at the level specified in boundary_geography
boundary_geography = "OA"

[matching]
required_columns = ["number_adults", "number_children"]
optional_columns = [
"number_cars",
"num_pension_age",
"rural_urban_2_categories",
"employment_status",
"tenure_status",
]
n_matches = 10

[work_assignment]
use_percentages = true
Expand Down
14 changes: 0 additions & 14 deletions config/base_500.toml

This file was deleted.

13 changes: 0 additions & 13 deletions config/base_5000.toml

This file was deleted.

13 changes: 0 additions & 13 deletions config/base_all.toml

This file was deleted.

29 changes: 0 additions & 29 deletions scripts/1_prep_synthpop.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,6 @@ def main(config_file):
acbm.root_path / f"data/external/spc_output/{region}_people_hh.parquet"
)

# People and time-use data
# Subset of (non-time-use) features to include and unnest
# The features can be found here: https://github.com/alan-turing-institute/uatk-spc/blob/main/synthpop.proto
features = {
"health": [
"bmi",
"has_cardiovascular_disease",
"has_diabetes",
"has_high_blood_pressure",
"self_assessed_health",
"life_satisfaction",
],
"demographics": ["age_years", "ethnicity", "sex", "nssec8"],
"employment": ["sic1d2007", "sic2d2007", "pwkstat", "salary_yearly"],
}

# build the table
spc_people_tu = (
Builder(path, region, backend="polars", input_type="parquet")
.add_households()
.add_time_use_diaries(features, diary_type="weekday_diaries")
.build()
)

# save the output
spc_people_tu.write_parquet(
acbm.root_path / f"data/external/spc_output/{region}_people_tu.parquet"
)


if __name__ == "__main__":
main()
Loading
Loading