Skip to main content
`Ctrl`+`K`

# aequilibrae.transit.Transit

class aequilibrae.transit.Transit(project)
  __init__(project)
    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_transit_database`() | Creates the public transport database
  `load`([period_ids]) |
  `new_gtfs_builder`(agency, file_path[, day, ...]) | Returns a `GTFSRouteSystemBuilder` object compatible with the project
  `save_graphs`([period_ids]) |

  Attributes

  `default_capacities` |
  `default_pces` |
  `graphs` |
  `transit` |
  `pt_con` |

  build_pt_preload(start: int, end: int, inclusion_cond: str = 'start') → DataFrame

    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
  create_transit_database()

    Creates the public transport database

  load(period_ids: List[int] | None = None)
  new_gtfs_builder(agency, file_path, day='', description='') → GTFSRouteSystemBuilder

    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

  save_graphs(period_ids: List[int] | None = None)
  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>