aequilibrae.transit.Transit#

class aequilibrae.transit.Transit(project)[source]#
__init__(project)[source]#
Arguments:

project (Project, Optional): The Project to connect to. By default, uses the currently active project

Methods

__init__(project)

build_pt_preload(start, end[, inclusion_cond])

Builds a preload vector for the transit network over the specified time period

create_graph(**kwargs)

Create a transit graph from an existing GTFS import.

create_transit_database()

Creates the public transport database

get_table(table_name)

load([period_ids])

Load the previously saved transit graphs from the 'public_transport.sqlite' database.

new_gtfs_builder(agency, file_path[, day, ...])

Returns a GTFSRouteSystemBuilder object compatible with the project

remove_graphs(period_ids[, unload])

Remove the previously saved transit graphs from the 'public_transport.sqlite' database.

save_graphs([period_ids, force])

Save the previously build transit graphs to the 'public_transport.sqlite' database.

Attributes

build_pt_preload(start: int, end: int, inclusion_cond: str = 'start') DataFrame[source]#

Builds a preload vector for the transit network over the specified time period

Arguments:

start (int): The start of the period for which to check pt schedules (seconds from midnight)

end (int): The end of the period for which to check pt schedules, (seconds from midnight)

inclusion_cond (str): Specifies condition with which to include/exclude pt trips from the preload.

Returns:

preloads (pd.DataFrame): A DataFrame of preload from transit vehicles that can be directly used in an assignment

>>> project = create_example(project_path, "coquimbo")

>>> project.network.build_graphs()

>>> start = int(6.5 * 60 * 60) # 6:30 am
>>> end = int(8.5 * 60 * 60)   # 8:30 am

>>> transit = Transit(project)
>>> preload = transit.build_pt_preload(start, end)
create_graph(**kwargs) TransitGraphBuilder[source]#

Create a transit graph from an existing GTFS import.

All arguments are forwarded to ‘TransitGraphBuilder’.

A ‘period_id’ may be specified to select a time period. By default, a whole day is used. See ‘project.network.Periods’ for more details.

create_transit_database()[source]#

Creates the public transport database

get_table(table_name) DataFrame[source]#
load(period_ids: List[int] | None = None)[source]#

Load the previously saved transit graphs from the ‘public_transport.sqlite’ database. Loading may be filtered by ‘period_id’.

Arguments:

period_ids (int): List of periods of to load. Defaults to all available graph configurations.

new_gtfs_builder(agency, file_path, day='', description='') GTFSRouteSystemBuilder[source]#

Returns a GTFSRouteSystemBuilder object compatible with the project

Arguments:

agency (str): Name for the agency this feed refers to (e.g. ‘CTA’)

file_path (str): Full path to the GTFS feed (e.g. ‘D:/project/my_gtfs_feed.zip’)

day (str, Optional): Service data contained in this field to be imported (e.g. ‘2019-10-04’)

description (str, Optional): Description for this feed (e.g. ‘CTA2019 fixed by John Doe’)

Returns:

gtfs_feed (StaticGTFS): A GTFS feed that can be added to this network

remove_graphs(period_ids: List[int], unload: bool = False)[source]#

Remove the previously saved transit graphs from the ‘public_transport.sqlite’ database. Removing may be filtered by ‘period_id’.

Arguments:

period_ids (int): List of periods of to save. unload (bool): Also unload the graph.

save_graphs(period_ids: List[int] | None = None, force: bool = False)[source]#

Save the previously build transit graphs to the ‘public_transport.sqlite’ database. Saving may be filtered by ‘period_id’.

Arguments:

period_ids (int): List of periods of to save. Defaults to ‘project.network.periods.default_period.period_id’. force (bool): Remove the existing graphs before saving the ‘period_ids’ graphs. Default ‘False’.

default_capacities = {'other': [30, 60], 0: [150, 300], 1: [280, 560], 11: [30, 60], 12: [50, 100], 2: [700, 700], 3: [30, 60], 4: [400, 800], 5: [20, 40]}#
default_pces = {'other': 2.0, 0: 5.0, 1: 5.0, 11: 3.0, 3: 4.0, 5: 4.0}#
graphs: Dict[str, TransitGraph] = {1: <aequilibrae.transit.transit_graph_builder.TransitGraphBuilder object>}#
pt_con: Connection#
transit = <aequilibrae.utils.python_signal.PythonSignal object>#