Build CSA preprocessing

Builds structures related to transfer patterns

builders.build_CSA.extract_connections(route_trips: tuple)list[source]

For a given route id, extract all connections form its trips.

Parameters

route_trips (tuple) – Format: route id, list of trips.

Returns

list of tuples. format: [(from stop, to stop, from time, to time, trip id)].

Return type

route_connections (list)

Examples

>>> route_connections = extract_connections(route_trips)
builders.build_CSA.initialize()tuple[source]

Initialize variables for building transfers file.

Returns

print line breaker start_time: timestamp object USE_PARALlEL (int): 1 for parallel and 0 for serial CORES (int): Number of codes to be used start_time = time()

Return type

breaker (str)

Examples

>>> breaker, USE_PARALlEL, CORES, start_time, GENERATE_LOGFILE = initialize()
builders.build_CSA.process_csa_array(connections_list)list[source]

Processing function for CSA build. Currently supported functionality are: 1. Filter connections with from stop == to stop and departure time == arrival time 2. Sort the connection array #TODO: Better sort function

Parameters

connections_list (list) – list of tuples. format: [(from stop, to stop, from time, to time, trip id)].

Returns

list of tuples. format: [(from stop, to stop, from time, to time, trip id)].

Return type

connections_list (list)

Examples

>>> connections_list = process_csa_array(connections_list)
builders.build_CSA.save_csa(final_connections: list, NETWORK_NAME: str)None[source]

Save structures related to CSA

Parameters
  • final_connections (list) – list of tuples. format: [(from stop, to stop, from time, to time, trip id)].

  • NETWORK_NAME (str) – Network name

Returns

None