Skip to content

Commit

Permalink
Merge pull request #17 from kapilkd13/nmlimport
Browse files Browse the repository at this point in the history
importing morphologies from nml file
  • Loading branch information
mstimberg committed Jul 13, 2018
2 parents feb2ac9 + 5fa0eb2 commit 339376e
Show file tree
Hide file tree
Showing 12 changed files with 985 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -72,7 +72,7 @@ script:
sphinx-build docs_sphinx docs;
else
export SRCDIR=$(pwd);
conda build --quiet -c brian-team dev/conda-recipe;
conda build --quiet -c conda-forge dev/conda-recipe;
fi

after_success:
Expand Down
Empty file.
31 changes: 31 additions & 0 deletions brian2tools/nmlimport/helper.py
@@ -0,0 +1,31 @@
from pprint import pformat
from collections import defaultdict


# Returns parent segment
def get_parent_segment(segment, segments):
for s in segments:
if s.id == segment.parent.segments:
return s


# Pretty format data
def formatter(datum):
a = pformat(datum)
if len(a) > 160:
a = a[0:160] + "[...]"
return a

# Returns a dictionary of child segments of each segment, segment id is a key.
def get_child_segments(segments):
children = defaultdict(list)
root = None
for segment in segments:
if segment.parent is None:
root = segment.id
else:
children[segment.parent.segments].append(segment.id)

assert root is not None
return children

0 comments on commit 339376e

Please sign in to comment.