Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autodoc Python API reference #1176

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
# -*- coding: utf-8 -*-
import sys, os

# Path to Python Binding (_arbor)
try:
sys.path.append(os.path.join(os.environ['OLDPWD'],"python"))
import arbor
except ImportError:
autodoc_mock_imports = ['arbor._arbor']

html_static_path = ['static']

def setup(app):
Expand Down Expand Up @@ -50,6 +43,7 @@ def setup(app):
script_path=this_path+'/scripts'
sys.path.append(script_path)
import make_images
import autodoc_cache #autodoc_cache rebuilds python reference if Arbor is importable

# Output path for generated images
img_path=this_path+'/gen-images'
Expand Down
32 changes: 16 additions & 16 deletions doc/gs_single_cell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Links are provided to separate documentation that covers relevant topics in more

In an interactive Python interpreter, you can use ``help()`` on any class or function to
obtain some documentation. E.g.: ``help(arbor.gap_junction_connection)`` will print
:class:`this<arbor._arbor.gap_junction_connection>`.
:class:`this<arbor.gap_junction_connection>`.

.. _single_soma:

Expand Down Expand Up @@ -68,8 +68,8 @@ using :class:`arbor.mnpos`. Then two :class:`arbor.mpoint` s are supplied, the p
and distal endpoints of the segment. Finally, an integer value can be supplied to tag the
segment for future reference.

In step **(2)** a dictionary of labels is created using :class:`arbor.label_dict<arbor.
_arbor.label_dict>`. Cell builders need to refer to *regions* and *locations* on a cell
In step **(2)** a dictionary of labels is created using :class:`arbor.label_dict`.
Cell builders need to refer to *regions* and *locations* on a cell
morphology. Arbor uses a domains specific language (DSL) to describe regions and
locations, which are given labels. We add two labels:

Expand All @@ -88,10 +88,10 @@ with the named regions and locations.
channels all over the surface of the cell. :meth:`arbor.cable_cell.paint` lets us
instruct Arbor to use HH dynamics on the region we've labelled soma and sort the details
out for us.
* Other properties we do want to :meth:`arbor.cable_cell.place<arbor._arbor.cable_cell.place>`
in a precise :class:`arbor.location<arbor._arbor.location>`. We place two things:
an :class:`arbor.iclamp<arbor._arbor.iclamp>` with a duration of 2 ms and a current of
0.8 nA, starting at 10 ms. Then, add an :class:`arbor.spike_detector<arbor._arbor.spike_detector>`
* Other properties we do want to :meth:`arbor.cable_cell.place`
in a precise :class:`arbor.location`. We place two things:
an :class:`arbor.iclamp` with a duration of 2 ms and a current of
0.8 nA, starting at 10 ms. Then, add an :class:`arbor.spike_detector`
with a threshold of -10 mV to the location we've labelled 'center'.
* Finally, we adjust the :ref:`discretisation <cable-discretisation>` of the simulation
by setting the compartment length to 2 μm. By default there is one compartment per branch.
Expand All @@ -102,8 +102,8 @@ Single cell network
Great, we have defined our cell! Now, let's move to the network. Arbor can simulate
networks with multiple individual cells, connected together in a network. Single cell
models do not require the full *recipe* interface used to describing such network models,
with many unique cells, network and gap junctions. Arbor provides a :class:`arbor.
single_cell_model<arbor._arbor.single_cell_model>` helper that wraps a cell description,
with many unique cells, network and gap junctions. Arbor provides a
:class:`arbor.single_cell_model` helper that wraps a cell description,
and provides an interface for recording potentials and running the simulation.

.. code-block:: python
Expand All @@ -117,10 +117,10 @@ and provides an interface for recording potentials and running the simulation.
# (6) Run simulation for 100 ms of simulated activity.
m.run(tfinal=100)

Step **(4)** instantiates the :class:`arbor.single_cell_model<arbor._arbor.single_cell_model>` with our single-compartment cell.
Step **(4)** instantiates the :class:`arbor.single_cell_model` with our single-compartment cell.

In step **(5)** a :meth:`arbor.single_cell_model.probe()<arbor._arbor.single_cell_model.
probe>` is used to record variables from the model. Three pieces of information are
In step **(5)** a :meth:`arbor.single_cell_model.probe()` is used to record variables from
the model. Three pieces of information are
provided: the type of quantity we want probed (voltage), the location where we want to
probe ('center'), and the frequency at which we want to sample (10kHz).

Expand Down Expand Up @@ -148,13 +148,13 @@ spike_detector and a voltage probe. Let's see what they have produced!
df = pandas.DataFrame({'t/ms': m.traces[0].time, 'U/mV': m.traces[0].value})
seaborn.relplot(data=df, kind="line", x="t/ms", y="U/mV").savefig('single_cell_model_result.svg')

In step **(7)** we access :meth:`arbor.single_cell_model.spikes<arbor._arbor.
single_cell_model.spikes>` to access the spike time. A single spike at a little over 10
In step **(7)** we access :meth:`arbor.single_cell_model.spikes`
to access the spike time. A single spike at a little over 10
ms should be printed, which matches the stimulus we have provided in step (3).

The other measurement we have is that of the potential, which we plot in step **(8)**.
Arbor stores sampled quantities under :meth:`arbor.single_cell_model.traces<arbor._arbor.
single_cell_model.traces>`. You should be seeing something like this:
Arbor stores sampled quantities under :meth:`arbor.single_cell_model.traces`.
You should be seeing something like this:

.. figure:: gen-images/single_cell_model_result.svg
:width: 400
Expand Down
2 changes: 1 addition & 1 deletion doc/in_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ to see information about the version and enabled features:
>>> print(arbor.__version__)
>>> print(arbor.__config__)

You are now ready to use Arbor! You can continue reading these documentation pages, have a look at the :mod:`Python API Reference<arbor._arbor>`, or visit the :ref:`Quick Start page<gs_single_cell>`.
You are now ready to use Arbor! You can continue reading these documentation pages, have a look at the :mod:`Python API Reference<arbor>`, or visit the :ref:`Quick Start page<gs_single_cell>`.

.. Note::
To get help in case of problems installing with pip, run pip with the ``--verbose`` flag, and attach the output (along with the pip command itself) to a ticket on `Arbor's issues page <https://github.com/arbor-sim/arbor/issues>`_.
Expand Down
Loading