Skip to content

Moved utilities in tm2py into tm2py_utils #1

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__/
*.pyc
*.py[cod]
*.egg-info/
76 changes: 74 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,76 @@
# tm2py-utils
Travel Model Two utilities, including post-processing and summarization
Travel Model Two utilities, including post-processing, summaraziation and other utilities for tm2py.
To Run tm2py the [Travel Model Two (tm2) repo](https://github.com/BayAreaMetro/tm2py) for model running.
* __Note:__ tm2py-utils was separated out to allow for a the usage of a wide variety of packages without affecting / breaking the main model. This allows for fast development of utilities with relative stability of the model.

See the [Travel Model Two (tm2) repo](https://github.com/BayAreaMetro/tm2py) for model running.
## Author

Lachlan Perrier
[email protected]
WSP

## License

[Include license info if applicable]

## Installation
The environment is intended to work with the python
### Quick Start
If you only require the usage of Acceptance Criteria Tools, you can install directly from git:
1) open OpenPaths EMME Shell 24.01.00

2) Install TM2PY Utils
```python
pip install git+https://github.com/BayAreaMetro/tm2py-utils.git
```

### Development
If you would like to develop and/or download example notebooks
1) Open OpenPaths Shell Emme Shell (24.01.00)

2) Create and activate your virtual Environement
```bash
python -m venv /path/to/venv
```

3) __Optional__ if you would like access to OpenPaths API:
Copy emmepath file (usually found in C:\Program Files\Bentley\OpenPaths\EMME 24.01.00) to venv/path/to/venv/Lib/site-packages

4) clone tm2py-utils in the appropriate directory
```bash
cd path/to/git/repo/location
git clone https://github.com/BayAreaMetro/tm2py-utils.git
```
5) Install tm2py-utils in your virtual environment
```
cd tm2py-utils
pip install -e .
```
* __Note:__ The environment is fairly lightweight and should work installed on top of an existing tm2py installation, if this is done it is recommended to create a separate virtual environment.

## Examples / Features
if the package was installed correctly you should be able to run the below
### Acceptance Criteria
```python
from tm2py_utils.acceptance.canonical import Canonical
from tm2py_utils.acceptance.observed import Observed
from tm2py_utils.acceptance.simulated import Simulated
from tm2py_utils.acceptance.acceptance import Acceptance

# Note, these will have to point to the correct files of a successfully run model
scenario_config_file = "scenario_config.toml"
model_config_file = "model_config.toml"
canonical_crosswalk_file = "acceptance/canonical_crosswalk.toml"
observed_config_file = "acceptance/observed_data.toml"
output_folder_root = "output_summaries/"

c = Canonical(canonical_crosswalk_file, scenario_file=scenario_config_file)

o = Observed(canonical=c, observed_file=observed_config_file)

s = Simulated(canonical=c, scenario_file=scenario_config_file, model_file=model_config_file)

a = Acceptance(canonical=c, simulated=s, observed=o, output_file_root=output_folder_root)

a.make_acceptance(make_transit=True, make_roadway=True, make_other=True)
```
3 changes: 3 additions & 0 deletions examples/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Note: The files in this folder are examples validated with the current code,
The most up to date files can be found at:
https://github.com/BayAreaMetro/tm2py/tree/master/examples
18 changes: 18 additions & 0 deletions examples/canonical_crosswalk.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
####################################
# CANONICAL & CROSSWALKS #
####################################

[remote_io]
crosswalk_folder_root = "/Users/wsp/Documents/GitHub/tm2py/examples/temp_acceptance/"
#crosswalk_folder_root = "/Users/USVA682771/GitHub/tm2py/examples/temp_acceptance/"

[crosswalks]
crosswalk_standard_survey_file = "transit-standard-2015-to-survey-crosswalk.csv"
standard_to_tm2_modes_file = "gtfs_to_tm2_mode_crosswalk.csv"
standard_to_emme_transit_file = "emme_taz_transit_network_node_id_crosswalk.csv"
canonical_agency_names_file = "canonical-agency-names.csv"
canonical_station_names_file = "canonical-station-names.csv"
block_group_to_maz_url = "https://raw.githubusercontent.com/BayAreaMetro/travel-model-two/master/maz_taz/crosswalks/Census%202010%20hhs%20maz%20share%20of%20blockgroups_ACS2017.csv"
pems_station_to_tm2_links_file = "pems_station_to_TM2_links_crosswalk.csv"
standard_to_emme_nodes_file = "emme_drive_network_node_id_crosswalk.csv"

Loading