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

Commit e3811a7

Browse files
author
Jaquier Aurélien Tristan
committed
Merge branch 'master' of https://github.com/BlueBrain/BluePyOpt into test-py311
Conflicts: .github/workflows/test.yml
2 parents 7d87449 + d7d2f12 commit e3811a7

File tree

88 files changed

+52058
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+52058
-290
lines changed

.github/workflows/keep-alive.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ jobs:
2323
echo "datelimit=$datethen" >> $GITHUB_ENV
2424
2525
- name: setup git config
26-
if: github.event.base.repo.updated_at <= env.datelimit
26+
if: github.event.repository.pushed_at <= env.datelimit
2727
run: |
2828
# setup the username and email.
2929
git config user.name "Github Actions Keepalive Bot"
3030
git config user.email "<>"
3131
3232
- name: commit IF last commit is older than 50 days
33-
if: github.event.base.repo.updated_at <= env.datelimit
33+
if: github.event.repository.pushed_at <= env.datelimit
3434
run: |
3535
git commit -m "Empty commit to keep the gihub workflows alive" --allow-empty
3636
git push origin master

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [ubuntu-latest, macos-latest]
14+
os: [ubuntu-latest]
1515
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
16+
include:
17+
- os: macos-latest
18+
python-version: "3.10"
1619

1720
steps:
1821
- uses: actions/checkout@v2

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
include versioneer.py
22
include bluepyopt/_version.py
3+
include bluepyopt/ephys/static/arbor_mechanisms.json
34
include bluepyopt/ephys/templates/cell_template.jinja2
5+
include bluepyopt/ephys/templates/acc/_json_template.jinja2
6+
include bluepyopt/ephys/templates/acc/decor_acc_template.jinja2
7+
include bluepyopt/ephys/templates/acc/label_dict_acc_template.jinja2
48

59
include.txt
610
include AUTHORS.txt

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ l5pc_nbconvert: jupyter
1515
cd examples/l5pc && \
1616
jupyter nbconvert --to python L5PC.ipynb && \
1717
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 && \
18-
mv L5PC.tmp L5PC.py
18+
mv L5PC.tmp L5PC.py && \
19+
python l5pc_validate_neuron_arbor_pm.py --prepare-only --regions somatic --param-values ../../bluepyopt/tests/testdata/l5pc_validate_neuron_arbor/param_values.json && \
20+
jupyter nbconvert --to python l5pc_validate_neuron_arbor_somatic.ipynb && \
21+
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 && \
22+
mv l5pc_validate_neuron_arbor_somatic.tmp l5pc_validate_neuron_arbor_somatic.py
1923
l5pc_nrnivmodl:
2024
cd examples/l5pc && nrnivmodl mechanisms
2125
l5pc_zip:
@@ -28,7 +32,11 @@ sc_prepare: jupyter
2832
cd examples/simplecell && \
2933
jupyter nbconvert --to python simplecell.ipynb && \
3034
sed '/get_ipython/d;/plt\./d;/plot_responses/d;/import matplotlib/d' simplecell.py >simplecell.tmp && \
31-
mv simplecell.tmp simplecell.py
35+
mv simplecell.tmp simplecell.py && \
36+
jupyter nbconvert --to python simplecell_arbor.ipynb && \
37+
sed '/get_ipython/d;/plt\./d;/plot_responses/d;/import matplotlib/d' simplecell_arbor.py >simplecell_arbor.tmp && \
38+
mv simplecell_arbor.tmp simplecell_arbor.py
39+
3240
meta_prepare: jupyter
3341
cd examples/metaparameters && \
3442
jupyter nbconvert --to python metaparameters.ipynb && \
@@ -41,6 +49,8 @@ coverage_test: test
4149
jupyter:
4250
pip install jupyter
4351
pip install ipython --upgrade
52+
pip install papermill
53+
pip install scipy
4454
install_test_requirements:
4555
pip install -q $(TEST_REQUIREMENTS) --upgrade
4656
test: clean unit functional
@@ -65,6 +75,8 @@ clean:
6575
rm -rf bluepyopt/tests/coverage.xml
6676
rm -rf bluepyopt/tests/coverage_html
6777
rm -rf examples/l5pc/L5PC.py
78+
rm -rf examples/l5pc/l5pc_validate_neuron_arbor_somatic.ipynb
79+
rm -rf examples/l5pc/l5pc_validate_neuron_arbor_somatic.py
6880
rm -rf examples/l5pc/x86_64
6981
rm -rf examples/stochkv/x86_64
7082
rm -rf x86_64

