Skip to content

Commit

Permalink
adds modules references in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
r-akemii committed Sep 3, 2024
1 parent 3236cf7 commit 12b286c
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 11 deletions.
9 changes: 6 additions & 3 deletions aequilibrae/transit/lib_gtfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ def __init__(
:Arguments:
**local network** (:obj:`Network`): Supply model to which this GTFS will be imported
**agency_identifier** (:obj:`str`): ID for the agency this feed refers to (e.g. 'CTA')
**file_path** (:obj:`str`): Full path to the GTFS feed (e.g. 'D:/project/my_gtfs_feed.zip')
**day** (:obj:`str`, *Optional*): Service data contained in this field to be imported (e.g. '2019-10-04')
**description** (:obj:`str`, *Optional*): Description for this feed (e.g. 'CTA19 fixed by John after coffee')
"""
self.__network = network
Expand Down Expand Up @@ -79,8 +83,7 @@ def set_capacities(self, capacities: dict):
:Arguments:
**capacities** (:obj:`dict`): Dictionary with GTFS types as keys, each with a list
of 3 items for values for capacities: seated and total
i.e. -> "{0: [150, 300],...}"
of 3 items for values for capacities: seated and total i.e. -> "{0: [150, 300],...}"
"""
self.gtfs_data._set_capacities(capacities)

Expand All @@ -89,7 +92,7 @@ def set_pces(self, pces: dict):
:Arguments:
**pces** (:obj:`dict`): Dictionary with GTFS types as keys and the corresponding PCE
value i.e. -> "{0: 2.0,...}"
value i.e. -> "{0: 2.0,...}"
"""
self.gtfs_data._set_pces(pces)

Expand Down
16 changes: 14 additions & 2 deletions docs/source/api/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ Matrix
.. autosummary::
:toctree: generated/

AequilibraeData
AequilibraeMatrix
AequilibraeData
Sparse
COO
GeneralisedCOODemand

Paths
-----
Expand Down Expand Up @@ -131,4 +134,13 @@ Transit

Transit
TransitGraphBuilder
.. GTFSRouteSystemBuilder
lib_gtfs.GTFSRouteSystemBuilder

Utils
-----
.. currentmodule:: aequilibrae.utils
.. autosummary::
:toctree: generated/

create_delaunay_network.DelaunayAnalysis
create_example
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@
'autosummary': True
}

autodoc_member_order = "groupwise"

autoclass_content = "class" # classes should include both the class' and the __init__ method's docstring

autosummary_generate = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
In this example, we show how to perform Traffic Assignment in AequilibraE without a model.
We are using `Sioux Falls data <https://github.com/bstabler/TransportationNetworks/tree/master/SiouxFalls>`_, from TNTP.
"""
# %%

Expand Down Expand Up @@ -87,7 +86,7 @@
geom["node_id"] = geom.index + 1
geom = geom.astype({"node_id": "int64", "lon": "float64", "lat": "float64"}).set_index("node_id")

#%%
# %%
# Let's build our Graph! In case you're in doubt about AequilibraE Graph,
# :ref:`click here <aequilibrae-graphs>` to read more about it.

Expand All @@ -106,6 +105,11 @@
g.network["id"] = g.network.link_id
g.lonlat_index = geom.loc[g.all_nodes]

# %%
# .. admonition:: References
#
# :ref:`aequilibrae-graphs`

# %%
# Let's perform our assignment. Feel free to try different algorithms,
# as well as change the maximum number of iterations and the gap.
Expand Down Expand Up @@ -136,4 +140,14 @@
print(assig.report())

# %%
#
# .. admonition:: References
#
# :ref:`traffic_assignment_procedure` | :ref:`multiclass_equilibrium`

# %%
# .. 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.matrix.AequilibraeMatrix`
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,11 @@

# %%
project.close()

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.project.network.Link` | :func:`aequilibrae.project.network.Links`
# * :func:`aequilibrae.project.network.Node` | :func:`aequilibrae.project.network.Nodes`
# * :func:`aequilibrae.project.network.Mode` | :func:`aequilibrae.project.network.LinkType`
6 changes: 6 additions & 0 deletions docs/source/examples/creating_models/plot_import_gtfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,9 @@

# %%
project.close()

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.transit.Transit` | :func:`aequilibrae.transit.lib_gtfs.GTFSRouteSystemBuilder`
8 changes: 7 additions & 1 deletion docs/source/examples/visualization/plot_delaunay_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
In this example, we show how to create AequilibraE's famous Delaunay Lines, but in Python.
For more on this topic, the first publication is `here <https://xl-optim.com/delaunay/>`_.
For more on this topic, see its `first publication <https://xl-optim.com/delaunay/>`_.
We use the Sioux Falls example once again.
"""
Expand Down Expand Up @@ -70,3 +70,9 @@
# %%
# Close the project
project.close()

# %%
# .. seealso::
# The use of the following functions, methods, classes and modules is shown in this example:
#
# * :func:`aequilibrae.utils.create_delaunay_network.DelaunayAnalysis`
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ not blocking flows through "centroids".

:func:`aequilibrae.paths.TransitGraph`

.. _traffic_assignment_procedure:

Traffic Assignment Procedure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -364,8 +366,6 @@ Finally, one can execute assignment:
:ref:`convergence_criteria` is discussed in a different section.

References
~~~~~~~~~~
.. [1] Hampton Roads Transportation Planning Organization, Regional Travel Demand Model V2 (2020).
Available in: https://www.hrtpo.org/uploads/docs/2020_HamptonRoads_Modelv2_MethodologyReport.pdf
Expand Down

0 comments on commit 12b286c

Please sign in to comment.