Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
r-akemii committed Sep 17, 2024
1 parent 10b11b7 commit 0715ee5
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 111 deletions.
14 changes: 13 additions & 1 deletion docs/create_docs_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
from pathlib import Path

Expand All @@ -14,4 +15,15 @@
project = create_example("/tmp/test_project_gc")
project.close()
project = create_example("/tmp/test_project_ga")
project.close()
project.close()
project = create_example("/tmp/accessing_sfalls_data")
project.close()
project = create_example("/tmp/accessing_nauru_data", "nauru")
project.close()
project = create_example("/tmp/accessing_coquimbo_data", "coquimbo")
project.close()

# Create empty folder
if not os.path.exists("/tmp/matrix_example"):

os.makedirs("/tmp/matrix_example")
26 changes: 13 additions & 13 deletions docs/source/examples/assignment_workflows/plot_forecasting.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
distributing these trips into the network. Later, we estimate a set of future demand vectors
which are going to be the input of a future year assignnment with select link analysis.
"""
# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.Graph`
# * :func:`aequilibrae.paths.TrafficClass`
# * :func:`aequilibrae.paths.TrafficAssignment`
# * :func:`aequilibrae.distribution.Ipf`
# * :func:`aequilibrae.distribution.GravityCalibration`
# * :func:`aequilibrae.distribution.GravityApplication`
# * :func:`aequilibrae.distribution.SyntheticGravityModel`
# * :func:`aequilibrae.matrix.AequilibraeData`

# %%

# Imports
Expand Down Expand Up @@ -425,16 +438,3 @@ def plot_tlfd(demand, skim, name):
# %%
# Close the project
project.close()

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.Graph`
# * :func:`aequilibrae.paths.TrafficClass`
# * :func:`aequilibrae.paths.TrafficAssignment`
# * :func:`aequilibrae.distribution.Ipf`
# * :func:`aequilibrae.distribution.GravityCalibration`
# * :func:`aequilibrae.distribution.GravityApplication`
# * :func:`aequilibrae.distribution.SyntheticGravityModel`
# * :func:`aequilibrae.matrix.AequilibraeData`
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
We use data from Coquimbo, a city in La Serena Metropolitan Area in Chile.
"""
# %%
# .. admonition:: References
#
# * :ref:`transit_assignment_graph`
# * :ref:`transit_hyperpath_routing`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.transit.Transit`
# * :func:`aequilibrae.transit.TransitGraphBuilder`
# * :func:`aequilibrae.paths.TransitClass`
# * :func:`aequilibrae.paths.TransitAssignment`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`

# %%

# Imports for example construction
Expand Down Expand Up @@ -170,19 +186,3 @@
# %%
# Wrapping up
project.close()

# %%
# .. admonition:: References
#
# * :ref:`transit_assignment_graph`
# * :ref:`transit_hyperpath_routing`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.transit.Transit`
# * :func:`aequilibrae.transit.TransitGraphBuilder`
# * :func:`aequilibrae.paths.TransitClass`
# * :func:`aequilibrae.paths.TransitAssignment`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
In this example, we show how to perform route choice set generation using BFSLE and Link penalisation, for a city in La
Serena Metropolitan Area in Chile.
"""
# %%
# .. admonition:: References
#
# :ref:`route_choice`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.Graph`
# * :func:`aequilibrae.paths.RouteChoice`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`

# %%

Expand Down Expand Up @@ -224,16 +236,3 @@ def plot_results(link_loads):

# %%
project.close()

# %%
# .. admonition:: References
#
# :ref:`route_choice`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.Graph`
# * :func:`aequilibrae.paths.RouteChoice`
# * :func:`aequilibrae.matrix.AequilibraeMatrix`
21 changes: 10 additions & 11 deletions docs/source/examples/assignment_workflows/plot_route_choice_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
In this example, we show how to generate route choice sets for estimation of route choice models, using a
a city in La Serena Metropolitan Area in Chile.
"""
# %%
# .. admonition:: References
#
# :ref:`route_choice`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.RouteChoice`

# %%

Expand Down Expand Up @@ -147,14 +157,3 @@

# %%
project.close()

