Skip to content

Commit

Permalink
add Parameter documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jpn-- committed Jan 13, 2015
1 parent b84d66f commit 359bcf3
Show file tree
Hide file tree
Showing 14 changed files with 78,958 additions and 80,041 deletions.
13 changes: 11 additions & 2 deletions doc/_static/larch_rtfd.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,20 @@ div.body h4 { font-size: 100%; padding-left: 65px; }
div.body h5 { font-size: 90%; padding-left: 80px; }
div.body h6 { font-size: 80%; padding-left: 95px; }

.wy-side-nav-search
.wy-side-nav-search, .wy-nav-top
{
background-color: rgb(51,121,51) !important;
background-color: rgb(51,91,71) !important;
}

.treelogo {
max-width: 32px !important;
}

.wy-side-nav-search .fa-home
{
font-family: 'Roboto Slab';
font-weight: 700;
}

.wy-breadcrumbs li:first-child::before
{
Expand Down
2 changes: 2 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'sphinx.ext.viewcode',
'sphinx.ext.mathjax',
'sphinx.ext.intersphinx',
'sphinxcontrib.napoleon',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -143,6 +144,7 @@ def __getattr__(cls, name):

MOCK_MODULES = ['argparse', 'numpy', 'pandas', 'larch._core', 'larch.apsw']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
import larch



Expand Down
30 changes: 22 additions & 8 deletions doc/data.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. currentmodule:: larch

====
Data
====
=======================
Data Storage and Access
=======================

The default storage of data within Larch is handled using SQLite. This portable and
open source database system provides a common file format that is flexible and
Expand All @@ -23,7 +23,10 @@ Creating :class:`DB` Objects
The normal constructor creates a :class:`DB` object linked to an existing SQLite
database file. Editing the object edits the file as well. There is currently no
"undo" so be careful with this method.





In addition to opening an existing SQLite database directly, there are a number of
methods available to create a :class:`DB` object without having it linked to an
original database file.
Expand Down Expand Up @@ -120,22 +123,33 @@ or :mod:`sqlite3` (included in standard Python distributions).
Convenience Methods
-------------------

.. py:method:: DB.attach
.. py:method:: DB.attach(sqlname, filename)
Attach another SQLite database.

:param str sqlname: The name SQLite will use to reference the other database.
:param str filename: The filename or URI to attach.

If the other database is already attached, or if the name is already taken by another
attached database, the command will be ignored.
attached database, the command will be ignored. Otherwise, this command is the
equivalent of executing::

.. py:method:: DB.detach
ATTACH filename AS sqlname;

.. seealso:: :py:meth:`DB.detach`



.. method:: DB.detach(sqlname)

Detach a previously attached SQLite database.

:param str sqlname: The name SQLite will use to reference the other database.

If the name is not an attached database, the command will be ignored.
If the name is not an attached database, the command will be ignored. Otherwise,
this command is the equivalent of executing::

DETACH sqlname;

.. seealso:: :py:meth:`DB.attach`

6 changes: 4 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
|treelogo| Larch Documentation
==============================

.. centered:: Larch |release|

.. |treelogo| image:: ../img/larch_favicon.png
:height: 0.9em
:class: treelogo


This documentation is for the Python interface for Larch.

Expand All @@ -31,6 +31,8 @@ Contents
:maxdepth: 4

data
model
parameter
math


Expand Down
38 changes: 38 additions & 0 deletions doc/model.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.. currentmodule:: larch

=======================
Logit Models
=======================

The basic tool for analysis in Larch is a discrete choice model.

Creating :class:`Model` Objects
-------------------------------

.. py:class:: Model(db=None)
:param db: The source database used to automatically populate model arrays.
:type db: :class:`DB`

This object represents a discrete choice model. In addition to the methods
described below, a :class:`Model` also acts like a list of :class:`Parameter`.


.. py:method:: Model.Example(number=1)
Generate an example model object.

:param number: The code number of the example model to load. Valid numbers
include {1,101,102,104,109,114}.
:type number: int

Larch comes with a few example models, which are used in documentation
and testing. Models with numbers greater than 100 are designed to align with
the `example models given for Biogeme <http://biogeme.epfl.ch/swissmetro/examples.html>`_.

.. py:method:: Model.estimate()
Find the likelihood maximizing parameters of the model.



8 changes: 8 additions & 0 deletions doc/parameter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. currentmodule:: larch

=======================
Model Parameters
=======================

.. autoclass:: Parameter(name='',value=0,null_value=0)

7 changes: 4 additions & 3 deletions py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#
################################################################################

import sys
import os, os.path

if os.environ.get('READTHEDOCS', None) == 'True':
# hack for building docs on rtfd

Expand All @@ -30,7 +33,7 @@ class Mock(MagicMock):
def __getattr__(cls, name):
return Mock()

MOCK_MODULES = ['numpy', 'pandas', 'larch._core', 'larch.core', 'larch.apsw']
MOCK_MODULES = ['numpy', 'pandas', 'larch._core', 'larch.apsw']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)


Expand All @@ -41,8 +44,6 @@ def __getattr__(cls, name):

status = ""

import sys
import os, os.path

try:
status += "Python %s" % sys.version
Expand Down

0 comments on commit 359bcf3

Please sign in to comment.