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

Arbor cable cell exporter and backend #393

Merged
merged 53 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
3d9e7fa
Arbor cable cell label_dict and decor generation from create_hoc (tes…
lukasgd Mar 10, 2022
fc52a06
Arbor cable cell, label dict and decor generation fixed and done sepa…
lukasgd Mar 10, 2022
3e20642
Unit tests for create_acc (Arbor cable cell output)
lukasgd Mar 14, 2022
dbf766f
Fixed Arbor mechanism output, separated create_hoc from create_acc ex…
lukasgd Mar 31, 2022
fba5376
Separate module for create_acc
lukasgd Apr 7, 2022
8bd6539
Improved documentation for create_acc
lukasgd Apr 7, 2022
d2f2f42
Fixed membrane capacitance conversion to Arbor, formatting
lukasgd Apr 8, 2022
22ad6da
Fixed pycodestyle errors
lukasgd Apr 11, 2022
2228979
Fixed tox tests/docs, replace_axon handling fixed (unsupported in Arb…
lukasgd May 16, 2022
760f53c
Merge branch 'master' into arbor_integration
lukasgd May 16, 2022
315457c
Merge branch 'master' into arbor_integration
wvangeit Jun 1, 2022
dccc375
Merge branch 'master' into arbor_integration
wvangeit Jun 23, 2022
f72690d
Merge branch 'master' into arbor_integration
wvangeit Jun 24, 2022
e88168f
Support for replace_axon in Arbor, cable cell construction from JSON/…
lukasgd Jul 28, 2022
c0af192
Formatting fix, support for myelinated section in Arbor cable cell (c…
lukasgd Jul 28, 2022
27827fb
Merge branch 'master' into arbor_integration
wvangeit Jul 29, 2022
de52dea
Making Arbor an extra dependency
lukasgd Jul 29, 2022
08c9157
Merge branch 'arbor_integration' of github.com:lukasgd/BluePyOpt into…
lukasgd Jul 29, 2022
152033e
Moved Arbor all to default properties, explicit mechanism qualificati…
lukasgd Aug 2, 2022
f2ca1ed
Support for range parameters in Arbor via iexprs, Arbor mechanism cat…
lukasgd Aug 5, 2022
2c67258
Added existing section lists to instantiated cell to prevent crash on…
lukasgd Aug 5, 2022
ab004f6
Arbor package data fixes
lukasgd Aug 8, 2022
0a8a932
Merge branch 'master' into arbor_integration
lukasgd Aug 8, 2022
e685990
Validation of simulation output with Arbor vs. Neuron for L5PC mechs …
lukasgd Aug 11, 2022
26f3af1
Minor changes on ACC exporter
lukasgd Aug 24, 2022
a7453f8
Adding ACC morphology output with axon replacement
lukasgd Aug 25, 2022
79dda2e
Merge branch 'master' into arbor_integration
wvangeit Aug 29, 2022
fac077d
Support for point processes in Arbor cable cell exporter
lukasgd Sep 24, 2022
6aa15de
Arbor locations/labels, stimuli, protocols and optimization in simple…
lukasgd Oct 2, 2022
cde9b96
Using all segments of Neuron sections in axon replacement
lukasgd Oct 3, 2022
6d76ed1
L5PC optimization with Arbor
lukasgd Oct 4, 2022
3978d31
Axon replacement with Arbor morphologies, split_at/join_at and Neuron…
lukasgd Oct 12, 2022
5d4ad03
Removing old axon replacement impl and synapse implementation with sp…
lukasgd Oct 12, 2022
d98041d
Support for general Arbor labels, expsyn example fixed, Arbor iexpr g…
lukasgd Oct 17, 2022
c425101
External mechanism catalogues for Arbor simulator
lukasgd Oct 18, 2022
9443b12
avoid using string concatenation in joining paths
anilbey Oct 19, 2022
d958c14
Removing assertions, adding another Arbor iexpr generation test
lukasgd Oct 20, 2022
f2d93e3
Merge branch 'arbor_integration' of github.com:lukasgd/BluePyOpt into…
lukasgd Oct 20, 2022
4bc6424
More iexpr tests, mech metadata type in ACC exporter, Arbor label mov…
lukasgd Oct 20, 2022
e83dbc0
Renamed l5pc Arbor-Neuron validation
lukasgd Oct 20, 2022
ebd32d0
Adding docstrings to create_acc, replaced os by pathlib
lukasgd Oct 21, 2022
9bbc68e
Python 3 exception handling in protocols, better create_hoc error mes…
lukasgd Oct 23, 2022
bcada48
Use kwargs for cable cell constructor and swap label-dict and decor
lukasgd Oct 24, 2022
b973162
tox use the same EXTRA_ARBOR defined in setup.py
anilbey Oct 24, 2022
9dd09e6
create a submodule for arbor's dsl inside parameterscalers
anilbey Oct 25, 2022
4148974
Renaming Arbor iexpr module, adding docstring
lukasgd Oct 25, 2022
73772ea
Integrating Anil's review including large extension of the create_acc…
lukasgd Nov 7, 2022
e85d695
Fixing expsyn generate_acc docs
lukasgd Nov 7, 2022
93c0685
Fixing create_acc tests
lukasgd Nov 9, 2022
02a00fb
Anil's review for ACC exporter, fixing create_acc tests
lukasgd Dec 21, 2022
04ce614
Integrating more feedback from Anil, fixed L5PC ACC test
lukasgd Jan 4, 2023
5c9a5bf
Merge branch 'master' into arbor_integration
lukasgd Jan 10, 2023
70fddf8
Merge branch 'master' into arbor_integration
lukasgd Jan 15, 2023
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
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
include versioneer.py
include bluepyopt/_version.py
include bluepyopt/ephys/static/arbor_mechanisms.json
include bluepyopt/ephys/templates/cell_template.jinja2
include bluepyopt/ephys/templates/acc/_json_template.jinja2
include bluepyopt/ephys/templates/acc/decor_acc_template.jinja2
include bluepyopt/ephys/templates/acc/label_dict_acc_template.jinja2

include.txt
include AUTHORS.txt
Expand Down
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ l5pc_nbconvert: jupyter
cd examples/l5pc && \
jupyter nbconvert --to python L5PC.ipynb && \
sed '/get_ipython/d;/plt\./d;/plot_responses/d;/import matplotlib/d;/neurom/d;/axes/d;/fig/d;/for index/d' L5PC.py >L5PC.tmp && \
mv L5PC.tmp L5PC.py
mv L5PC.tmp L5PC.py && \
python l5pc_validate_neuron_arbor_pm.py --prepare-only --regions somatic --param-values ../../bluepyopt/tests/testdata/l5pc_validate_neuron_arbor/param_values.json && \
jupyter nbconvert --to python l5pc_validate_neuron_arbor_somatic.ipynb && \
sed '/get_ipython/d;/plt\./d;/import matplotlib/d;/from IPython.display/d;/multiprocessing/d;s/pool.map/map/g;s/# test_l5pc: insert //g;/# test_l5pc: skip/d' l5pc_validate_neuron_arbor_somatic.py >l5pc_validate_neuron_arbor_somatic.tmp && \
mv l5pc_validate_neuron_arbor_somatic.tmp l5pc_validate_neuron_arbor_somatic.py
l5pc_nrnivmodl:
cd examples/l5pc && nrnivmodl mechanisms
l5pc_zip:
Expand All @@ -28,7 +32,11 @@ sc_prepare: jupyter
cd examples/simplecell && \
jupyter nbconvert --to python simplecell.ipynb && \
sed '/get_ipython/d;/plt\./d;/plot_responses/d;/import matplotlib/d' simplecell.py >simplecell.tmp && \
mv simplecell.tmp simplecell.py
mv simplecell.tmp simplecell.py && \
jupyter nbconvert --to python simplecell_arbor.ipynb && \
sed '/get_ipython/d;/plt\./d;/plot_responses/d;/import matplotlib/d' simplecell_arbor.py >simplecell_arbor.tmp && \
mv simplecell_arbor.tmp simplecell_arbor.py

meta_prepare: jupyter
cd examples/metaparameters && \
jupyter nbconvert --to python metaparameters.ipynb && \
Expand All @@ -41,6 +49,8 @@ coverage_test: test
jupyter:
pip install jupyter
pip install ipython --upgrade
pip install papermill
pip install scipy
install_test_requirements:
pip install -q $(TEST_REQUIREMENTS) --upgrade
test: clean unit functional
Expand All @@ -65,6 +75,8 @@ clean:
rm -rf bluepyopt/tests/coverage.xml
rm -rf bluepyopt/tests/coverage_html
rm -rf examples/l5pc/L5PC.py
rm -rf examples/l5pc/l5pc_validate_neuron_arbor_somatic.ipynb
rm -rf examples/l5pc/l5pc_validate_neuron_arbor_somatic.py
rm -rf examples/l5pc/x86_64
rm -rf examples/stochkv/x86_64
rm -rf .coverage
Expand Down
12 changes: 10 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ We are providing support using a chat channel on `Gitter <https://gitter.im/Blue

News
====
- 2022/10/31: BluePyOpt now supports Arbor simulator.
- 2021/08/30: BluePyOpt dropped Python 2.7 support.
- 2017/01/04: BluePyOpt is now considered compatible with Python 3.6+.
- 2016/11/10: BluePyOpt now supports NEURON point processes. This means we can fit parameters of Adex/GIF/Izhikevich models, and also synapse models.
Expand Down Expand Up @@ -139,6 +140,11 @@ And then bluepyopt itself:

pip install bluepyopt

Support for simulators other than NEURON is optional and not installed by default. If you want to use [Arbor](https://arbor-sim.org/) to run your models, use the followig line instead to install bluepyopt.

.. code-block:: bash

pip install bluepyopt[arbor]

Cloud infrastructure
====================
Expand All @@ -156,7 +162,8 @@ Single compartmental model
An iPython notebook with an introductory optimisation of a one compartmental
model with 2 HH channels can be found at

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell.ipynb
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell.ipynb (NEURON)
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell_arbor.ipynb (Arbor)


|landscape_example|
Expand All @@ -171,7 +178,8 @@ Scripts for a more complex neocortical L5PC are in

With a notebook:

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/l5pc/L5PC.ipynb
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/l5pc/L5PC.ipynb (NEURON)
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/l5pc/L5PC_arbor.ipynb (Arbor)

Thalamocortical Cells
---------------------
Expand Down
57 changes: 57 additions & 0 deletions bluepyopt/ephys/acc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
'''Dependencies of Arbor simulator backend'''

try:
import arbor
except ImportError as e:
class arbor:
def __getattribute__(self, _):
raise ImportError("Exporting cell models to ACC/JSON, loading"
" them or optimizing them with the Arbor"
" simulator requires missing dependency arbor."
" To install BluePyOpt with arbor,"
" run 'pip install bluepyopt[arbor]'.")


class ArbLabel:
"""Arbor label"""

def __init__(self, type, name, s_expr):
if type not in ['locset', 'region', 'iexpr']:
raise ValueError('Invalid Arbor label type %s' % type)
self._type = type
self._name = name
self._s_expr = s_expr

@property
def defn(self):
"""Label definition for label-dict"""
return '(%s-def "%s" %s)' % (self._type, self._name, self._s_expr)

@property
def ref(self):
"""Reference to label defined in label-dict"""
return '(%s "%s")' % (self._type, self._name)

@property
def name(self):
"""Name of the label"""
return self._name

@property
def loc(self):
"""S-expression defining the location of the label"""
return self._s_expr

def __eq__(self, other):
if other is None:
return False
elif not isinstance(other, ArbLabel):
raise TypeError('%s is not an ArbLabel' % str(other))
else:
return self._s_expr == other._s_expr

def __hash__(self):
return hash(self._s_expr)

def __repr__(self):
return self.defn
Loading