aequilibrae.project package#
Subpackages#
- aequilibrae.project.data package
- aequilibrae.project.network package
- Subpackages
- Submodules
- aequilibrae.project.network.connector_creation module
- aequilibrae.project.network.gmns_builder module
- aequilibrae.project.network.gmns_exporter module
- aequilibrae.project.network.haversine module
- aequilibrae.project.network.link module
- aequilibrae.project.network.link_type module
- aequilibrae.project.network.link_types module
- aequilibrae.project.network.links module
- aequilibrae.project.network.mode module
- aequilibrae.project.network.modes module
- aequilibrae.project.network.network module
Network
Network.netsignal
Network.req_link_flds
Network.req_node_flds
Network.protected_fields
Network.graphs
Network.link_types
Network.skimmable_fields()
Network.list_modes()
Network.create_from_osm()
Network.create_from_gmns()
Network.export_to_gmns()
Network.signal_handler()
Network.build_graphs()
Network.set_time_field()
Network.count_links()
Network.count_centroids()
Network.count_nodes()
Network.extent()
Network.convex_hull()
- aequilibrae.project.network.node module
- aequilibrae.project.network.nodes module
- aequilibrae.project.network.period module
- aequilibrae.project.network.periods module
- aequilibrae.project.network.safe_class module
- Module contents
Submodules#
aequilibrae.project.about module#
- class aequilibrae.project.about.About(project)[source]#
Bases:
object
Provides an interface for querying and editing the about table of an AequilibraE project
>>> from aequilibrae import Project >>> project = Project.from_path("/tmp/test_project") # Adding a new field and saving it >>> project.about.add_info_field('my_super_relevant_field') >>> project.about.my_super_relevant_field = 'super relevant information' >>> project.about.write_back() # changing the value for an existing value/field >>> project.about.scenario_name = 'Just a better scenario name' >>> project.about.write_back()
- add_info_field(info_field: str) None [source]#
Adds new information field to the model
- Arguments:
info_field (
str
): Name of the desired information field to be added. Has to be a valid Python VARIABLE name (i.e. letter as first character, no spaces and no special characters)
>>> from aequilibrae import Project >>> p = Project.from_path("/tmp/test_project") >>> p.about.add_info_field('a_cool_field') >>> p.about.a_cool_field = 'super relevant information' >>> p.about.write_back()
aequilibrae.project.basic_table module#
- class aequilibrae.project.basic_table.BasicTable(project)[source]#
Bases:
object
Basic resources used by all subclasses
- extent() Polygon [source]#
Queries the extent of the layer included in the model
- Returns:
Shapely polygon with the bounding box of the layer.
- Return type:
model extent (
Polygon
)
- property fields: FieldEditor#
Returns a FieldEditor class instance to edit the zones table fields and their metadata
aequilibrae.project.data_loader module#
aequilibrae.project.database_connection module#
aequilibrae.project.field_editor module#
- class aequilibrae.project.field_editor.FieldEditor(project, table_name: str)[source]#
Bases:
object
Allows user to edit the project data tables
The field editor is used for two different purposes:
Managing data tables (adding and removing fields)
Editing the tables’ metadata (description of each field)
This is a general class used to manage all project’s data tables accessible to the user and but it should be accessed directly from within the module corresponding to the data table one wants to edit. Example:
>>> from aequilibrae import Project >>> proj = Project.from_path("/tmp/test_project") # To edit the fields of the link_types table >>> lt_fields = proj.network.link_types.fields # To edit the fields of the modes table >>> m_fields = proj.network.modes.fields
Field descriptions are kept in the table attributes_documentation
- add(field_name: str, description: str, data_type='NUMERIC') None [source]#
Adds new field to the data table
- Arguments:
field_name (
str
): Field to be added to the table. Must be a valid SQLite field name description (str
): Description of the field to be inserted in the metadata data_type (str
, optional): Valid SQLite Data type. Default: “NUMERIC”
aequilibrae.project.project module#
- class aequilibrae.project.project.Project[source]#
Bases:
object
AequilibraE project class
>>> newfile = Project() >>> newfile.new('/tmp/new_project')
>>> from aequilibrae.project import Project >>> existing = Project() >>> existing.open('/tmp/test_project') >>> #Let's check some of the project's properties >>> existing.network.list_modes() ['M', 'T', 'b', 'c', 't', 'w'] >>> existing.network.count_links() 76 >>> existing.network.count_nodes() 24
- open(project_path: str) None [source]#
Loads project from disk
- Arguments:
project_path (
str
): Full path to the project data folder. If the project inside does not exist, it will fail.
- new(project_path: str) None [source]#
Creates a new project
- Arguments:
project_path (
str
): Full path to the project data folder. If folder exists, it will fail
- load(project_path: str) None [source]#
Loads project from disk
Deprecated since version 0.7.0: Use
open()
instead.- Arguments:
project_path (
str
): Full path to the project data folder. If the project inside does not exist, it will fail.
- property project_parameters: Parameters#
- property parameters: dict#
- check_file_indices() None [source]#
Makes results_database.sqlite and the matrices folder compatible with project database
- property zoning#
aequilibrae.project.project_cleaning module#
aequilibrae.project.project_creation module#
- aequilibrae.project.project_creation.create_base_tables(conn: Connection, logger: Logger, db_type: str) None [source]#
- aequilibrae.project.project_creation.add_triggers(conn: Connection, logger: Logger, db_type: str) None [source]#
Adds consistency triggers to the project
aequilibrae.project.table_loader module#
aequilibrae.project.zone module#
- class aequilibrae.project.zone.Zone(dataset: dict, zoning)[source]#
Bases:
SafeClass
Single zone object that can be queried and manipulated in memory
- add_centroid(point: Point, robust=True) None [source]#
Adds a centroid to the network file
- Arguments:
point (
Point
): Shapely Point corresponding to the desired centroid position. If None, uses the geometric center of the zone robust (Bool
, Optional): Moves the centroid location around to avoid node conflict. Defaults to True.
- connect_mode(mode_id: str, link_types='', connectors=1, conn: Connection | None = None) None [source]#
Adds centroid connectors for the desired mode to the network file
Centroid connectors are created by connecting the zone centroid to one or more nodes selected from all those that satisfy the mode and link_types criteria and are inside the zone.
The selection of the nodes that will be connected is done simply by computing running the KMeans2 clustering algorithm from SciPy and selecting the nodes closest to each cluster centroid.
When there are no node candidates inside the zone, the search area is progressively expanded until at least one candidate is found.
If fewer candidates than required connectors are found, all candidates are connected.
- Arguments:
mode_id (
str
): Mode ID we are trying to connectlink_types (
str
, Optional): String with all the link type IDs that can be considered. eg: yCdR. Defaults to ALL link typesconnectors (
int
, Optional): Number of connectors to add. Defaults to 1
aequilibrae.project.zoning module#
- class aequilibrae.project.zoning.Zoning(network)[source]#
Bases:
BasicTable
Access to the API resources to manipulate the zones table in the project
>>> from aequilibrae import Project >>> project = Project.from_path("/tmp/test_project") >>> zoning = project.zoning >>> zone_downtown = zoning.get(1) >>> zone_downtown.population = 637 >>> zone_downtown.employment = 10039 >>> zone_downtown.save() # changing the value for an existing value/field >>> project.about.scenario_name = 'Just a better scenario name' >>> project.about.write_back() # We can also add one more field to the table >>> fields = zoning.fields >>> fields.add('parking_spots', 'Total licensed parking spots', 'INTEGER')
- new(zone_id: int) Zone [source]#
Creates a new zone
- Returns:
zone (
Zone
): A new zone object populated only with zone_id (but not saved in the model yet)
- create_zoning_layer()[source]#
Creates the ‘zones’ table for project files that did not previously contain it
- coverage() Polygon [source]#
Returns a single polygon for the entire zoning coverage
- Returns:
model coverage (
Polygon
): Shapely (Multi)polygon of the zoning system.
- all_zones() dict [source]#
Returns a dictionary with all Zone objects available in the model. zone_id as key
- get_closest_zone(geometry: Point | LineString | MultiLineString) int [source]#
Returns the zone in which the given geometry is located.
If the geometry is not fully enclosed by any zone, the zone closest to the geometry is returned
- Arguments:
geometry (
Point
orLineString
): A Shapely geometry object- Return:
zone_id (
int
): ID of the zone applicable to the point provided