README.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ We are providing support using a chat channel on `Gitter <https://gitter.im/Blue
107107

108108
News
109109
====
110+
- 2023/01: BluePyOpt now supports the Arbor simulator.
111+
- 2022/12: Support for LFPy models merged into master. Examples and preprint: https://github.com/alejoe91/multimodalfitting, https://www.biorxiv.org/content/10.1101/2022.08.03.502468v1.full
112+
- 2022/12: BluePyOpt now has the ability to write out NeuroML files: https://github.com/BlueBrain/BluePyOpt/tree/master/bluepyopt/neuroml
110113
- 2021/08/30: BluePyOpt dropped Python 2.7 support.
111114
- 2017/01/04: BluePyOpt is now considered compatible with Python 3.6+.
112115
- 2016/11/10: BluePyOpt now supports NEURON point processes. This means we can fit parameters of Adex/GIF/Izhikevich models, and also synapse models.
@@ -139,6 +142,11 @@ And then bluepyopt itself:
139142
140143
pip install bluepyopt
141144
145+
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 following line instead to install bluepyopt.
146+
147+
.. code-block:: bash
148+
149+
pip install bluepyopt[arbor]
142150
143151
Cloud infrastructure
144152
====================
@@ -156,7 +164,8 @@ Single compartmental model
156164
An iPython notebook with an introductory optimisation of a one compartmental
157165
model with 2 HH channels can be found at
158166

159-
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell.ipynb
167+
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell.ipynb (NEURON)
168+
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell_arbor.ipynb (Arbor)
160169

161170

162171
|landscape_example|
@@ -171,7 +180,8 @@ Scripts for a more complex neocortical L5PC are in
171180

172181
With a notebook:
173182

174-
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/l5pc/L5PC.ipynb
183+
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/l5pc/L5PC.ipynb (NEURON)
184+
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/l5pc/L5PC_arbor.ipynb (Arbor)
175185

176186
Thalamocortical Cells
177187
---------------------
@@ -193,6 +203,14 @@ With 2 notebooks:
193203
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/tsodyksmarkramstp/tsodyksmarkramstp.ipynb
194204
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/tsodyksmarkramstp/tsodyksmarkramstp_multiplefreqs.ipynb
195205

206+
Exporting cell in neuroml format
207+
--------------------------------
208+
An iPython notebook showing how to export a BluePyOpt cell in the neuroml format, how to create a LEMS simulation,
209+
and how to run the LEMS simulation with the neuroml cell can be found at:
210+
211+
https://github.com/BlueBrain/BluePyOpt/blob/master/examples/neuroml/neuroml.ipynb
212+
213+
196214
API documentation
197215
=================
198216
The API documentation can be found on `ReadTheDocs <http://bluepyopt.readthedocs.io/en/latest/>`_.

bluepyopt/deapext/optimisations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def setup_deap(self):
201201
# import deap_efel_eval1
202202
self.toolbox.register(
203203
"evaluate",
204-
self.evaluator.set_neuron_variables_and_evaluate_with_lists
204+
self.evaluator.init_simulator_and_evaluate_with_lists
205205
)
206206

207207
# Register the mate operator

bluepyopt/deapext/optimisationsCMA.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def setup_deap(self):
213213
# Register the evaluation function for the individuals
214214
self.toolbox.register(
215215
"evaluate",
216-
self.evaluator.set_neuron_variables_and_evaluate_with_lists
216+
self.evaluator.init_simulator_and_evaluate_with_lists
217217
)
218218

219219
import copyreg

bluepyopt/deapext/tools/selIBEA.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def _calc_fitness_components(population, kappa):
6363
population_matrix = numpy.fromiter(
6464
iter(-x for individual in population
6565
for x in individual.fitness.wvalues),
66-
dtype=numpy.float)
66+
dtype=numpy.float64)
6767
pop_len = len(population)
6868
feat_len = len(population[0].fitness.wvalues)
6969
population_matrix = population_matrix.reshape((pop_len, feat_len))

bluepyopt/ephys/acc.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
'''Dependencies of Arbor simulator backend'''
2+
3+
try:
4+
import arbor
5+
except ImportError as e:
6+
class arbor:
7+
def __getattribute__(self, _):
8+
raise ImportError("Exporting cell models to ACC/JSON, loading"
9+
" them or optimizing them with the Arbor"
10+
" simulator requires missing dependency arbor."
11+
" To install BluePyOpt with arbor,"
12+
" run 'pip install bluepyopt[arbor]'.")
13+
14+
15+
class ArbLabel:
16+
"""Arbor label"""
17+
18+
def __init__(self, type, name, s_expr):
19+
if type not in ['locset', 'region', 'iexpr']:
20+
raise ValueError('Invalid Arbor label type %s' % type)
21+
self._type = type
22+
self._name = name
23+
self._s_expr = s_expr
24+
25+
@property
26+
def defn(self):
27+
"""Label definition for label-dict"""
28+
return '(%s-def "%s" %s)' % (self._type, self._name, self._s_expr)
29+
30+
@property
31+
def ref(self):
32+
"""Reference to label defined in label-dict"""
33+
return '(%s "%s")' % (self._type, self._name)
34+
35+
@property
36+
def name(self):
37+
"""Name of the label"""
38+
return self._name
39+
40+
@property
41+
def loc(self):
42+
"""S-expression defining the location of the label"""
43+
return self._s_expr
44+
45+
def __eq__(self, other):
46+
if other is None:
47+
return False
48+
elif not isinstance(other, ArbLabel):
49+
raise TypeError('%s is not an ArbLabel' % str(other))
50+
else:
51+
return self._s_expr == other._s_expr
52+
53+
def __hash__(self):
54+
return hash(self._s_expr)
55+
56+
def __repr__(self):
57+
return self.defn

0 commit comments

Comments
 (0)