Skip to content

Commit 520c183

Browse files
authored
Merge pull request #392 from NeuroML/experimental
Use jnml jar 0.13.1; fixes to allow for cells with external morphology/biophysicalProperties
2 parents 6d3acbc + 9dd24f4 commit 520c183

File tree

8 files changed

+22
-6
lines changed

8 files changed

+22
-6
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,7 @@ arm64
177177
/examples/test_data/xppaut/wc_2.ode
178178

179179
coverage.xml
180+
/examples/LEMS_NML2_Ex5_DetCell.sedml.omex
181+
/examples/hhcell.swc
182+
/examples/metadata.rdf
183+
/tests/utils/test_translation.net.nml

examples/LeakConductance.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ TITLE Mod file for component: Component(id=LeakConductance type=ionChannelHH)
33
COMMENT
44

55
This NEURON file has been generated by org.neuroml.export (see https://github.com/NeuroML/org.neuroml.export)
6-
org.neuroml.export v1.10.0
7-
org.neuroml.model v1.10.0
8-
jLEMS v0.11.0
6+
org.neuroml.export v1.10.1
7+
org.neuroml.model v1.10.1
8+
jLEMS v0.11.1
99

1010
ENDCOMMENT
1111

pyneuroml/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
__version__ = importlib_metadata.version("pyNeuroML")
1313

1414

15-
JNEUROML_VERSION = "0.13.0"
15+
JNEUROML_VERSION = "0.13.1"
1616

1717
# Define a logger for the package
1818
logging.basicConfig(

pyneuroml/io.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def read_neuroml2_file(
3434
already_included: Optional[list] = None,
3535
optimized: bool = False,
3636
check_validity_pre_include: bool = False,
37+
fix_external_morphs_biophys: bool = False,
3738
) -> NeuroMLDocument:
3839
"""Read a NeuroML2 file into a `nml.NeuroMLDocument`
3940
@@ -49,6 +50,8 @@ def read_neuroml2_file(
4950
:type optimized: bool
5051
:param check_validity_pre_include: check each file for validity before including
5152
:type check_validity_pre_include: bool
53+
:param fix_external_morphs_biophys: if a cell element has a morphology (or biophysicalProperties) attribute, as opposed to a subelement morphology/biophysicalProperties, substitute the external element into the cell element for ease of access
54+
:type fix_external_morphs_biophys: bool
5255
:returns: nml.NeuroMLDocument object containing the read NeuroML file(s)
5356
"""
5457
if already_included is None:
@@ -125,9 +128,14 @@ def read_neuroml2_file(
125128
for include in incl_to_remove:
126129
nml2_doc.includes.remove(include)
127130

131+
if fix_external_morphs_biophys:
132+
from neuroml.utils import fix_external_morphs_biophys_in_cell
133+
fix_external_morphs_biophys_in_cell(nml2_doc)
134+
128135
return nml2_doc
129136

130137

138+
131139
def write_neuroml2_file(
132140
nml2_doc: NeuroMLDocument,
133141
nml2_file_name: str,

pyneuroml/utils/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def summary(
9191

9292
if nml2_doc is None:
9393
nml2_file_name = sys.argv[1]
94-
nml2_doc = read_neuroml2_file(nml2_file_name, include_includes=verbose)
94+
nml2_doc = read_neuroml2_file(nml2_file_name, include_includes=verbose, fix_external_morphs_biophys=True)
9595

9696
info = nml2_doc.summary(show_includes=False)
9797

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = pyNeuroML
3-
version = 1.2.15
3+
version = 1.3.0
44
author = Padraig Gleeson
55
author_email = [email protected]
66
url = https://github.com/NeuroML/pyNeuroML

tests/utils/test_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def test_rotate_cell(self):
7575
acell = neuroml.utils.component_factory("Cell", id="test_cell", validate=False) # type: neuroml.Cell
7676

7777
acell.set_spike_thresh("10mV")
78+
acell.set_init_memb_potential("-70mV")
79+
acell.set_specific_capacitance("1 uF_per_cm2")
7880

7981
soma = acell.add_segment(
8082
prox=[0, 0, 0, 15],
@@ -159,6 +161,8 @@ def test_translate_cell_to_coords(self):
159161
"""Test translate_cell_to_coords"""
160162
acell = neuroml.utils.component_factory("Cell", id="test_cell", validate=False) # type: neuroml.Cell
161163
acell.set_spike_thresh("10mV")
164+
acell.set_init_memb_potential("-70mV")
165+
acell.set_specific_capacitance("1 uF_per_cm2")
162166
soma = acell.add_segment(
163167
prox=[10, 10, 10, 15],
164168
dist=[10, 10, 10, 15],

0 commit comments

Comments
 (0)