wsp-tasha-toolbox 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wsp_tasha_toolbox-0.1.0/.github/workflows/python-publish.yml +60 -0
- wsp_tasha_toolbox-0.1.0/.gitignore +175 -0
- wsp_tasha_toolbox-0.1.0/LICENSE +28 -0
- wsp_tasha_toolbox-0.1.0/PKG-INFO +37 -0
- wsp_tasha_toolbox-0.1.0/README.md +15 -0
- wsp_tasha_toolbox-0.1.0/notebooks/load_microsim_results.ipynb +155 -0
- wsp_tasha_toolbox-0.1.0/pyproject.toml +43 -0
- wsp_tasha_toolbox-0.1.0/setup.cfg +4 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/__init__.py +5 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/_version.py +21 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/common/__init__.py +0 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/common/activity_pairs.py +95 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/common/enums_data.py +6 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/common/enums_microsim.py +34 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/common/enums_model.py +36 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/common/enums_tts2016.py +60 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/data_model/__init__.py +1 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/data_model/data_model.py +565 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/data_model/schema.py +295 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/io/__init__.py +1 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/io/tts.py +78 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/processing/__init__.py +0 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox/processing/tlfd.py +51 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox.egg-info/PKG-INFO +37 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox.egg-info/SOURCES.txt +27 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox.egg-info/dependency_links.txt +1 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox.egg-info/requires.txt +6 -0
- wsp_tasha_toolbox-0.1.0/src/wsp_tasha_toolbox.egg-info/top_level.txt +1 -0
- wsp_tasha_toolbox-0.1.0/uv.lock +1121 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
name: Upload Python Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [published]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
release-build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.x"
|
|
23
|
+
|
|
24
|
+
- name: Build release distributions
|
|
25
|
+
run: |
|
|
26
|
+
# NOTE: put your own distribution build steps here.
|
|
27
|
+
python -m pip install build
|
|
28
|
+
python -m build
|
|
29
|
+
|
|
30
|
+
- name: Upload distributions
|
|
31
|
+
uses: actions/upload-artifact@v4
|
|
32
|
+
with:
|
|
33
|
+
name: release-dists
|
|
34
|
+
path: dist/
|
|
35
|
+
|
|
36
|
+
pypi-publish:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
needs:
|
|
39
|
+
- release-build
|
|
40
|
+
permissions:
|
|
41
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
42
|
+
id-token: write
|
|
43
|
+
|
|
44
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
45
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
46
|
+
environment:
|
|
47
|
+
name: pypi
|
|
48
|
+
url: https://pypi.org/p/wsp-tasha-toolbox
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- name: Retrieve release distributions
|
|
52
|
+
uses: actions/download-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: release-dists
|
|
55
|
+
path: dist/
|
|
56
|
+
|
|
57
|
+
- name: Publish release distributions to PyPI
|
|
58
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
59
|
+
with:
|
|
60
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
_version.py
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
.python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
#pdm.lock
|
|
114
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
115
|
+
# in version control.
|
|
116
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
117
|
+
.pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
122
|
+
__pypackages__/
|
|
123
|
+
|
|
124
|
+
# Celery stuff
|
|
125
|
+
celerybeat-schedule
|
|
126
|
+
celerybeat.pid
|
|
127
|
+
|
|
128
|
+
# SageMath parsed files
|
|
129
|
+
*.sage.py
|
|
130
|
+
|
|
131
|
+
# Environments
|
|
132
|
+
.env
|
|
133
|
+
.venv
|
|
134
|
+
env/
|
|
135
|
+
venv/
|
|
136
|
+
ENV/
|
|
137
|
+
env.bak/
|
|
138
|
+
venv.bak/
|
|
139
|
+
|
|
140
|
+
# Spyder project settings
|
|
141
|
+
.spyderproject
|
|
142
|
+
.spyproject
|
|
143
|
+
|
|
144
|
+
# Rope project settings
|
|
145
|
+
.ropeproject
|
|
146
|
+
|
|
147
|
+
# mkdocs documentation
|
|
148
|
+
/site
|
|
149
|
+
|
|
150
|
+
# mypy
|
|
151
|
+
.mypy_cache/
|
|
152
|
+
.dmypy.json
|
|
153
|
+
dmypy.json
|
|
154
|
+
|
|
155
|
+
# Pyre type checker
|
|
156
|
+
.pyre/
|
|
157
|
+
|
|
158
|
+
# pytype static type analyzer
|
|
159
|
+
.pytype/
|
|
160
|
+
|
|
161
|
+
# Cython debug symbols
|
|
162
|
+
cython_debug/
|
|
163
|
+
|
|
164
|
+
# PyCharm
|
|
165
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
166
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
167
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
168
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
169
|
+
.idea/
|
|
170
|
+
|
|
171
|
+
# Ruff stuff:
|
|
172
|
+
.ruff_cache/
|
|
173
|
+
|
|
174
|
+
# PyPI configuration file
|
|
175
|
+
.pypirc
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, WSP Canada Inc.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wsp-tasha-toolbox
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python tools for working with TASHA-based models
|
|
5
|
+
Author-email: Brian Cheung <brian.cheung@wsp.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/sap-toronto/wsp-tasha-toolbox
|
|
7
|
+
Project-URL: Issues, https://github.com/sap-toronto/wsp-tasha-toolbox/issues
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: geopandas>=1.0.1
|
|
16
|
+
Requires-Dist: numpy>=2.2.6
|
|
17
|
+
Requires-Dist: pandas>=2.2.3
|
|
18
|
+
Requires-Dist: pandera>=0.24.0
|
|
19
|
+
Requires-Dist: pyproj>=3.7.1
|
|
20
|
+
Requires-Dist: wsp-balsa>=2.1.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# wsp-tasha-toolbox
|
|
24
|
+
|
|
25
|
+
A toolbox for working with travel demand models based upon the *Travel Activity Scheduler for Household Agents (TASHA)* model.
|
|
26
|
+
|
|
27
|
+
Tools included in this toolbox are designed to work with models built using GTAModel V4.0+.
|
|
28
|
+
|
|
29
|
+
The modelling platform for all TASHA-based models (such as GTAModel V4.0+ in the GTHA and implementations in other regions) is developed by the [Travel Modelling Group](https://tmg.utoronto.ca/) at the University of Toronto.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Binary installer for the latest released version is available on the Python Package Index:
|
|
34
|
+
|
|
35
|
+
```batch
|
|
36
|
+
pip install wsp-tasha-toolbox
|
|
37
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# wsp-tasha-toolbox
|
|
2
|
+
|
|
3
|
+
A toolbox for working with travel demand models based upon the *Travel Activity Scheduler for Household Agents (TASHA)* model.
|
|
4
|
+
|
|
5
|
+
Tools included in this toolbox are designed to work with models built using GTAModel V4.0+.
|
|
6
|
+
|
|
7
|
+
The modelling platform for all TASHA-based models (such as GTAModel V4.0+ in the GTHA and implementations in other regions) is developed by the [Travel Modelling Group](https://tmg.utoronto.ca/) at the University of Toronto.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Binary installer for the latest released version is available on the Python Package Index:
|
|
12
|
+
|
|
13
|
+
```batch
|
|
14
|
+
pip install wsp-tasha-toolbox
|
|
15
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "code",
|
|
5
|
+
"execution_count": null,
|
|
6
|
+
"id": "c3e376bd",
|
|
7
|
+
"metadata": {},
|
|
8
|
+
"outputs": [],
|
|
9
|
+
"source": [
|
|
10
|
+
"import site\n",
|
|
11
|
+
"from pathlib import Path\n",
|
|
12
|
+
"\n",
|
|
13
|
+
"site.addsitedir(Path(\"../src\"))"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"cell_type": "code",
|
|
18
|
+
"execution_count": null,
|
|
19
|
+
"id": "c952265b",
|
|
20
|
+
"metadata": {},
|
|
21
|
+
"outputs": [],
|
|
22
|
+
"source": [
|
|
23
|
+
"import geopandas as gpd\n",
|
|
24
|
+
"import numpy as np\n",
|
|
25
|
+
"import pandas as pd\n",
|
|
26
|
+
"\n",
|
|
27
|
+
"from wsp_tasha_toolbox.data_model import MicrosimData"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"cell_type": "code",
|
|
32
|
+
"execution_count": null,
|
|
33
|
+
"id": "7bdc3010",
|
|
34
|
+
"metadata": {},
|
|
35
|
+
"outputs": [],
|
|
36
|
+
"source": [
|
|
37
|
+
"self = MicrosimData.from_result_folder(\n",
|
|
38
|
+
" \"path/to/model_run_output_folder\",\n",
|
|
39
|
+
" \"path/to/zone_shapefile.shp\",\n",
|
|
40
|
+
" zone_label='TAZ'\n",
|
|
41
|
+
")\n",
|
|
42
|
+
"self.attach_impedance('network', \"path/to/shortest_path.mtx\")"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"cell_type": "code",
|
|
47
|
+
"execution_count": null,
|
|
48
|
+
"id": "7e9fe17a",
|
|
49
|
+
"metadata": {},
|
|
50
|
+
"outputs": [],
|
|
51
|
+
"source": [
|
|
52
|
+
"self.zones"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"cell_type": "code",
|
|
57
|
+
"execution_count": null,
|
|
58
|
+
"id": "71b283e3",
|
|
59
|
+
"metadata": {},
|
|
60
|
+
"outputs": [],
|
|
61
|
+
"source": [
|
|
62
|
+
"self.impedances"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"cell_type": "code",
|
|
67
|
+
"execution_count": null,
|
|
68
|
+
"id": "1a829dfd",
|
|
69
|
+
"metadata": {},
|
|
70
|
+
"outputs": [],
|
|
71
|
+
"source": [
|
|
72
|
+
"self.households"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"cell_type": "code",
|
|
77
|
+
"execution_count": null,
|
|
78
|
+
"id": "9eae9e0b",
|
|
79
|
+
"metadata": {},
|
|
80
|
+
"outputs": [],
|
|
81
|
+
"source": [
|
|
82
|
+
"self.persons"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"cell_type": "code",
|
|
87
|
+
"execution_count": null,
|
|
88
|
+
"id": "0f02eb36",
|
|
89
|
+
"metadata": {},
|
|
90
|
+
"outputs": [],
|
|
91
|
+
"source": [
|
|
92
|
+
"self.trips"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"cell_type": "code",
|
|
97
|
+
"execution_count": null,
|
|
98
|
+
"id": "e3773b3c",
|
|
99
|
+
"metadata": {},
|
|
100
|
+
"outputs": [],
|
|
101
|
+
"source": [
|
|
102
|
+
"self.trip_modes"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"cell_type": "code",
|
|
107
|
+
"execution_count": null,
|
|
108
|
+
"id": "d83b7a3e",
|
|
109
|
+
"metadata": {},
|
|
110
|
+
"outputs": [],
|
|
111
|
+
"source": [
|
|
112
|
+
"self.trip_stations"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"cell_type": "code",
|
|
117
|
+
"execution_count": null,
|
|
118
|
+
"id": "81b811b7",
|
|
119
|
+
"metadata": {},
|
|
120
|
+
"outputs": [],
|
|
121
|
+
"source": [
|
|
122
|
+
"self.facilitate_passengers"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"cell_type": "code",
|
|
127
|
+
"execution_count": null,
|
|
128
|
+
"id": "9f7e4d07",
|
|
129
|
+
"metadata": {},
|
|
130
|
+
"outputs": [],
|
|
131
|
+
"source": []
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"metadata": {
|
|
135
|
+
"kernelspec": {
|
|
136
|
+
"display_name": "wsp-tasha-toolbox",
|
|
137
|
+
"language": "python",
|
|
138
|
+
"name": "python3"
|
|
139
|
+
},
|
|
140
|
+
"language_info": {
|
|
141
|
+
"codemirror_mode": {
|
|
142
|
+
"name": "ipython",
|
|
143
|
+
"version": 3
|
|
144
|
+
},
|
|
145
|
+
"file_extension": ".py",
|
|
146
|
+
"mimetype": "text/x-python",
|
|
147
|
+
"name": "python",
|
|
148
|
+
"nbconvert_exporter": "python",
|
|
149
|
+
"pygments_lexer": "ipython3",
|
|
150
|
+
"version": "3.13.3"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"nbformat": 4,
|
|
154
|
+
"nbformat_minor": 5
|
|
155
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "wsp-tasha-toolbox"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
authors = [
|
|
5
|
+
{ name = "Brian Cheung", email = "brian.cheung@wsp.com" }
|
|
6
|
+
]
|
|
7
|
+
description = "Python tools for working with TASHA-based models"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 4 - Beta",
|
|
11
|
+
"License :: OSI Approved :: BSD License",
|
|
12
|
+
"Operating System :: OS Independent",
|
|
13
|
+
"Programming Language :: Python :: 3"
|
|
14
|
+
]
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"geopandas>=1.0.1",
|
|
18
|
+
"numpy>=2.2.6",
|
|
19
|
+
"pandas>=2.2.3",
|
|
20
|
+
"pandera>=0.24.0",
|
|
21
|
+
"pyproj>=3.7.1",
|
|
22
|
+
"wsp-balsa>=2.1.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/sap-toronto/wsp-tasha-toolbox"
|
|
27
|
+
Issues = "https://github.com/sap-toronto/wsp-tasha-toolbox/issues"
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["setuptools>=64", "setuptools-scm>=8"]
|
|
31
|
+
build-backend = "setuptools.build_meta"
|
|
32
|
+
|
|
33
|
+
[dependency-groups]
|
|
34
|
+
dev = [
|
|
35
|
+
"build>=1.2.2.post1,<2",
|
|
36
|
+
"twine>=6.0.1,<7"
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.packages.find]
|
|
40
|
+
where = ["src"]
|
|
41
|
+
|
|
42
|
+
[tool.setuptools_scm]
|
|
43
|
+
version_file = "src/wsp_tasha_toolbox/_version.py"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
+
|
|
6
|
+
TYPE_CHECKING = False
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
11
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
12
|
+
else:
|
|
13
|
+
VERSION_TUPLE = object
|
|
14
|
+
|
|
15
|
+
version: str
|
|
16
|
+
__version__: str
|
|
17
|
+
__version_tuple__: VERSION_TUPLE
|
|
18
|
+
version_tuple: VERSION_TUPLE
|
|
19
|
+
|
|
20
|
+
__version__ = version = '0.1.0'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 1, 0)
|
|
File without changes
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
from .enums_microsim import Activity
|
|
2
|
+
from .enums_tts2016 import TripPurpose
|
|
3
|
+
|
|
4
|
+
activity_pair_mapping = {
|
|
5
|
+
(Activity.HOME, Activity.HOME): TripPurpose.HOME,
|
|
6
|
+
(Activity.HOME, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
7
|
+
(Activity.HOME, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
8
|
+
(Activity.HOME, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
9
|
+
(Activity.HOME, Activity.MARKET): TripPurpose.MARKET,
|
|
10
|
+
(Activity.HOME, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
11
|
+
(Activity.HOME, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
12
|
+
(Activity.HOME, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
13
|
+
(Activity.HOME, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
14
|
+
(Activity.HOME, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
15
|
+
(Activity.INDIVIDUAL_OTHER, Activity.HOME): TripPurpose.HOME,
|
|
16
|
+
(Activity.INDIVIDUAL_OTHER, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
17
|
+
(Activity.INDIVIDUAL_OTHER, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
18
|
+
(Activity.INDIVIDUAL_OTHER, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
19
|
+
(Activity.INDIVIDUAL_OTHER, Activity.MARKET): TripPurpose.MARKET,
|
|
20
|
+
(Activity.INDIVIDUAL_OTHER, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
21
|
+
(Activity.INDIVIDUAL_OTHER, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
22
|
+
(Activity.INDIVIDUAL_OTHER, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
23
|
+
(Activity.INDIVIDUAL_OTHER, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
24
|
+
(Activity.INDIVIDUAL_OTHER, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
25
|
+
(Activity.JOINT_MARKET, Activity.HOME): TripPurpose.HOME,
|
|
26
|
+
(Activity.JOINT_MARKET, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
27
|
+
(Activity.JOINT_MARKET, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
28
|
+
(Activity.JOINT_MARKET, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
29
|
+
(Activity.JOINT_MARKET, Activity.MARKET): TripPurpose.MARKET,
|
|
30
|
+
(Activity.JOINT_MARKET, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
31
|
+
(Activity.JOINT_MARKET, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
32
|
+
(Activity.JOINT_MARKET, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
33
|
+
(Activity.JOINT_MARKET, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
34
|
+
(Activity.JOINT_MARKET, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
35
|
+
(Activity.JOINT_OTHER, Activity.HOME): TripPurpose.HOME,
|
|
36
|
+
(Activity.JOINT_OTHER, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
37
|
+
(Activity.JOINT_OTHER, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
38
|
+
(Activity.JOINT_OTHER, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
39
|
+
(Activity.JOINT_OTHER, Activity.MARKET): TripPurpose.MARKET,
|
|
40
|
+
(Activity.JOINT_OTHER, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
41
|
+
(Activity.JOINT_OTHER, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
42
|
+
(Activity.JOINT_OTHER, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
43
|
+
(Activity.JOINT_OTHER, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
44
|
+
(Activity.JOINT_OTHER, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
45
|
+
(Activity.MARKET, Activity.HOME): TripPurpose.HOME,
|
|
46
|
+
(Activity.MARKET, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
47
|
+
(Activity.MARKET, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
48
|
+
(Activity.MARKET, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
49
|
+
(Activity.MARKET, Activity.MARKET): TripPurpose.MARKET,
|
|
50
|
+
(Activity.MARKET, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
51
|
+
(Activity.MARKET, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
52
|
+
(Activity.MARKET, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
53
|
+
(Activity.MARKET, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
54
|
+
(Activity.MARKET, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
55
|
+
(Activity.PRIMARY_WORK, Activity.HOME): TripPurpose.HOME,
|
|
56
|
+
(Activity.PRIMARY_WORK, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
57
|
+
(Activity.PRIMARY_WORK, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
58
|
+
(Activity.PRIMARY_WORK, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
59
|
+
(Activity.PRIMARY_WORK, Activity.MARKET): TripPurpose.MARKET,
|
|
60
|
+
(Activity.PRIMARY_WORK, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
61
|
+
(Activity.PRIMARY_WORK, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
62
|
+
(Activity.PRIMARY_WORK, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
63
|
+
(Activity.PRIMARY_WORK, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
64
|
+
(Activity.PRIMARY_WORK, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
65
|
+
(Activity.SCHOOL, Activity.HOME): TripPurpose.HOME,
|
|
66
|
+
(Activity.SCHOOL, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
67
|
+
(Activity.SCHOOL, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
68
|
+
(Activity.SCHOOL, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
69
|
+
(Activity.SCHOOL, Activity.MARKET): TripPurpose.MARKET,
|
|
70
|
+
(Activity.SCHOOL, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
71
|
+
(Activity.SCHOOL, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
72
|
+
(Activity.SCHOOL, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
73
|
+
(Activity.SCHOOL, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
74
|
+
(Activity.SCHOOL, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
75
|
+
(Activity.SECONDARY_WORK, Activity.HOME): TripPurpose.HOME,
|
|
76
|
+
(Activity.SECONDARY_WORK, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
77
|
+
(Activity.SECONDARY_WORK, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
78
|
+
(Activity.SECONDARY_WORK, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
79
|
+
(Activity.SECONDARY_WORK, Activity.MARKET): TripPurpose.MARKET,
|
|
80
|
+
(Activity.SECONDARY_WORK, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
81
|
+
(Activity.SECONDARY_WORK, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
82
|
+
(Activity.SECONDARY_WORK, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
83
|
+
(Activity.SECONDARY_WORK, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
84
|
+
(Activity.SECONDARY_WORK, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
85
|
+
(Activity.WORK_BASED_BUSINESS, Activity.HOME): TripPurpose.HOME,
|
|
86
|
+
(Activity.WORK_BASED_BUSINESS, Activity.INDIVIDUAL_OTHER): TripPurpose.OTHER,
|
|
87
|
+
(Activity.WORK_BASED_BUSINESS, Activity.JOINT_MARKET): TripPurpose.MARKET,
|
|
88
|
+
(Activity.WORK_BASED_BUSINESS, Activity.JOINT_OTHER): TripPurpose.OTHER,
|
|
89
|
+
(Activity.WORK_BASED_BUSINESS, Activity.MARKET): TripPurpose.MARKET,
|
|
90
|
+
(Activity.WORK_BASED_BUSINESS, Activity.PRIMARY_WORK): TripPurpose.WORK,
|
|
91
|
+
(Activity.WORK_BASED_BUSINESS, Activity.RETURN_FROM_WORK): TripPurpose.HOME,
|
|
92
|
+
(Activity.WORK_BASED_BUSINESS, Activity.SCHOOL): TripPurpose.SCHOOL,
|
|
93
|
+
(Activity.WORK_BASED_BUSINESS, Activity.SECONDARY_WORK): TripPurpose.WORK,
|
|
94
|
+
(Activity.WORK_BASED_BUSINESS, Activity.WORK_BASED_BUSINESS): TripPurpose.WORK,
|
|
95
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from enum import StrEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Activity(StrEnum):
|
|
5
|
+
PRIMARY_WORK = "PrimaryWork" # The main work activity episode going to the assigned work location for the individual
|
|
6
|
+
SECONDARY_WORK = "SecondaryWork" # A work activity episode not going to the primary work location
|
|
7
|
+
WORK_BASED_BUSINESS = "WorkBasedBusiness" # A work location not going to the main work location, such as a business meeting
|
|
8
|
+
SCHOOL = "School" # A school activity episode
|
|
9
|
+
MARKET = "Market" # A market activity episode
|
|
10
|
+
JOINT_MARKET = "JointMarket" # A market activity episode that is part of a joint tour
|
|
11
|
+
INDIVIDUAL_OTHER = "IndividualOther" # An activity episode that is not work, school, or market
|
|
12
|
+
JOINT_OTHER = "JointOther" # An activity episode that is not work, school, or market and is part of a joint tour
|
|
13
|
+
HOME = "Home" # The home activity episode
|
|
14
|
+
RETURN_FROM_WORK = "ReturnFromWork" # A purposeful return home activity episode from work, such as lunch
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Mode(StrEnum):
|
|
18
|
+
AUTO = "Auto"
|
|
19
|
+
CARPOOL = "Carpool"
|
|
20
|
+
SCHOOLBUS = "Schoolbus"
|
|
21
|
+
DRIVE_ACCESS_TRANSIT = "DAT"
|
|
22
|
+
WALK_ACCESS_TRANSIT = "WAT"
|
|
23
|
+
WALK = "Walk"
|
|
24
|
+
BIKE = "Bicycle"
|
|
25
|
+
PASSENGER = "Passenger"
|
|
26
|
+
RIDESHARE = "RideShare"
|
|
27
|
+
PASSENGER_ACCESS_TRANSIT = "PAT"
|
|
28
|
+
PASSENGER_EGRESS_TRANSIT = "PET"
|
|
29
|
+
VEHICLE_FOR_HIRE = "VFH"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class TransitDirection(StrEnum):
|
|
33
|
+
AUTO_TO_TRANSIT = "auto2transit"
|
|
34
|
+
TRANSIT_TO_AUTO = "transit2auto"
|