Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
contents: write
id-token: write # needed for pypi publication
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Set up Python 3.12
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.64.0
uses: anothrNick/github-tag-action@v1
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
id: tag
env:
Expand All @@ -51,11 +51,11 @@ jobs:
run: echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.TAG_NAME }}
name: ${{ env.TAG_NAME }}
generate_release_notes: true

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.12
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .github/workflows/keep-alive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Keep workflow alive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
ref: master

Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
- os: macos-13
- os: macos-14
python-version: "3.12"
- python-version: "3.14"
continue-on-error: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -34,7 +36,7 @@ jobs:
run: tox

- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,14 @@ clean:
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/l5pc/arm64
rm -rf examples/l5pc/aarch64
rm -rf examples/stochkv/x86_64
rm -rf examples/stochkv/arm64
rm -rf examples/stochkv/aarch64
rm -rf x86_64
rm -rf arm64
rm -rf aarch64
rm -rf .coverage
rm -rf coverage.xml
rm -rf channels
Expand Down
5 changes: 4 additions & 1 deletion bluepyopt/ephys/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,11 @@ def instantiate(self, sim=None):

self.morphology.instantiate(sim=sim, icell=self.icell)

morph_sl = sim.neuron.h.SectionList()
for sec in sim.neuron.h.allsec():
morph_sl.append(sec=sec)
self.lfpy_cell = Cell(
morphology=sim.neuron.h.allsec(),
morphology=morph_sl,
dt=self.dt,
v_init=self.v_init,
pt3d=True,
Expand Down
2 changes: 1 addition & 1 deletion bluepyopt/ephys/templates/acc/decor_acc_template.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
Comment thread
darshanmandge marked this conversation as resolved.
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(decor
{%- for mech, params in global_mechs.items() %}
{%- if mech is not none %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(label-dict
{%- for loc, label in label_dict.items() %}
{{ label.defn }}
Expand Down
2 changes: 1 addition & 1 deletion bluepyopt/tests/test_ephys/test_parameterscalers.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_parameterscalers_iexpr():
# bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_decor.acc
simple_cell_decor_with_iexpr = \
'(arbor-component\n' \
' (meta-data (version "0.9-dev"))\n' \
' (meta-data (version "0.10-dev"))\n' \
' (decor\n' \
' (paint (region "soma") ' \
'(membrane-capacitance 0.01 (scalar 1.0)))\n' \
Expand Down
103 changes: 103 additions & 0 deletions bluepyopt/tests/test_ephys/test_simulators_mechdir.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
"""Tests for NrnSimulator and LFPySimulator mechanisms_directory.

Verifies that simulators correctly store mechanisms_directory and that
evaluators set it, ensuring pebble subprocesses can reload mechanisms.

**Validates: Requirements 1.1, 1.2, 2.1, 2.2, 3.1, 3.2, 3.5, 3.6**
"""

import os
import sys

import pytest

import bluepyopt.ephys as ephys


# -------------------------------------------------------------------
# Bug condition tests: mechanisms_directory handling
# -------------------------------------------------------------------

@pytest.mark.unit
def test_nrnsimulator_mechanisms_directory_set():
"""NrnSimulator(mechanisms_directory=path) stores the attribute."""
for path in ["/tmp/mechs", "/some/other/path", "relative/path"]:
sim = ephys.simulators.NrnSimulator(
mechanisms_directory=path)
assert sim.mechanisms_directory == path


@pytest.mark.unit
def test_lfpysimulator_mechanisms_directory_set():
"""LFPySimulator(mechanisms_directory=path) stores the attribute."""
for path in ["/tmp/mechs", "/some/other/path"]:
sim = ephys.simulators.LFPySimulator(
mechanisms_directory=path)
assert sim.mechanisms_directory == path


@pytest.mark.unit
def test_l5pc_evaluator_has_mechanisms_directory():
"""l5pc_evaluator.create() sets mechanisms_directory on sim."""
l5pc_path = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"../../../examples/l5pc"))
sys.path.insert(0, l5pc_path)

import l5pc_evaluator # noqa: E402

evaluator = l5pc_evaluator.create()
assert evaluator.sim.mechanisms_directory is not None


@pytest.mark.unit
def test_l5pc_lfpy_evaluator_has_mechanisms_directory():
"""l5pc_lfpy_evaluator.create() sets mechanisms_directory."""
lfpy_path = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"../../../examples/l5pc_lfpy"))
sys.path.insert(0, lfpy_path)

import l5pc_lfpy_evaluator # noqa: E402

feature_file = os.path.join(
lfpy_path, "extra_features.json")
evaluator = l5pc_lfpy_evaluator.create(
feature_file=feature_file)
assert evaluator.sim.mechanisms_directory is not None


# -------------------------------------------------------------------
# Preservation tests: NrnSimulator core behavior unchanged
# -------------------------------------------------------------------

@pytest.mark.unit
def test_nrnsimulator_defaults_preserved():
"""NrnSimulator() defaults are all correct, and custom args are stored."""
sim = ephys.simulators.NrnSimulator()
assert sim.cvode_active is True
assert isinstance(sim.dt, float)
assert sim.dt > 0
assert sim.mechanisms_directory is None
assert sim.cvode_minstep_value is None
assert sim.random123_globalindex is None


