Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wmayner committed Jan 21, 2015
2 parents 97727ae + 6df614c commit e2fdade
Show file tree
Hide file tree
Showing 46 changed files with 1,415 additions and 468 deletions.
8 changes: 6 additions & 2 deletions Gruntfile.coffee
Expand Up @@ -48,6 +48,10 @@ module.exports = (grunt) ->
"<%= cfg.docDir %>/**/*"
"!<%= cfg.docDir %>/_*/**/*"
"<%= cfg.docDir %>/_static/**/*"
"!**/pyphi.log"
"!**/__pyphi_cache__"
"!**/__pyphi_cache__.BACKUP"
"!**/*.pyc"
]
tasks: ["shell:buildDocs"]
test:
Expand All @@ -71,12 +75,12 @@ module.exports = (grunt) ->
"watch:test"
]
grunt.registerTask "docs", [
"shell:openDocs"
"shell:buildDocs"
"shell:openDocs"
]
grunt.registerTask "watch-docs", [
"shell:openDocs"
"shell:buildDocs"
"shell:openDocs"
"watch:docs"
]
grunt.registerTask "upload-github-docs", [
Expand Down
1 change: 0 additions & 1 deletion README.rst
Expand Up @@ -142,7 +142,6 @@ Correspondence regarding the Matlab code and the IIT 3.0 paper (below) should
be directed to Larissa Albantakis, PhD, at `albantakis@wisc.edu
<mailto:albantakis@wisc.edu>`_.


Please cite this paper if you use this code:
````````````````````````````````````````````

Expand Down
10 changes: 0 additions & 10 deletions docs/_static/custom.css
Expand Up @@ -18,16 +18,6 @@ div.highlight pre {
div.highlight pre {
font-size: 14px;
}
.rst-content tt.docutils.literal {
font-size: 90%;
padding: 2px 5px;
border: 1px solid #e1e4e5;
color: #099;
border-radius: 4px;
}
.rst-content dl:not(.docutils) tt.docutils.literal {
font-weight: normal;
}
.wy-table td p,
.rst-content table.docutils td p,
.rst-content table.field-list td p {
Expand Down
6 changes: 6 additions & 0 deletions docs/api/compute.rst
@@ -0,0 +1,6 @@
:mod:`compute`
==============

.. automodule:: pyphi.compute
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/concept_caching.rst
@@ -0,0 +1,6 @@
:mod:`concept_caching`
======================

.. automodule:: pyphi.concept_caching
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/convert.rst
@@ -0,0 +1,6 @@
:mod:`convert`
==============

.. automodule:: pyphi.convert
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/db.rst
@@ -0,0 +1,6 @@
:mod:`db`
=========

.. automodule:: pyphi.db
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/examples.rst
@@ -0,0 +1,6 @@
:mod:`examples`
===============

.. automodule:: pyphi.examples
:members:
:undoc-members:
20 changes: 20 additions & 0 deletions docs/api/index.rst
@@ -0,0 +1,20 @@
API Reference
=============

PyPhi API documentation, autogenerated from the source code.

.. toctree::
:maxdepth: 2

compute
network
subsystem
convert
examples
models
node
concept_caching
memory
db
utils
validate
6 changes: 6 additions & 0 deletions docs/api/memory.rst
@@ -0,0 +1,6 @@
:mod:`memory`
=============

.. automodule:: pyphi.memory
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/models.rst
@@ -0,0 +1,6 @@
:mod:`models`
=============

.. automodule:: pyphi.models
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/network.rst
@@ -0,0 +1,6 @@
:mod:`network`
==============

.. automodule:: pyphi.network
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/node.rst
@@ -0,0 +1,6 @@
:mod:`node`
===========

.. automodule:: pyphi.node
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/subsystem.rst
@@ -0,0 +1,6 @@
:mod:`subsystem`
================

.. automodule:: pyphi.subsystem
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/utils.rst
@@ -0,0 +1,6 @@
:mod:`utils`
============

.. automodule:: pyphi.utils
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/valiate.rst
@@ -0,0 +1,6 @@
:mod:`validate`
===============

.. automodule:: pyphi.validate
:members:
:undoc-members:
3 changes: 3 additions & 0 deletions docs/compute.rst
@@ -0,0 +1,3 @@
.. automodule:: pyphi.compute
:members:
:undoc-members:
12 changes: 7 additions & 5 deletions docs/conf.py
Expand Up @@ -15,7 +15,6 @@

import sys
import os
import sphinx_rtd_theme


# If extensions (or modules to document with autodoc) are in another directory,
Expand Down Expand Up @@ -166,7 +165,13 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_rtd_theme'
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom themes here, relative to this
# directory.
html_theme_path = ['_themes'] + [sphinx_rtd_theme.get_html_theme_path()]

# (Optional) Logo. Should be small enough to fit the navbar (ideally 24x24).
# Path should be relative to the ``_static`` files directory.
Expand All @@ -179,9 +184,6 @@

html_sidebars = {'**': ['localtoc.html']}

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['_themes'] + [sphinx_rtd_theme.get_html_theme_path()]

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = version + " documentation"
Expand Down
6 changes: 6 additions & 0 deletions docs/configuration.rst
@@ -0,0 +1,6 @@
Configuration
=============

.. automodule:: pyphi.constants
:members:
:undoc-members:
74 changes: 74 additions & 0 deletions docs/examples/basic.rst
@@ -0,0 +1,74 @@
Basic Usage
===========

* :func:`pyphi.examples.basic_network`
* :func:`pyphi.examples.basic_subsystem`

Let's make a simple 3-node network and compute its |big_phi|.

To make a network, we need a TPM, current state, past state, and optionally a
connectivity matrix. The TPM can be in more than one form; see the
documentation for :class:`pyphi.network`. Here we'll use the 2-dimensional
state-by-node form.

>>> import pyphi
>>> import numpy as np
>>> tpm = np.array([[0, 0, 0], [0, 0, 1], [1, 0, 1], [1, 0, 0], [1, 1, 0],
... [1, 1, 1], [1, 1, 1], [1, 1, 0]])

The current and past states should be |n|-tuples, where |n| is the number of
nodes in the network, where the |ith| element is the state of the |ith| node in
the network.

>>> current_state = (1, 0, 0)
>>> past_state = (1, 1, 0)

The connectivity matrix is a square matrix such that the |i,jth| entry is 1 if
there is a connection from node |i| to node |j|, and 0 otherwise.

>>> cm = np.array([[0, 0, 1], [1, 0, 1], [1, 1, 0]])

Now we construct the network itself with the arguments we just created:

>>> network = pyphi.Network(tpm, current_state, past_state,
... connectivity_matrix=cm)

The next step is to define a subsystem for which we want to evaluate |big_phi|.
To make a subsystem, we need the indices of subset of nodes which should be
included in it and the network that the subsystem belongs to.

In this case, we want the |big_phi| of the entire network, so we simply include
every node in the network in our subsystem:

>>> subsystem = pyphi.Subsystem(range(network.size), network)

Now we use :func:`pyphi.compute.big_phi` function to compute the |big_phi| of
our subsystem:

>>> phi = pyphi.compute.big_phi(subsystem)
>>> round(phi, pyphi.constants.PRECISION)
2.312498

If we want to take a deeper look at the integrated-information-theoretic
properties of our network, we can access all the intermediate quantities and
structures that are calculated in the course of arriving at a final |big_phi|
value by using :func:`pyphi.compute.big_mip`. This returns a deeply nested
object, |BigMip|, that contains data about the subsystem's constellation of
concepts, cause and effect repertoires, etc.

>>> mip = pyphi.compute.big_mip(subsystem)

For instance, we can see that this network has 4 concepts:

>>> len(mip.unpartitioned_constellation)
4

The documentation for :mod:`pyphi.models` contains description of these
structures.

.. note::

The network and subsystem discussed here are returned by the
:func:`pyphi.examples.basic_network` and
:func:`pyphi.examples.basic_subsystem` functions.

0 comments on commit e2fdade

Please sign in to comment.