diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ab384f..5d50e3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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 diff --git a/.github/workflows/keep-alive.yml b/.github/workflows/keep-alive.yml index 071f28d..e43e8d6 100644 --- a/.github/workflows/keep-alive.yml +++ b/.github/workflows/keep-alive.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4dde8c..5358f07 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 }} @@ -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 diff --git a/Makefile b/Makefile index 64b1118..3026586 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/bluepyopt/ephys/models.py b/bluepyopt/ephys/models.py index 475fb91..a4a2656 100644 --- a/bluepyopt/ephys/models.py +++ b/bluepyopt/ephys/models.py @@ -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, diff --git a/bluepyopt/ephys/templates/acc/decor_acc_template.jinja2 b/bluepyopt/ephys/templates/acc/decor_acc_template.jinja2 index eac074c..1d9ccc3 100644 --- a/bluepyopt/ephys/templates/acc/decor_acc_template.jinja2 +++ b/bluepyopt/ephys/templates/acc/decor_acc_template.jinja2 @@ -1,5 +1,5 @@ (arbor-component - (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 %} diff --git a/bluepyopt/ephys/templates/acc/label_dict_acc_template.jinja2 b/bluepyopt/ephys/templates/acc/label_dict_acc_template.jinja2 index ca2e7da..ebdd92c 100644 --- a/bluepyopt/ephys/templates/acc/label_dict_acc_template.jinja2 +++ b/bluepyopt/ephys/templates/acc/label_dict_acc_template.jinja2 @@ -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 }} diff --git a/bluepyopt/tests/test_ephys/test_parameterscalers.py b/bluepyopt/tests/test_ephys/test_parameterscalers.py index 877cac9..42a7f2d 100644 --- a/bluepyopt/tests/test_ephys/test_parameterscalers.py +++ b/bluepyopt/tests/test_ephys/test_parameterscalers.py @@ -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' \ diff --git a/bluepyopt/tests/test_ephys/test_simulators_mechdir.py b/bluepyopt/tests/test_ephys/test_simulators_mechdir.py new file mode 100644 index 0000000..471a68a --- /dev/null +++ b/bluepyopt/tests/test_ephys/test_simulators_mechdir.py @@ -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 diff --git a/bluepyopt/tests/test_ephys/test_stimuli.py b/bluepyopt/tests/test_ephys/test_stimuli.py index aa3c06d..1b2bd9c 100644 --- a/bluepyopt/tests/test_ephys/test_stimuli.py +++ b/bluepyopt/tests/test_ephys/test_stimuli.py @@ -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) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_decor.acc b/bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_decor.acc index 2427ea9..9a0e4e3 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_decor.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_decor.acc @@ -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))) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_label_dict.acc b/bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_label_dict.acc index 2fcd017..3ea9037 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_label_dict.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_label_dict.acc @@ -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)) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/CCell/simple_axon_replacement.acc b/bluepyopt/tests/test_ephys/testdata/acc/CCell/simple_axon_replacement.acc index b5df598..a45bb32 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/CCell/simple_axon_replacement.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/CCell/simple_axon_replacement.acc @@ -1,6 +1,6 @@ (arbor-component (meta-data - (version "0.9-dev")) + (version "0.10-dev")) (morphology (branch 0 -1 (segment 0 diff --git a/bluepyopt/tests/test_ephys/testdata/acc/expsyn/simple_cell_decor.acc b/bluepyopt/tests/test_ephys/testdata/acc/expsyn/simple_cell_decor.acc index e1ed15e..0b27a61 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/expsyn/simple_cell_decor.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/expsyn/simple_cell_decor.acc @@ -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"))) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/expsyn/simple_cell_label_dict.acc b/bluepyopt/tests/test_ephys/testdata/acc/expsyn/simple_cell_label_dict.acc index ab69054..99a1da9 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/expsyn/simple_cell_label_dict.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/expsyn/simple_cell_label_dict.acc @@ -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)) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/C060114A7_axon_replacement.acc b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/C060114A7_axon_replacement.acc index e9f0384..45a700a 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/C060114A7_axon_replacement.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/C060114A7_axon_replacement.acc @@ -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)))) \ No newline at end of file diff --git a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/C060114A7_modified.acc b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/C060114A7_modified.acc index 2645117..0bd52ad 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/C060114A7_modified.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/C060114A7_modified.acc @@ -1,6 +1,6 @@ (arbor-component (meta-data - (version "0.9-dev")) + (version "0.10-dev")) (morphology (branch 0 -1 (segment 0 @@ -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)))) \ No newline at end of file diff --git a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc.json b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc.json index 600731c..9aacd4b 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc.json +++ b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc.json @@ -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", diff --git a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_decor.acc b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_decor.acc index fb9c4e4..f716a45 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_decor.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_decor.acc @@ -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))) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_label_dict.acc b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_label_dict.acc index feec6f7..53ded09 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_label_dict.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_label_dict.acc @@ -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)) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/l5pc_py37/l5pc_decor.acc b/bluepyopt/tests/test_ephys/testdata/acc/l5pc_py37/l5pc_decor.acc index 449a04f..6134f4a 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/l5pc_py37/l5pc_decor.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/l5pc_py37/l5pc_decor.acc @@ -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))) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_axon_replacement.acc b/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_axon_replacement.acc index 5aad006..d3890f5 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_axon_replacement.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_axon_replacement.acc @@ -1,6 +1,6 @@ (arbor-component (meta-data - (version "0.9-dev")) + (version "0.10-dev")) (morphology (branch 0 -1 (segment 0 diff --git a/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_decor.acc b/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_decor.acc index e136103..23cd427 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_decor.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_decor.acc @@ -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)))))) \ No newline at end of file diff --git a/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_label_dict.acc b/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_label_dict.acc index feec6f7..53ded09 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_label_dict.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_cell_label_dict.acc @@ -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)) diff --git a/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_modified.acc b/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_modified.acc index 0e29834..4e8fbda 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_modified.acc +++ b/bluepyopt/tests/test_ephys/testdata/acc/simplecell/simple_modified.acc @@ -1,6 +1,6 @@ (arbor-component (meta-data - (version "0.9-dev")) + (version "0.10-dev")) (morphology (branch 0 -1 (segment 0 diff --git a/bluepyopt/tests/test_ephys/testdata/acc/templates/decor_acc_template.jinja2 b/bluepyopt/tests/test_ephys/testdata/acc/templates/decor_acc_template.jinja2 index 4f5a33c..469ad05 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/templates/decor_acc_template.jinja2 +++ b/bluepyopt/tests/test_ephys/testdata/acc/templates/decor_acc_template.jinja2 @@ -1,5 +1,5 @@ (arbor-component - (meta-data (version "0.9-dev")) + (meta-data (version "0.10-dev")) (meta-data (info "test-decor")) (decor {%- for mech, params in global_mechs.items() %} diff --git a/bluepyopt/tests/test_ephys/testdata/acc/templates/label_dict_acc_template.jinja2 b/bluepyopt/tests/test_ephys/testdata/acc/templates/label_dict_acc_template.jinja2 index e2686dc..b753f94 100644 --- a/bluepyopt/tests/test_ephys/testdata/acc/templates/label_dict_acc_template.jinja2 +++ b/bluepyopt/tests/test_ephys/testdata/acc/templates/label_dict_acc_template.jinja2 @@ -1,5 +1,5 @@ (arbor-component - (meta-data (version "0.9-dev")) + (meta-data (version "0.10-dev")) (meta-data (info "test-label-dict")) (label-dict {%- for loc, label in label_dict.items() %}{# this is a comment #} diff --git a/bluepyopt/tests/test_ephys/testmodels/dummycells.py b/bluepyopt/tests/test_ephys/testmodels/dummycells.py index 9c2baff..0c2b680 100644 --- a/bluepyopt/tests/test_ephys/testmodels/dummycells.py +++ b/bluepyopt/tests/test_ephys/testmodels/dummycells.py @@ -113,8 +113,11 @@ def __init__(self): self.persistent.append(self.icell) self.persistent.append(self.icell.soma[0]) + morph_sl = sim.neuron.h.SectionList() + for sec in sim.neuron.h.allsec(): + morph_sl.append(sec=sec) self.lfpy_cell = LFPy.Cell( - morphology=sim.neuron.h.allsec(), + morphology=morph_sl, dt=0.025, v_init=-65, pt3d=True, diff --git a/bluepyopt/tests/test_l5pc.py b/bluepyopt/tests/test_l5pc.py index ddc7688..aa54559 100644 --- a/bluepyopt/tests/test_l5pc.py +++ b/bluepyopt/tests/test_l5pc.py @@ -24,11 +24,7 @@ sys.path.insert(0, L5PC_PATH) -neuron_sim = ephys.simulators.NrnSimulator() - -neuron_sim.neuron.h.nrn_load_dll( - os.path.join(L5PC_PATH, "x86_64/.libs/libnrnmech.so") -) +neuron_sim = ephys.simulators.NrnSimulator(mechanisms_directory=L5PC_PATH) # Parameters in release circuit model @@ -89,7 +85,8 @@ def setup_method(self): self.l5pc_cell = l5pc_model.create() assert isinstance(self.l5pc_cell, bluepyopt.ephys.models.CellModel) - self.nrn = ephys.simulators.NrnSimulator() + self.nrn = ephys.simulators.NrnSimulator( + mechanisms_directory=L5PC_PATH) def test_instantiate(self): """L5PC: test instantiation of l5pc cell model""" diff --git a/bluepyopt/tests/test_lfpy.py b/bluepyopt/tests/test_lfpy.py index 746b4bb..5f9f717 100644 --- a/bluepyopt/tests/test_lfpy.py +++ b/bluepyopt/tests/test_lfpy.py @@ -33,5 +33,5 @@ def test_lfpy_evaluator(): values = evaluator.fitness_calculator.calculate_values(responses) assert len(values) == 21 - assert abs(values["Step1.soma.AP_height"] - 27.85963902931001) < 1e-5 + assert abs(values["Step1.soma.AP_height"] - 27.85) < 0.05 assert len(responses["Step1.MEA.v"]["voltage"]) == 40 diff --git a/bluepyopt/tests/test_stochkv.py b/bluepyopt/tests/test_stochkv.py index 71f2cc2..77d31d7 100644 --- a/bluepyopt/tests/test_stochkv.py +++ b/bluepyopt/tests/test_stochkv.py @@ -11,12 +11,7 @@ from bluepyopt import ephys -neuron_sim = ephys.simulators.NrnSimulator() - -neuron_sim.neuron.h.nrn_load_dll( - os.path.join( - STOCHKV_PATH, - 'x86_64/.libs/libnrnmech.so')) +neuron_sim = ephys.simulators.NrnSimulator(mechanisms_directory=STOCHKV_PATH) def compare_strings(s1, s2): diff --git a/examples/l5pc/l5pc_evaluator.py b/examples/l5pc/l5pc_evaluator.py index e573ecf..e3681f9 100644 --- a/examples/l5pc/l5pc_evaluator.py +++ b/examples/l5pc/l5pc_evaluator.py @@ -195,7 +195,8 @@ def create(do_replace_axon=True, sim='nrn'): if not param.frozen] if sim == 'nrn': - simulator = ephys.simulators.NrnSimulator() + simulator = ephys.simulators.NrnSimulator( + mechanisms_directory=script_dir) elif sim == 'arb': simulator = ephys.simulators.ArbSimulator() if do_replace_axon: diff --git a/examples/l5pc_lfpy/l5pc_lfpy_evaluator.py b/examples/l5pc_lfpy/l5pc_lfpy_evaluator.py index 1b31880..d64ea69 100644 --- a/examples/l5pc_lfpy/l5pc_lfpy_evaluator.py +++ b/examples/l5pc_lfpy/l5pc_lfpy_evaluator.py @@ -148,7 +148,10 @@ def create(feature_file="extra_features.json", cvode_active=True, dt=None): param.name for param in l5pc_cell.params.values() if not param.frozen ] - lfpy_sim = ephys.simulators.LFPySimulator(cvode_active=cvode_active, dt=dt) + l5pc_dir = str(pathlib.Path(__file__).parents[1] / "l5pc") + + lfpy_sim = ephys.simulators.LFPySimulator( + cvode_active=cvode_active, dt=dt, mechanisms_directory=l5pc_dir) return ephys.evaluators.CellEvaluator( cell_model=l5pc_cell, diff --git a/examples/stochkv/stochkv3cell.py b/examples/stochkv/stochkv3cell.py index 688616b..717e2a2 100644 --- a/examples/stochkv/stochkv3cell.py +++ b/examples/stochkv/stochkv3cell.py @@ -87,7 +87,8 @@ def run_stochkv3_model(deterministic=False): protocol = ephys.protocols.SweepProtocol('Step', [stim, hold_stim], [rec]) - nrn = ephys.simulators.NrnSimulator(cvode_active=False) + nrn = ephys.simulators.NrnSimulator( + cvode_active=False, mechanisms_directory=script_dir) evaluator = ephys.evaluators.CellEvaluator( cell_model=stochkv3_cell, diff --git a/examples/stochkv/stochkvcell.py b/examples/stochkv/stochkvcell.py index 74c6159..caafb23 100644 --- a/examples/stochkv/stochkvcell.py +++ b/examples/stochkv/stochkvcell.py @@ -87,7 +87,8 @@ def run_stochkv_model(deterministic=False): protocol = ephys.protocols.SweepProtocol('Step', [stim, hold_stim], [rec]) - nrn = ephys.simulators.NrnSimulator(cvode_active=False) + nrn = ephys.simulators.NrnSimulator( + cvode_active=False, mechanisms_directory=script_dir) evaluator = ephys.evaluators.CellEvaluator( cell_model=stochkv_cell, diff --git a/pyproject.toml b/pyproject.toml index 9a317df..f4ea7be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [ description="Blue Brain Python Optimisation Library (bluepyopt)" readme = "README.rst" license = {file = "LICENSE.txt"} -requires-python = ">= 3.9" +requires-python = ">= 3.10" dynamic = ["version"] dependencies = [ "numpy>=1.6", @@ -41,6 +41,7 @@ keywords = [ [project.optional-dependencies] all = ["scoop>=0.7", "pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3", "arbor>=0.10"] tests = ["pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3", "arbor>=0.10"] +tests-no-arbor = ["pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3"] scoop = ["scoop>=0.7"] neuroml = ["pyneuroml>=0.5.20", "libNeuroML>=0.3.1"] lfpy = ["LFPy>=2.3"] diff --git a/requirements_docs.txt b/requirements_docs.txt index dfce796..531f70b 100644 --- a/requirements_docs.txt +++ b/requirements_docs.txt @@ -12,6 +12,6 @@ # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -sphinx>=2.0.0 +sphinx>=2.0.0,<9 sphinx-bluebrain-theme sphinx-autorun \ No newline at end of file diff --git a/tox.ini b/tox.ini index 60af05f..fcb8c30 100644 --- a/tox.ini +++ b/tox.ini @@ -4,14 +4,16 @@ minversion = 4 [gh-actions] python = - 3.9: py3 3.10: py3 3.11: py3 3.12: py3 + 3.13: py3 + 3.14: py314 [testenv] envdir = - py3{9,10,11,12,}{-unit,-functional,-style,-syntax}: {toxworkdir}/py3 + py3{10,11,12,13,}{-unit,-functional,-style,-syntax}: {toxworkdir}/py3 + py314{-unit,-functional,-style,-syntax}: {toxworkdir}/py314 docs: {toxworkdir}/docs extras = tests deps = @@ -44,6 +46,9 @@ commands = ; because it redefines l5pc template which makes neuron crash and tests fail functional: pytest --cov=bluepyopt {[testenv]coverage_options} bluepyopt/tests -m neuroml +[testenv:py314{-unit,-functional,-style,-syntax}] +extras = tests-no-arbor + [testenv:docs] basepython = python3.9 changedir = docs