# %%
# .. admonition:: References
#
# :ref:`route_choice`

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.paths.RouteChoice`
5 changes: 5 additions & 0 deletions docs/source/examples/visualization/plot_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
links = project.network.links.data
nodes = project.network.nodes.data

# %%
# And if you want to take a quick look in your GeoDataFrames, you can plot it!

# links.plot()

# %%
# We create our Folium layers
network_links = folium.FeatureGroup("links")
Expand Down
1 change: 0 additions & 1 deletion docs/source/modeling_with_aequilibrae/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ a start guide to a complete view into AequilibraE's data structure.

.. toctree::
:maxdepth: 1
:caption: A guide to AequilibraE

project
project_database/index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,5 @@ required.

.. seealso::

:func:`aequilibrae.project.network.Modes`
* :func:`aequilibrae.project.network.Modes`
* :ref:`modes_network_data_model`
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ other changes to the layers or preventing the changes.
implementation requires a complete overahaul of the path-building code, so
that is still a long-term goal, barred specific development efforts.

.. seealso::

* :ref:`links_network_data_model`
* :ref:`nodes_network_data_model`

.. toctree::
:maxdepth: 1
:caption: Dive deep into network!

network_import_and_export.rst
network_geometry.rst
network_import_and_export.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ cover the main points regarding them.
This method allows you to access the API resources to manipulate the 'links' table.
Each item in the 'links' table is a ``Link`` object.

.. testsetup:: *

>>> folder = getfixture("create_path")

.. code-block:: python
>>> from aequilibrae import Project
>>> from shapely.geometry import LineString
>>> from aequilibrae.utils.create_example import create_example
>>> project = create_example(folder, "coquimbo")
>>> project = Project()
>>> project.open("/tmp/accessing_coquimbo_data")
>>> project_links = project.network.links
Expand Down Expand Up @@ -208,9 +205,9 @@ Each item in the 'zones' table is a ``Zone`` object.
>>> zones = project_zones.data
# To get a Shapely Polygon or Multipolygon with the entire zoning coverage
>>> project_zones.coverage() # doctest: +SKIP
>>> boundaries = project_zones.coverage()
# And to get the nearest zone to giver geometry
# And to get the nearest zone to a given geometry
>>> project_zones.get_closest_zone(Point(-71.3336, -29.9490))
57
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ There are three ways of creating an ``AequilibraeMatrix``:
>>> import numpy as np
>>> from os.path import join
>>> from aequilibrae.matrix import AequilibraeMatrix
>>> folder = getfixture("tmp_path")
>>> file = join(folder, "path_to_my_matrix.aem")
>>> file = "/tmp/matrix_example/path_to_my_matrix.aem"
>>> num_zones = 5
>>> index = np.arange(1, 6, dtype=np.int32)
>>> mtx = np.ones((5, 5), dtype=np.float32)
Expand Down Expand Up @@ -83,16 +81,16 @@ for CSV file, in which all cores will be exported as separate columns in the out

.. code-block:: python
>>> mat.export(join(folder, 'my_new_omx_file.omx'))
>>> mat.export('/tmp/matrix_example/my_new_omx_file.omx')
>>> mat.export(join(folder, 'my_new_csv_file.csv'))
>>> mat.export('/tmp/matrix_example/my_new_csv_file.csv')
The ``export`` method also allows you to change your mind and save your AequilibraE matrix into an AEM
file, if it's only in memory.

.. code-block:: python
>>> mat.export(join(folder, 'my_new_aem_file.aem'))
>>> mat.export('/tmp/matrix_example/my_new_aem_file.aem')
.. is there a better name rather than error?
Expand All @@ -109,7 +107,7 @@ AequilibraE matrices in disk can be reused and loaded once again.
.. code-block:: python
>>> mat = AequilibraeMatrix()
>>> mat.load(join(folder, 'my_new_aem_file.aem'))
>>> mat.load('/tmp/matrix_example/my_new_aem_file.aem')
>>> mat.get_matrix("only_ones") # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
memmap([[1., 1., 1., 1., 1.],
Expand Down Expand Up @@ -152,8 +150,8 @@ Creating an AequilibraE matrix from an OMX file is pretty straightforward.

.. code-block:: python
>>> file_path = join(folder, "path_to_new_matrix.aem")
>>> omx_path = join(folder, 'my_new_omx_file.omx')
>>> file_path = "/tmp/matrix_example/path_to_new_matrix.aem"
>>> omx_path = '/tmp/matrix_example/my_new_omx_file.omx'
>>> omx_mat = AequilibraeMatrix()
>>> omx_mat.create_from_omx(file_path, omx_path)
Expand Down
Loading

0 comments on commit 0715ee5

Please sign in to comment.