Skip to content

BayAreaMetro/tm2py-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tm2py-utils

Travel Model Two utilities, including post-processing, summaraziation and other utilities for tm2py.
To Run tm2py the Travel Model Two (tm2) repo 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.

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

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

python -m venv /path/to/venv
  1. 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

  2. clone tm2py-utils in the appropriate directory

cd path/to/git/repo/location
git clone https://github.com/BayAreaMetro/tm2py-utils.git
  1. 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

Generate files related to acceptance criteria

from tm2py_utils.summary.acceptance.canonical import Canonical
from tm2py_utils.summary.acceptance.observed import Observed
from tm2py_utils.summary.acceptance.simulated import Simulated
from tm2py_utils.summary.acceptance.acceptance import Acceptance

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

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)

Archive model run

Archive important Files of a specific model run into an archive directory.

assuming your environment is active, you can ensure this by running:

\path\to\venv\Scripts\activate

A model run can then be archived using:

tm2py-utils archive path\to\model\run path\to\model\run

or

tm2py-utils archive path\to\model\run path\to\model\run -n "run name"

Alternatively python script can be used

from tm2py_utils.misc.archive import parse_cli_archive
parse_cli_archive(r"model\run\directory", r"archive\run\directory")

About

Travel Model Two python edition utilities, including post-processing and summarization

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7