Skip to content

Commit

Permalink
docs update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziaeemehr committed Dec 5, 2023
1 parent 4723a10 commit 8bd5ae2
Show file tree
Hide file tree
Showing 17 changed files with 1,524 additions and 1,133 deletions.
Binary file added docs/_images/example1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
128 changes: 128 additions & 0 deletions docs/_modules/examples/00_intro.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<!DOCTYPE html>

<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>examples.00_intro &#8212; vbjax v0.0.10 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="../../_static/nature.css?v=601dbdee" />
<link rel="stylesheet" type="text/css" href="../../_static/graphviz.css?v=eafc0fe6" />
<script src="../../_static/documentation_options.js?v=03166b9c"></script>
<script src="../../_static/doctools.js?v=888ff710"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">vbjax v0.0.10 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">examples.00_intro</a></li>
</ul>
</div>

<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">

<h1>Source code for examples.00_intro</h1><div class="highlight"><pre>
<span></span><span class="sd">&quot;&quot;&quot; </span>
<span class="sd">**Example 1**: A simple network of coupled Montbrio model nodes.</span>

<span class="sd">Starting with a few imports</span>

<span class="sd">.. literalinclude:: ../../vbjax/examples/00_intro.py</span>
<span class="sd"> :start-after: example-st\u0061rt</span>
<span class="sd"> :lines: 1-2</span>
<span class="sd"> :caption:</span>

<span class="sd">This example shows how to use the `vbjax` library to simulate a network of</span>
<span class="sd">Montbrio model nodes. The network is defined by the function `network` which</span>
<span class="sd">takes as arguments the state of the network and the parameters of the model.</span>
<span class="sd">The function returns the time derivative of the state of the network. The</span>
<span class="sd">function `make_sde` is used to create a function `loop` that simulates the</span>
<span class="sd">network for a given time interval and a given set of initial conditions.</span>

<span class="sd">The function `vb.randn` is used to generate a set of noise samples. </span>
<span class="sd">The dimesions are `(time, state, node)`. The first noise sample is used as the</span>
<span class="sd">initial condition of the network. The remaining noise samples are used to</span>
<span class="sd">generate the noise term of the stochastic differential equation.</span>

<span class="sd">The function `loop` takes as arguments the initial conditions of the network,</span>
<span class="sd">vector of noise samples, and the parameters of the model. The function returns</span>
<span class="sd">the state of the network at each time step.</span>

<span class="sd">The function `vb.plot_states` is used to plot the state of the network. The</span>
<span class="sd">function takes as arguments the state of the network, the format of the plot,</span>
<span class="sd">and the name of the output file.</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="c1"># example-start</span>
<span class="kn">import</span> <span class="nn">vbjax</span> <span class="k">as</span> <span class="nn">vb</span>
<span class="kn">import</span> <span class="nn">jax.numpy</span> <span class="k">as</span> <span class="nn">np</span>

<div class="viewcode-block" id="network">
<a class="viewcode-back" href="../../tutorial.html#examples.00_intro.network">[docs]</a>
<span class="k">def</span> <span class="nf">network</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">p</span><span class="p">):</span>
<span class="n">c</span> <span class="o">=</span> <span class="mf">0.03</span><span class="o">*</span><span class="n">x</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="k">return</span> <span class="n">vb</span><span class="o">.</span><span class="n">mpr_dfun</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span></div>


<span class="n">_</span><span class="p">,</span> <span class="n">loop</span> <span class="o">=</span> <span class="n">vb</span><span class="o">.</span><span class="n">make_sde</span><span class="p">(</span><span class="n">dt</span><span class="o">=</span><span class="mf">0.01</span><span class="p">,</span> <span class="n">dfun</span><span class="o">=</span><span class="n">network</span><span class="p">,</span> <span class="n">gfun</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span>
<span class="n">zs</span> <span class="o">=</span> <span class="n">vb</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">32</span><span class="p">)</span>
<span class="n">xs</span> <span class="o">=</span> <span class="n">loop</span><span class="p">(</span><span class="n">zs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">zs</span><span class="p">[</span><span class="mi">1</span><span class="p">:],</span> <span class="n">vb</span><span class="o">.</span><span class="n">mpr_default_theta</span><span class="p">)</span>
<span class="n">vb</span><span class="o">.</span><span class="n">plot_states</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="s1">&#39;rV&#39;</span><span class="p">,</span> <span class="n">jpg</span><span class="o">=</span><span class="s1">&#39;example1&#39;</span><span class="p">,</span> <span class="n">show</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>


<span class="c1"># example-end</span>
</pre></div>

<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">vbjax v0.0.10 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../index.html" >Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">examples.00_intro</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2023, Marmaduke Woodman.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
</div>
</body>
</html>
75 changes: 7 additions & 68 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,73 +89,12 @@ Indices and tables
* :ref:`modindex`
* :ref:`search`

neural_mass
-----------

.. automodule:: vbjax.neural_mass
:members:
:undoc-members:
:show-inheritance:

monitor
--------

.. automodule:: vbjax.monitor
:members:
:undoc-members:
:show-inheritance:

loops
-----

.. automodule:: vbjax.loops
:members:
:undoc-members:
:show-inheritance:

connectome
----------

.. automodule:: vbjax.connectome
:members:
:undoc-members:
:show-inheritance:

layers
------

.. automodule:: vbjax.layers
:members:
:undoc-members:
:show-inheritance:




sparse
------

.. automodule:: vbjax.sparse
:members:
:undoc-members:
:show-inheritance:

util
----

.. automodule:: vbjax.util
:members:
:undoc-members:
:show-inheritance:

shtlc
-----

.. automodule:: vbjax.shtlc
:members:
:undoc-members:
:show-inheritance:


Modules
########

.. toctree::
:maxdepth: 2
:caption: Contents:

modules

66 changes: 66 additions & 0 deletions docs/_sources/modules.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
neural_mass
-----------

.. automodule:: vbjax.neural_mass
:members:
:undoc-members:
:show-inheritance:

monitor
--------

.. automodule:: vbjax.monitor
:members:
:undoc-members:
:show-inheritance:

loops
-----

.. automodule:: vbjax.loops
:members:
:undoc-members:
:show-inheritance:

connectome
----------

.. automodule:: vbjax.connectome
:members:
:undoc-members:
:show-inheritance:

layers
------

.. automodule:: vbjax.layers
:members:
:undoc-members:
:show-inheritance:




sparse
------

.. automodule:: vbjax.sparse
:members:
:undoc-members:
:show-inheritance:

util
----

.. automodule:: vbjax.util
:members:
:undoc-members:
:show-inheritance:

shtlc
-----

.. automodule:: vbjax.shtlc
:members:
:undoc-members:
:show-inheritance:
4 changes: 3 additions & 1 deletion docs/_sources/tutorial.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
Tutorial
***************

This is some test text.
.. automodule:: examples.00_intro



Binary file added docs/example1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8bd5ae2

Please sign in to comment.