aequilibrae#

Classes

Project(project_path)

AequilibraE project class

class aequilibrae.Project(project_path: PathLike | str)[source]#

AequilibraE project class

Create Project#
>>> new_project = Project.create(project_path)

# Safely closes the project
>>> new_project.close()
Open Project#
>>> existing_project = Project(project_path)

>>> existing_project.close()
classmethod create(project_path: PathLike | str) → Project[source]#

Create a ready-to-use project.

Parameters:

project_path – Full path to a new project data folder.

Returns:

The open project, usable as a context manager.

Raises:

FileExistsError – If the destination already exists.

classmethod open(project_path: PathLike | str) → Project[source]#
activate() → None[source]#
check_file_indices() → NoReturn[source]#

Makes results_database.sqlite and the matrices folder compatible with project database

clone_scenario(scenario_name: str, description: str = '') → None[source]#

Clones the active scenario.

Arguments:

scenario_name (str): scenario name

description (str): useful scenario description

close() → None[source]#

Safely closes the project

create_empty_scenario(scenario_name: str, description: str = '') → None[source]#

Creates an empty scenario, without any links, nodes, and zones.

Arguments:

scenario_name (str): scenario name

description (str): useful scenario description

deactivate() → None[source]#
list_scenarios() → DataFrame[source]#

Lists the existing scenarios.

Returns:

scenarios (pd.DataFrame): Pandas DataFrame with existing scenarios

log() → Log[source]#

Returns a log object

allows the user to read the log or clear it

transaction()[source]#

Enter transaction contexts for every existing database connection.

upgrade(ignore_project: bool = False, ignore_transit: bool = False, ignore_results: bool = False)[source]#

Find and apply all applicable migrations.

Each database upgrade is applied within a single transaction.

Optionally ignore specific databases. This is useful when a database is known to be incompatible with some migrations but you’d still like to upgrade the others. Take care when ignoring a database. For a particular version of AequilibraE, it is assumed that all migrations have been applied successfully or the project was created with the latest schema, skipping/ignoring migrations will likely lead to issues/broken assumptions.

If skipping a specific migration is required, use the aequilibrae.project.tools.MigrationManager object directly. Consult it’s documentation page for details. Take care when skipping migrations.

Arguments:
ignore_project (bool, optional): Ignore the project database. No direct migrations will be

applied. Defaults to False.

ignore_transit (bool, optional): Ignore the transit database. No direct migrations will be

applied. Defaults to False.

ignore_results (bool, optional): Ignore the results database. No direct migrations will be

applied. Defaults to False.

use_scenario(scenario_name: str) → None[source]#

Switch the active scenario.

Arguments:

scenario_name (str): name of the scenario to be activated

property about: About#
property db_connection: NestedTransactionManager#
property matrices: Matrices#
property parameters: dict#
property path_to_file: Path#
property project_base_path: Path#
property project_parameters: Parameters#
property results: Results#
property results_connection: NestedTransactionManager#
property road: RoadNetwork#

Road network and graph builder for the current scenario.

property run: dict[str, partial]#

Load and return the AequilibraE run module with the default arguments from parameters.yml partially applied, along with an explicit project argument.

Refer to run/__init__.py file within the project folder for documentation.

property tables: Tables#
property transit: Transit#
property transit_connection: NestedTransactionManager#