Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
4835395
Optimize Philadelphia OSM download: single query instead of chunking
paco-barreras Oct 30, 2025
b05bfc5
Remove pointless defensive coding from synthetic_philadelphia script
paco-barreras Oct 30, 2025
820bb47
Add comprehensive implementation plan for Philadelphia rasterization
paco-barreras Oct 30, 2025
d3ced29
Add rasterization support for OSM data and scalable street graph routing
paco-barreras Oct 31, 2025
13afccc
Make sandbox self-contained and use relative paths for Jupyter compat…
paco-barreras Oct 31, 2025
03671e1
Fix create_sandbox.py: pass bbox in EPSG:4326 to OSMnx
paco-barreras Oct 31, 2025
469c63a
Refactor map_utils: simplify OSM downloads, remove chunking/cache wra…
paco-barreras Oct 31, 2025
d80c466
Rewrite streets scalability report as clear narrative prose
paco-barreras Oct 31, 2025
46a264d
Add targeted code references to traj_gen, city_gen, map_utils, consta…
paco-barreras Oct 31, 2025
707f9d7
Buildings download: explode+clip to boundary for bbox/polygon; add sa…
paco-barreras Nov 1, 2025
505ef6a
Simplify buildings clip: explode then gpd.clip; remove helper and def…
paco-barreras Nov 1, 2025
1fe5a6f
Standardize on building_type column; fix residential->home mapping; r…
paco-barreras Nov 1, 2025
988161e
Fix example scripts: download_poi_data_from_OSM and test_rasterizatio…
paco-barreras Nov 1, 2025
559b19c
Fix remaining example scripts and notebooks: use building_type consis…
paco-barreras Nov 1, 2025
1721be2
Fix download_poi_data_from_OSM.ipynb to use building_type
paco-barreras Nov 1, 2025
301382d
Add door_paths_scalability.py: benchmark 100-to-all door distances wi…
paco-barreras Nov 1, 2025
caf0cdf
Scalability in test_rasterization_report: door-to-all queries with ca…
paco-barreras Nov 1, 2025
3e70243
Add City.compute_gravity (manhattan-to-hub + hub distances) and use p…
paco-barreras Nov 1, 2025
3522069
Enforce precomputed city.grav in traj_gen (no fallbacks); add door di…
paco-barreras Nov 1, 2025
aa26521
City.from_geopackage: use poi_cols mapping (no guessing); remove valu…
paco-barreras Nov 1, 2025
c54806a
traj_gen: use building_type; fix initial visit_freqs seeding (home/wo…
paco-barreras Nov 1, 2025
5b96369
traj_gen: split sampling into generate_ping_times/thin_traj_by_times/…
paco-barreras Nov 2, 2025
5151576
Rename rasterization report files to avoid pytest collection; confirm…
paco-barreras Nov 2, 2025
052a6a7
traj_gen: remove blind defensive guards in _sample_step; enforce stri…
paco-barreras Nov 2, 2025
dc316f7
traj_gen: remove path fallback; enforce error when get_shortest_path …
paco-barreras Nov 2, 2025
868aeb0
rasterization: standardize building schema to 'building_type' in Rast…
paco-barreras Nov 2, 2025
a047e8b
Refactor gravity computation to use vectorized operations
paco-barreras Nov 3, 2025
68e1032
Agent diary generation: move visit_freqs init into Agent, remove unne…
paco-barreras Nov 5, 2025
7cdadae
cleaned up docstring
paco-barreras Nov 5, 2025
10b05a9
Simplified logic to add buildings
paco-barreras Nov 5, 2025
26fd195
Merged latest traj_gen implementations with FF
paco-barreras Nov 5, 2025
9d5fe61
Refactor city generation tests and fixtures
paco-barreras Nov 5, 2025
0846e77
Fix test_shortest_path assertions: door must be on street, not building
paco-barreras Nov 5, 2025
66dae99
Clean up test conditionals and imports
paco-barreras Nov 5, 2025
382eac2
Refactor RasterCityGenerator to RasterCity: inherit from City, move g…
paco-barreras Nov 5, 2025
0e5091c
Refactor RasterCity: use block_side_length parameter, rename building…
paco-barreras Nov 5, 2025
8b2874b
Refactor _rasterize: combine loops, eliminate intermediate list, fix …
paco-barreras Nov 5, 2025
9ff608b
Stage 4: Drop 'type' column after use in _rasterize
paco-barreras Nov 5, 2025
338b77c
Decouple door assignment from streets_gdf, use blocks_gdf instead
paco-barreras Nov 5, 2025
a021095
Refactor canvas generation and block type assignment
paco-barreras Nov 5, 2025
79d9005
Major refactor: Remove 'kind' column bloat and fix coordinate system
paco-barreras Nov 5, 2025
d2ff3bf
Move TYPE_PRIORITY to constants.py
paco-barreras Nov 5, 2025
172ca8b
Merge branch 'main' into rasterization-and-street-graph
paco-barreras Nov 5, 2025
6793f11
Refactor rasterization_report: consolidate timing and separate debugging
paco-barreras Nov 5, 2025
d7dae9f
Remove testing bloat from rasterization_report, keep only benchmarking
paco-barreras Nov 5, 2025
1fe811b
Integrate data generation into rasterization_report and improve verbo…
paco-barreras Nov 5, 2025
99115d4
Refactor compute_gravity for memory efficiency
paco-barreras Nov 5, 2025
8214b24
Add resolve_overlaps feature and improve building type priority
paco-barreras Nov 5, 2025
f89b151
Add test for resolve_overlaps and benchmark results
paco-barreras Nov 5, 2025
d7af63d
Implement chunked gravity computation for memory efficiency
paco-barreras Nov 5, 2025
3aac3e0
Clean up synthetic_philadelphia.py to match rasterization_report stru…
paco-barreras Nov 5, 2025
6c06d21
Fix to_timestamp for NumPy 2.0 compatibility and improve consistency
paco-barreras Nov 6, 2025
f841de8
Fix datetime string handling in Agent initialization and generate_des…
paco-barreras Nov 6, 2025
7be3716
Add comprehensive test for Agent last_ping initialization
paco-barreras Nov 6, 2025
4282ee3
Fix duplicate building IDs in RasterCity by using internal block for ID
paco-barreras Nov 6, 2025
cf77cf9
Optimize hub network distance computation using single-source shortes…
paco-barreras Nov 6, 2025
fb6a297
Fix tests to use proper fixture instead of experimental sandbox data
paco-barreras Nov 6, 2025
2576102
Add debug statements for gravity NaN investigation
paco-barreras Nov 6, 2025
e8ed48e
updated notebooks for experiments
paco-barreras Nov 6, 2025
b02d917
refactor: coordinate system consistency and to_file export method
paco-barreras Nov 6, 2025
d47c40b
test: add test for to_file reverse affine transformation
paco-barreras Nov 6, 2025
c9f7dfb
refactor: consolidate persistence methods and eliminate redundancy
paco-barreras Nov 6, 2025
c2bd6e6
cleanup of lagging files
paco-barreras Nov 6, 2025
197af25
Refactor _sample_step: use previous building geometry in bound_poly, …
paco-barreras Nov 13, 2025
ea92105
Implement geometry caching in _sample_step for performance
paco-barreras Nov 13, 2025
ce180cf
partial merge of sandbox files from efficient-garden-city-routing
paco-barreras Nov 13, 2025
c4ad204
Merge city_gen logic and tests from efficient-garden-city-routing branch
paco-barreras Nov 13, 2025
355247b
formatting of date as string in save_pop
paco-barreras Nov 13, 2025
a88325e
Clean up code: remove bloat, fix geometry handling, add verification …
paco-barreras Nov 14, 2025
a1a211c
Replace synthetic_philadelphia notebook with complete ROUTING branch …
paco-barreras Nov 14, 2025
5991272
Fix trajectory rotation: store rotation_deg and rotation_origin in me…
paco-barreras Nov 14, 2025
6912c44
Clean up traj_gen.py: remove bloat, optimize lookups, fix bugs
paco-barreras Nov 14, 2025
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ examples/research/**/*.png
# OSM cache and large outputs
cache/
examples/output/
examples/research/virtual_philadelphia/*.gpkg

# macOS system file
.DS_Store
Expand Down Expand Up @@ -62,3 +63,4 @@ virtual-environments/
.DS_Store
Thumbs.db
*.tmp
sandbox/sandbox_data.gpkg
26 changes: 26 additions & 0 deletions CODING_PRINCIPLES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Coding Principles

1. **Avoid bloating the code at all costs.** This means no unnecessary variables, no defensive coding that nobody asked for, no checking of data types (unless we are purposefully debugging a problem). This bloats the code and is NOT equal to good coding.
2. **No blind coding or guessing function arguments with if else.** For instance "if 'building_id' in df" because you don't know the right column name. No. Go and check the codebase for how the objects are defined. Same with other libraries, go online and check the correct function signature.
3. **Absolutely no ad-hoc hot patches just to pass tests**, consider that the test might be outdated, or that there might be a deeper rework needed which DEFINITELY would need user input.
4. **No type hints in function signatures.** Instead, the parameter types are in the docstring.
5. **All imports go at the beginning of the file, never inside functions.**
6. **Double for loops are to be avoided at all costs.** As well as dictionaries when a pandas series or dataframe can do the job. We need to rely on the highly optimized and vectorized functions provided by numpy, pandas, and geopandas.
7. **Do not edit the code before sharing a plan with the user and explaining WHY it adheres to the coding principles.**

## Testing and Development Environment

### Virtual Environment
- This project uses a Python virtual environment located at `.venv/`
- Activate with: `.venv\Scripts\activate` (Windows) or `source .venv/bin/activate` (Unix)

### Running Tests
- Tests are located in `nomad/tests/`
- Run tests with pytest: `pytest nomad/tests/test_<module>.py -v`
- Run specific test: `pytest nomad/tests/test_<module>.py::test_function_name -v`
- The venv must be active or use direct path to pytest in venv

### Terminal/PowerShell Syntax
- This projects uses the default powershell the system provides via the terminal command tool. At least in this machine, it seems to be PSVersion 7.5.4 on a Windows 10 OS
- Example: `cd "C:\path\to\project"; pytest nomad\tests\test_file.py -v`
- Always quote paths with spaces
44 changes: 44 additions & 0 deletions config_high_ha.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"dt": 0.5,
"N": 6,
"name_count": 2,
"name_seed": 2025,
"city_file": "nomad/data/garden-city.gpkg",
"destination_diary_file": "exp_1_destinations_unbalanced.csv",
"output_files": {
"sparse_path": "./sparse_traj_2",
"diaries_path": "./diaries_2",
"homes_path": "./homes_2"
},
"agent_params": {
"agent_homes": "h-x13-y11",
"agent_workplaces": "w-x18-y8",
"seed_trajectory": [
0,
1,
2,
3,
4,
5
],
"seed_sparsity": [
0,
1,
2,
3,
4,
5
],
"beta_ping": [
1.0,
1.0,
10.5,
10.5,
20.0,
20.0
],
"beta_durations": null,
"beta_start": null,
"ha": 1.0
}
}
44 changes: 44 additions & 0 deletions config_low_ha.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"dt": 0.5,
"N": 6,
"name_count": 2,
"name_seed": 2025,
"city_file": "nomad/data/garden-city.gpkg",
"destination_diary_file": "exp_1_destinations_balanced.csv",
"output_files": {
"sparse_path": "./sparse_traj_1",
"diaries_path": "./diaries_1",
"homes_path": "./homes_1"
},
"agent_params": {
"agent_homes": "h-x13-y11",
"agent_workplaces": "w-x18-y8",
"seed_trajectory": [
0,
1,
2,
3,
4,
5
],
"seed_sparsity": [
0,
1,
2,
3,
4,
5
],
"beta_ping": [
1.0,
1.0,
10.5,
10.5,
20.0,
20.0
],
"beta_durations": null,
"beta_start": null,
"ha": 0.7666666666666667
}
}
62 changes: 31 additions & 31 deletions docs/source/poi_synthetic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,37 @@
"]\n",
"\n",
"works = [\n",
" {'type': 'work', 'door': (3, 4), 'blocks': [(4, 4), (4, 5)]},\n",
" {'type': 'work', 'door': (5, 3), 'blocks': [(5, 4), (5, 5)]},\n",
" {'type': 'work', 'door': (6, 6), 'geom': box(6, 4, 8, 6)},\n",
" {'type': 'work', 'door': (8, 6), 'geom': box(8, 4, 10, 6)},\n",
" {'type': 'work', 'door': (12, 6), 'geom': box(11, 5, 14, 6)},\n",
" {'type': 'work', 'door': (12, 3), 'geom': box(11, 4, 14, 5)},\n",
" {'type': 'work', 'door': (15, 3), 'geom': box(14, 4, 17, 6)},\n",
" {'type': 'work', 'door': (18, 4), 'geom': box(17, 4, 18, 6)},\n",
" {'type': 'work', 'door': (18, 6), 'geom': box(16, 6, 18, 8)},\n",
" {'type': 'work', 'door': (15, 9), 'geom': box(16, 8, 17, 10)},\n",
" {'type': 'work', 'door': (18, 8), 'geom': box(17, 8, 18, 10)},\n",
" {'type': 'work', 'door': (18, 10), 'geom': box(16, 10, 18, 12)},\n",
" {'type': 'work', 'door': (18, 13), 'geom': box(16, 13, 18, 15)},\n",
" {'type': 'work', 'door': (18, 15), 'geom': box(16, 15, 18, 16)},\n",
" {'type': 'work', 'door': (15, 15), 'geom': box(15, 16, 18, 17)},\n",
" {'type': 'work', 'door': (14, 15), 'blocks': [(14, 16)]},\n",
" {'type': 'work', 'door': (16, 18), 'geom': box(16, 17, 18, 18)},\n",
" {'type': 'work', 'door': (15, 18), 'geom': box(14, 17, 16, 18)},\n",
" {'type': 'work', 'door': (13, 18), 'geom': box(12, 16, 14, 18)},\n",
" {'type': 'work', 'door': (11, 18), 'geom': box(10, 17, 12, 18)},\n",
" {'type': 'work', 'door': (11, 15), 'geom': box(10, 16, 12, 17)},\n",
" {'type': 'work', 'door': (8, 18), 'geom': box(7, 16, 9, 18)},\n",
" {'type': 'work', 'door': (6, 18), 'geom': box(5, 17, 7, 18)},\n",
" {'type': 'work', 'door': (6, 15), 'geom': box(5, 16, 7, 17)},\n",
" {'type': 'work', 'door': (3, 16), 'blocks': [(4, 16), (4, 17)]},\n",
" {'type': 'work', 'door': (3, 13), 'geom': box(4, 13, 6, 16)},\n",
" {'type': 'work', 'door': (6, 12), 'geom': box(4, 12, 6, 13)},\n",
" {'type': 'work', 'door': (3, 10), 'blocks': [(4, 9), (4, 10)]},\n",
" {'type': 'work', 'door': (6, 9), 'blocks': [(5, 9), (5, 10)]},\n",
" {'type': 'work', 'door': (6, 8), 'blocks': [(4, 8), (5, 8)]},\n",
" {'type': 'work', 'door': (3, 6), 'geom': box(4, 6, 6, 8)},\n",
" {'type': 'workplace', 'door': (3, 4), 'blocks': [(4, 4), (4, 5)]},\n",
" {'type': 'workplace', 'door': (5, 3), 'blocks': [(5, 4), (5, 5)]},\n",
" {'type': 'workplace', 'door': (6, 6), 'geom': box(6, 4, 8, 6)},\n",
" {'type': 'workplace', 'door': (8, 6), 'geom': box(8, 4, 10, 6)},\n",
" {'type': 'workplace', 'door': (12, 6), 'geom': box(11, 5, 14, 6)},\n",
" {'type': 'workplace', 'door': (12, 3), 'geom': box(11, 4, 14, 5)},\n",
" {'type': 'workplace', 'door': (15, 3), 'geom': box(14, 4, 17, 6)},\n",
" {'type': 'workplace', 'door': (18, 4), 'geom': box(17, 4, 18, 6)},\n",
" {'type': 'workplace', 'door': (18, 6), 'geom': box(16, 6, 18, 8)},\n",
" {'type': 'workplace', 'door': (15, 9), 'geom': box(16, 8, 17, 10)},\n",
" {'type': 'workplace', 'door': (18, 8), 'geom': box(17, 8, 18, 10)},\n",
" {'type': 'workplace', 'door': (18, 10), 'geom': box(16, 10, 18, 12)},\n",
" {'type': 'workplace', 'door': (18, 13), 'geom': box(16, 13, 18, 15)},\n",
" {'type': 'workplace', 'door': (18, 15), 'geom': box(16, 15, 18, 16)},\n",
" {'type': 'workplace', 'door': (15, 15), 'geom': box(15, 16, 18, 17)},\n",
" {'type': 'workplace', 'door': (14, 15), 'blocks': [(14, 16)]},\n",
" {'type': 'workplace', 'door': (16, 18), 'geom': box(16, 17, 18, 18)},\n",
" {'type': 'workplace', 'door': (15, 18), 'geom': box(14, 17, 16, 18)},\n",
" {'type': 'workplace', 'door': (13, 18), 'geom': box(12, 16, 14, 18)},\n",
" {'type': 'workplace', 'door': (11, 18), 'geom': box(10, 17, 12, 18)},\n",
" {'type': 'workplace', 'door': (11, 15), 'geom': box(10, 16, 12, 17)},\n",
" {'type': 'workplace', 'door': (8, 18), 'geom': box(7, 16, 9, 18)},\n",
" {'type': 'workplace', 'door': (6, 18), 'geom': box(5, 17, 7, 18)},\n",
" {'type': 'workplace', 'door': (6, 15), 'geom': box(5, 16, 7, 17)},\n",
" {'type': 'workplace', 'door': (3, 16), 'blocks': [(4, 16), (4, 17)]},\n",
" {'type': 'workplace', 'door': (3, 13), 'geom': box(4, 13, 6, 16)},\n",
" {'type': 'workplace', 'door': (6, 12), 'geom': box(4, 12, 6, 13)},\n",
" {'type': 'workplace', 'door': (3, 10), 'blocks': [(4, 9), (4, 10)]},\n",
" {'type': 'workplace', 'door': (6, 9), 'blocks': [(5, 9), (5, 10)]},\n",
" {'type': 'workplace', 'door': (6, 8), 'blocks': [(4, 8), (5, 8)]},\n",
" {'type': 'workplace', 'door': (3, 6), 'geom': box(4, 6, 6, 8)},\n",
"]\n",
"\n",
"retails = [\n",
Expand Down
16 changes: 8 additions & 8 deletions examples/download_poi_data_from_OSM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"streets.to_file(\"philadelphia_streets.geojson\", driver=\"GeoJSON\")\n",
"\n",
"print(f\"Downloaded {len(buildings)} buildings, {len(streets)} streets\")\n",
"print(f\"Building categories: {buildings['garden_city_category'].value_counts().to_dict()}\")\n",
"print(f\"Building categories: {buildings['building_type'].value_counts().to_dict()}\")\n",
"\n",
"# Show sample of downloaded data\n",
"print(\"\\nSample buildings data:\")\n",
Expand All @@ -46,23 +46,23 @@
"\n",
"colors = {\n",
" 'park': 'green',\n",
" 'residential': 'blue', \n",
" 'home': 'blue', \n",
" 'retail': 'orange',\n",
" 'workplace': 'purple',\n",
" 'other': 'grey'\n",
"}\n",
"\n",
"# Buildings by category with proper colors\n",
"for category, color in colors.items():\n",
" subset = buildings[buildings['garden_city_category'] == category]\n",
" subset = buildings[buildings['building_type'] == category]\n",
" if len(subset) > 0:\n",
" subset.plot(ax=axes[0], color=color, edgecolor='black', linewidth=0.1, alpha=0.7)\n",
"axes[0].set_title('Buildings by Category')\n",
"axes[0].set_aspect('equal')\n",
"\n",
"# Buildings + Streets\n",
"for category, color in colors.items():\n",
" subset = buildings[buildings['garden_city_category'] == category]\n",
" subset = buildings[buildings['building_type'] == category]\n",
" if len(subset) > 0:\n",
" subset.plot(ax=axes[1], color=color, edgecolor='black', linewidth=0.08, alpha=0.7)\n",
"streets.plot(ax=axes[1], color='black', linewidth=0.4)\n",
Expand Down Expand Up @@ -99,7 +99,7 @@
"salem_streets.to_file(\"salem_streets.geojson\", driver=\"GeoJSON\")\n",
"\n",
"print(f\"Downloaded {len(salem_buildings)} buildings, {len(salem_streets)} streets\")\n",
"print(f\"Building categories: {salem_buildings['garden_city_category'].value_counts().to_dict()}\")\n",
"print(f\"Building categories: {salem_buildings['building_type'].value_counts().to_dict()}\")\n",
"# Show sample of downloaded data\n",
"print(\"\\nSample Salem buildings data:\")\n",
"print(salem_buildings.head())\n",
Expand All @@ -112,23 +112,23 @@
"\n",
"colors = {\n",
" 'park': 'green',\n",
" 'residential': 'blue', \n",
" 'home': 'blue', \n",
" 'retail': 'orange',\n",
" 'workplace': 'purple',\n",
" 'other': 'grey'\n",
"}\n",
"\n",
"# Buildings by category\n",
"for category, color in colors.items():\n",
" subset = salem_buildings[salem_buildings['garden_city_category'] == category]\n",
" subset = salem_buildings[salem_buildings['building_type'] == category]\n",
" if len(subset) > 0:\n",
" subset.plot(ax=axes[0], color=color, edgecolor='black', linewidth=0.1)\n",
"axes[0].set_title('Salem Buildings by Category')\n",
"axes[0].set_aspect('equal')\n",
"\n",
"# Buildings + Streets\n",
"for category, color in colors.items():\n",
" subset = salem_buildings[salem_buildings['garden_city_category'] == category]\n",
" subset = salem_buildings[salem_buildings['building_type'] == category]\n",
" if len(subset) > 0:\n",
" subset.plot(ax=axes[1], color=color, edgecolor='black', linewidth=0.08, alpha=0.7)\n",
"salem_streets.plot(ax=axes[1], color='black', linewidth=0.5)\n",
Expand Down
16 changes: 8 additions & 8 deletions examples/download_poi_data_from_OSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
streets.to_file("philadelphia_streets.geojson", driver="GeoJSON")

print(f"Downloaded {len(buildings)} buildings, {len(streets)} streets")
print(f"Building categories: {buildings['garden_city_category'].value_counts().to_dict()}")
print(f"Building categories: {buildings['building_type'].value_counts().to_dict()}")

# Show sample of downloaded data
print("\nSample buildings data:")
Expand All @@ -48,23 +48,23 @@

colors = {
'park': 'green',
'residential': 'blue',
'home': 'blue',
'retail': 'orange',
'workplace': 'purple',
'other': 'grey'
}

# Buildings by category with proper colors
for category, color in colors.items():
subset = buildings[buildings['garden_city_category'] == category]
subset = buildings[buildings['building_type'] == category]
if len(subset) > 0:
subset.plot(ax=axes[0], color=color, edgecolor='black', linewidth=0.1, alpha=0.7)
axes[0].set_title('Buildings by Category')
axes[0].set_aspect('equal')

# Buildings + Streets
for category, color in colors.items():
subset = buildings[buildings['garden_city_category'] == category]
subset = buildings[buildings['building_type'] == category]
if len(subset) > 0:
subset.plot(ax=axes[1], color=color, edgecolor='black', linewidth=0.08, alpha=0.7)
streets.plot(ax=axes[1], color='black', linewidth=0.4)
Expand Down Expand Up @@ -94,7 +94,7 @@
salem_streets.to_file("salem_streets.geojson", driver="GeoJSON")

print(f"Downloaded {len(salem_buildings)} buildings, {len(salem_streets)} streets")
print(f"Building categories: {salem_buildings['garden_city_category'].value_counts().to_dict()}")
print(f"Building categories: {salem_buildings['building_type'].value_counts().to_dict()}")
# Show sample of downloaded data
print("\nSample Salem buildings data:")
print(salem_buildings.head())
Expand All @@ -107,23 +107,23 @@

colors = {
'park': 'green',
'residential': 'blue',
'home': 'blue',
'retail': 'orange',
'workplace': 'purple',
'other': 'grey'
}

# Buildings by category
for category, color in colors.items():
subset = salem_buildings[salem_buildings['garden_city_category'] == category]
subset = salem_buildings[salem_buildings['building_type'] == category]
if len(subset) > 0:
subset.plot(ax=axes[0], color=color, edgecolor='black', linewidth=0.1)
axes[0].set_title('Salem Buildings by Category')
axes[0].set_aspect('equal')

# Buildings + Streets
for category, color in colors.items():
subset = salem_buildings[salem_buildings['garden_city_category'] == category]
subset = salem_buildings[salem_buildings['building_type'] == category]
if len(subset) > 0:
subset.plot(ax=axes[1], color=color, edgecolor='black', linewidth=0.08, alpha=0.7)
salem_streets.plot(ax=axes[1], color='black', linewidth=0.5)
Expand Down
Binary file removed examples/garden-city-edges.parquet
Binary file not shown.
Binary file removed examples/garden-city.gpkg
Binary file not shown.
4 changes: 2 additions & 2 deletions examples/generate_synthetic_trajectories.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def generate_agent_trajectory(args):
# %%
np.random.seed(100)
n_agents = 15
homes = city.buildings_gdf[city.buildings_gdf['type'] == 'home']['id'].tolist()
workplaces = city.buildings_gdf[city.buildings_gdf['type'] == 'work']['id'].tolist()
homes = city.buildings_gdf[city.buildings_gdf['building_type'] == 'home']['id'].tolist()
workplaces = city.buildings_gdf[city.buildings_gdf['building_type'] == 'workplace']['id'].tolist()

agent_params = [
(f'agent_{i:04d}',
Expand Down
Loading