Skip to content

Commit

Permalink
Merge pull request projectmesa#684 from projectmesa/docs
Browse files Browse the repository at this point in the history
Bulk merge of docs from 'docs' to 'master'
  • Loading branch information
jackiekazil authored May 29, 2019
2 parents c9b0b20 + 0d4d5e5 commit 223131c
Show file tree
Hide file tree
Showing 15 changed files with 498 additions and 285 deletions.
14 changes: 7 additions & 7 deletions docs/best-practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ like the built-in ``random`` library.
def cool_method(self):
interesting_number = self.random.random()
print(interesting_number)
class AwesomeAgent(Agent):
# ...
def __init__(self, unique_id, model, ...):
Expand All @@ -57,31 +57,31 @@ like the built-in ``random`` library.
def my_method(self):
random_number = self.random.randint(0, 100)
(The agent's random property is just a reference to its parent model's
``random`` property).
(The agent's random property is just a reference to its parent model's
``random`` property).

When a model object is created, its random property is automatically seeded
with the current time. The seed determines the sequence of random numbers; if
with the current time. The seed determines the sequence of random numbers; if
you instantiate a model with the same seed, you will get the same results.
To allow you to set the seed, make sure your model as a ``seed`` argument in its
constructor.

.. code:: python
class AwesomeModel(Model):
def __init__(self, seed=None):
pass
def cool_method(self):
interesting_number = self.random.random()
print(interesting_number)
>>> model0 = AwesomeModel(seed=0)
>>> model0._seed
0
>>> model0.cool_method()
0.8444218515250481
>>> model1 = AwesomeModel(seed=0)
>>> model1.cool_method()
0.8444218515250481
0.8444218515250481
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ To launch an example model, clone the `repository <https://github.com/projectmes

.. code-block:: bash
schelling $ mesa runserver examples/wolf_sheep
$ mesa runserver examples/wolf_sheep
For more help on using Mesa, check out the following resources:

Expand Down Expand Up @@ -87,12 +87,13 @@ ABM features users have shared that you may want to use in your model

.. toctree::
:hidden:
:maxdepth: 6
:maxdepth: 7

Mesa Overview <overview>
tutorials/intro_tutorial
tutorials/adv_tutorial
Best Practices <best-practices>
Useful Snippets <useful-snippets/snippets>
API Documentation <apis/api_main>
Mesa Packages <packages>

Expand All @@ -102,4 +103,3 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

77 changes: 77 additions & 0 deletions docs/mesa.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
mesa package
============

Subpackages
-----------

.. toctree::

mesa.visualization

Submodules
----------

mesa.agent module
-----------------

.. automodule:: mesa.agent
:members:
:undoc-members:
:show-inheritance:

mesa.batchrunner module
-----------------------

.. automodule:: mesa.batchrunner
:members:
:undoc-members:
:show-inheritance:

mesa.datacollection module
--------------------------

.. automodule:: mesa.datacollection
:members:
:undoc-members:
:show-inheritance:

mesa.main module
----------------

.. automodule:: mesa.main
:members:
:undoc-members:
:show-inheritance:

mesa.model module
-----------------

.. automodule:: mesa.model
:members:
:undoc-members:
:show-inheritance:

mesa.space module
-----------------

.. automodule:: mesa.space
:members:
:undoc-members:
:show-inheritance:

mesa.time module
----------------

.. automodule:: mesa.time
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: mesa
:members:
:undoc-members:
:show-inheritance:
70 changes: 70 additions & 0 deletions docs/mesa.visualization.modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
mesa.visualization.modules package
==================================

Submodules
----------

mesa.visualization.modules.BarChartVisualization module
-------------------------------------------------------

.. automodule:: mesa.visualization.modules.BarChartVisualization
:members:
:undoc-members:
:show-inheritance:

mesa.visualization.modules.CanvasGridVisualization module
---------------------------------------------------------

.. automodule:: mesa.visualization.modules.CanvasGridVisualization
:members:
:undoc-members:
:show-inheritance:

mesa.visualization.modules.ChartVisualization module
----------------------------------------------------

.. automodule:: mesa.visualization.modules.ChartVisualization
:members:
:undoc-members:
:show-inheritance:

mesa.visualization.modules.HexGridVisualization module
------------------------------------------------------

.. automodule:: mesa.visualization.modules.HexGridVisualization
:members:
:undoc-members:
:show-inheritance:

mesa.visualization.modules.NetworkVisualization module
------------------------------------------------------

.. automodule:: mesa.visualization.modules.NetworkVisualization
:members:
:undoc-members:
:show-inheritance:

mesa.visualization.modules.PieChartVisualization module
-------------------------------------------------------

.. automodule:: mesa.visualization.modules.PieChartVisualization
:members:
:undoc-members:
:show-inheritance:

mesa.visualization.modules.TextVisualization module
---------------------------------------------------

.. automodule:: mesa.visualization.modules.TextVisualization
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: mesa.visualization.modules
:members:
:undoc-members:
:show-inheritance:
45 changes: 45 additions & 0 deletions docs/mesa.visualization.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
mesa.visualization package
==========================

Subpackages
-----------

.. toctree::

mesa.visualization.modules

Submodules
----------

mesa.visualization.ModularVisualization module
----------------------------------------------

.. automodule:: mesa.visualization.ModularVisualization
:members:
:undoc-members:
:show-inheritance:

mesa.visualization.TextVisualization module
-------------------------------------------

.. automodule:: mesa.visualization.TextVisualization
:members:
:undoc-members:
:show-inheritance:

mesa.visualization.UserParam module
-----------------------------------

.. automodule:: mesa.visualization.UserParam
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: mesa.visualization
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 223131c

Please sign in to comment.