Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
fix documentation (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeplf authored Apr 16, 2018
1 parent c80c2d4 commit d1924ec
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def __getattr__(cls, name):
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_autorun',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleon',
'sphinxcontrib.autorun',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
35 changes: 24 additions & 11 deletions neurom/check/neuron_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def has_no_flat_neurites(neuron, tol=0.1, method='ratio'):
Arguments:
neuron(Neuron): The neuron object to test
tol(float): tolerance
method(string): way of determining flatness, 'tolerance', 'ratio'
method(string): way of determining flatness, 'tolerance', 'ratio' \
as described in :meth:`neurom.check.morphtree.get_flat_neurites`
Returns:
Expand Down Expand Up @@ -226,7 +226,7 @@ def has_no_jumps(neuron, max_distance=30.0, axis='z'):
def has_no_fat_ends(neuron, multiple_of_mean=2.0, final_point_count=5):
'''Check if leaf points are too large
Arguments
Arguments:
neuron(Neuron): The neuron object to test
multiple_of_mean(float): how many times larger the final radius
has to be compared to the mean of the final points
Expand All @@ -253,18 +253,23 @@ def has_no_fat_ends(neuron, multiple_of_mean=2.0, final_point_count=5):
def has_no_narrow_start(neuron, frac=0.9):
'''Check if neurites have a narrow start
Arguments:
neuron(Neuron): The neuron object to test
frac(float): Ratio that the second point must be smaller than the first
Returns:
CheckResult with a list of all first segments of neurites with a narrow start
'''
bad_ids = [(neurite.root_node.id, [neurite.root_node.points[1]]) for neurite in neuron.neurites
bad_ids = [(neurite.root_node.id, [neurite.root_node.points[1]])
for neurite in neuron.neurites
if neurite.root_node.points[1][COLS.R] < frac * neurite.root_node.points[2][COLS.R]]
return CheckResult(len(bad_ids) == 0, bad_ids)


def has_no_dangling_branch(n):
def has_no_dangling_branch(neuron):
'''Check if the neuron has dangling neurites'''
soma_center = n.soma.points[:, COLS.XYZ].mean(axis=0)
recentered_soma = n.soma.points[:, COLS.XYZ] - soma_center
soma_center = neuron.soma.points[:, COLS.XYZ].mean(axis=0)
recentered_soma = neuron.soma.points[:, COLS.XYZ] - soma_center
radius = np.linalg.norm(recentered_soma, axis=1)
soma_max_radius = radius.max()

Expand All @@ -278,14 +283,15 @@ def is_dangling(neurite):
if neurite.type != NeuriteType.axon:
return True

all_points = list(chain.from_iterable(_neurite.points[1:] for _neurite in iter_neurites(n)
if _neurite.type != NeuriteType.axon))
all_points = list(chain.from_iterable(n.points[1:]
for n in iter_neurites(neurite)
if n.type != NeuriteType.axon))
res = [np.linalg.norm(starting_point - p[COLS.XYZ]) >= 2 * p[COLS.R] + 2
for p in all_points]
return all(res)

bad_ids = [(neurite.root_node.id, [neurite.root_node.points[1]])
for neurite in iter_neurites(n) if is_dangling(neurite)]
bad_ids = [(n.root_node.id, [n.root_node.points[1]])
for n in iter_neurites(neuron) if is_dangling(n)]
return CheckResult(len(bad_ids) == 0, bad_ids)


Expand All @@ -294,7 +300,14 @@ def has_no_narrow_neurite_section(neuron,
radius_threshold=0.05,
considered_section_min_length=50):
'''Check if the neuron has dendrites with narrow sections
sections below 'considered_section_min_length' are not taken into account
Arguments:
neuron(Neuron): The neuron object to test
neurite_filter(callable): filter the neurites by this callable
radius_threshold(float): radii below this are considered narro
considered_section_min_length(float): sections with length below
this are not taken into account
Returns:
CheckResult with result. result.info contains the narrow section ids and their
first point
Expand Down
4 changes: 3 additions & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ nosexcover>=1.0.8
sphinx>=1.3.0
sphinxcontrib-napoleon>=0.3.0
sphinx_rtd_theme>=0.1.0
sphinxcontrib-autorun
sphinx-autorun
pyyaml>=3.10
future>=0.16.0
7 changes: 1 addition & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
""" Distribution configuration for neurom
"""
# pylint: disable=R0801
import os
from setuptools import setup
from setuptools import find_packages

Expand All @@ -45,13 +44,9 @@
'pyyaml>=3.10',
'scipy>=0.13.3',
'tqdm>=4.8.4',
'future>=0.16.0',
]

# Hack to avoid installation of modules with C extensions
# in readthedocs documentation building environment.
if os.environ.get('READTHEDOCS') == 'True':
REQS = []

config = {
'description': 'NeuroM: a light-weight neuron morphology analysis package',
'author': 'BBP Algorithm Development Team',
Expand Down

0 comments on commit d1924ec

Please sign in to comment.