@pytest.mark.unit
def test_nrnsimulator_attributes_preserved():
"""NrnSimulator preserves dt, cvode_active, mechanisms_directory."""
test_cases = [
(0.025, False, "/tmp/mechs"),
(0.001, True, None),
(0.1, False, "/another/path"),
]
for dt_val, cv_val, md_val in test_cases:
sim = ephys.simulators.NrnSimulator(
dt=dt_val,
cvode_active=cv_val,
mechanisms_directory=md_val)
assert sim.dt == dt_val
assert sim.cvode_active == cv_val
assert sim.mechanisms_directory == md_val
2 changes: 1 addition & 1 deletion bluepyopt/tests/test_ephys/test_stimuli.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def test_NrnRampPulse_instantiate():
voltage[
numpy.where(
(ramp_delay + ramp_duration < time)
& (time <= total_duration))]), -57.994437612124869)
& (time <= total_duration))]), -57.994437612124869, decimal=4)
recording.destroy(sim=nrn_sim)
stim.destroy(sim=nrn_sim)
dummy_cell.destroy(sim=nrn_sim)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(decor
(default (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
(paint (region "soma") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(label-dict
(region-def "all" (all))
(region-def "apic" (tag 4))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(arbor-component
(meta-data
(version "0.9-dev"))
(version "0.10-dev"))
(morphology
(branch 0 -1
(segment 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(decor
(paint (region "soma") (membrane-capacitance 0.01 (scalar 1.0)))
(paint (region "soma") (density (mechanism "default::pas")))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(label-dict
(region-def "all" (all))
(region-def "soma" (tag 1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
(arbor-component
(meta-data
(version "0.9-dev"))
(version "0.10-dev"))
(morphology
(branch 0 -1
(segment 0
(point 263.248016 5.356219 -3.380000 0.690000)
(point 262.996735 -9.641676 -3.380000 0.690000)
(point 263.685455 31.465240 -3.380000 0.690000)
(point 263.936737 46.463135 -3.380000 0.690000)
2)
(segment 1
(point 262.996735 -9.641676 -3.380000 0.690000)
(point 262.745453 -24.639572 -3.380000 0.690000)
(point 263.936737 46.463135 -3.380000 0.690000)
(point 264.188019 61.461033 -3.380000 0.690000)
2)
(segment 2
(point 262.745453 -24.639572 -3.380000 0.460000)
(point 262.494171 -39.637466 -3.380000 0.460000)
(point 264.188019 61.461033 -3.380000 0.460000)
(point 264.439301 76.458931 -3.380000 0.460000)
2)
(segment 3
(point 262.494171 -39.637466 -3.380000 0.460000)
(point 262.242889 -54.635365 -3.380000 0.460000)
(point 264.439301 76.458931 -3.380000 0.460000)
(point 264.690582 91.456825 -3.380000 0.460000)
2))))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(arbor-component
(meta-data
(version "0.9-dev"))
(version "0.10-dev"))
(morphology
(branch 0 -1
(segment 0
Expand Down Expand Up @@ -21685,18 +21685,18 @@
4))
(branch 197 -1
(segment 5371
(point 263.248016 5.356219 -3.380000 0.690000)
(point 262.996735 -9.641676 -3.380000 0.690000)
(point 263.685455 31.465240 -3.380000 0.690000)
(point 263.936737 46.463135 -3.380000 0.690000)
2)
(segment 5372
(point 262.996735 -9.641676 -3.380000 0.690000)
(point 262.745453 -24.639572 -3.380000 0.690000)
(point 263.936737 46.463135 -3.380000 0.690000)
(point 264.188019 61.461033 -3.380000 0.690000)
2)
(segment 5373
(point 262.745453 -24.639572 -3.380000 0.460000)
(point 262.494171 -39.637466 -3.380000 0.460000)
(point 264.188019 61.461033 -3.380000 0.460000)
(point 264.439301 76.458931 -3.380000 0.460000)
2)
(segment 5374
(point 262.494171 -39.637466 -3.380000 0.460000)
(point 262.242889 -54.635365 -3.380000 0.460000)
(point 264.439301 76.458931 -3.380000 0.460000)
(point 264.690582 91.456825 -3.380000 0.460000)
2))))
4 changes: 2 additions & 2 deletions bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
{
"cell_model_name": "l5pc",
"produced_by": "Created by BluePyOpt(1.12.113) at 2022-11-06 18:21:20.822883",
"produced_by": "Created by BluePyOpt(1.14.19.dev2) at 2026-04-16 09:46:59.248761",
"morphology": {
"original": "C060114A7.asc",
"replace_axon": "C060114A7_axon_replacement.acc",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(decor
(default (membrane-potential -65 (scalar 1.0)))
(default (temperature-kelvin 307.14999999999998 (scalar 1.0)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(label-dict
(region-def "all" (all))
(region-def "soma" (tag 1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(decor
(default (membrane-potential -65 (scalar 1.0)))
(default (temperature-kelvin 307.14999999999998 (scalar 1.0)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(arbor-component
(meta-data
(version "0.9-dev"))
(version "0.10-dev"))
(morphology
(branch 0 -1
(segment 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(decor
(paint (region "soma") (membrane-capacitance 0.01 (scalar 1.0)))
(paint (region "soma") (density (mechanism "default::hh" ("gnabar" 0.10299326453483033) ("gkbar" 0.027124836082684685))))))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(meta-data (version "0.10-dev"))
(label-dict
(region-def "all" (all))
(region-def "soma" (tag 1))
Expand Down
Loading