Skip to content

Commit

Permalink
Merge pull request NeuroML#392 from NeuroML/experimental
Browse files Browse the repository at this point in the history
Use jnml jar 0.13.1; fixes to allow for cells with external morphology/biophysicalProperties
  • Loading branch information
pgleeson authored Jun 11, 2024
2 parents 6d3acbc + 9dd24f4 commit 520c183
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ arm64
/examples/test_data/xppaut/wc_2.ode

coverage.xml
/examples/LEMS_NML2_Ex5_DetCell.sedml.omex
/examples/hhcell.swc
/examples/metadata.rdf
/tests/utils/test_translation.net.nml
6 changes: 3 additions & 3 deletions examples/LeakConductance.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ TITLE Mod file for component: Component(id=LeakConductance type=ionChannelHH)
COMMENT

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

ENDCOMMENT

Expand Down
2 changes: 1 addition & 1 deletion pyneuroml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__version__ = importlib_metadata.version("pyNeuroML")


JNEUROML_VERSION = "0.13.0"
JNEUROML_VERSION = "0.13.1"

# Define a logger for the package
logging.basicConfig(
Expand Down
8 changes: 8 additions & 0 deletions pyneuroml/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def read_neuroml2_file(
already_included: Optional[list] = None,
optimized: bool = False,
check_validity_pre_include: bool = False,
fix_external_morphs_biophys: bool = False,
) -> NeuroMLDocument:
"""Read a NeuroML2 file into a `nml.NeuroMLDocument`
Expand All @@ -49,6 +50,8 @@ def read_neuroml2_file(
:type optimized: bool
:param check_validity_pre_include: check each file for validity before including
:type check_validity_pre_include: bool
: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
:type fix_external_morphs_biophys: bool
:returns: nml.NeuroMLDocument object containing the read NeuroML file(s)
"""
if already_included is None:
Expand Down Expand Up @@ -125,9 +128,14 @@ def read_neuroml2_file(
for include in incl_to_remove:
nml2_doc.includes.remove(include)

if fix_external_morphs_biophys:
from neuroml.utils import fix_external_morphs_biophys_in_cell
fix_external_morphs_biophys_in_cell(nml2_doc)

return nml2_doc



def write_neuroml2_file(
nml2_doc: NeuroMLDocument,
nml2_file_name: str,
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion pyneuroml/utils/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def summary(

if nml2_doc is None:
nml2_file_name = sys.argv[1]
nml2_doc = read_neuroml2_file(nml2_file_name, include_includes=verbose)
nml2_doc = read_neuroml2_file(nml2_file_name, include_includes=verbose, fix_external_morphs_biophys=True)

info = nml2_doc.summary(show_includes=False)

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pyNeuroML
version = 1.2.15
version = 1.3.0
author = Padraig Gleeson
author_email = [email protected]
url = https://github.com/NeuroML/pyNeuroML
Expand Down
4 changes: 4 additions & 0 deletions tests/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def test_rotate_cell(self):
acell = neuroml.utils.component_factory("Cell", id="test_cell", validate=False) # type: neuroml.Cell

acell.set_spike_thresh("10mV")
acell.set_init_memb_potential("-70mV")
acell.set_specific_capacitance("1 uF_per_cm2")

soma = acell.add_segment(
prox=[0, 0, 0, 15],
Expand Down Expand Up @@ -159,6 +161,8 @@ def test_translate_cell_to_coords(self):
"""Test translate_cell_to_coords"""
acell = neuroml.utils.component_factory("Cell", id="test_cell", validate=False) # type: neuroml.Cell
acell.set_spike_thresh("10mV")
acell.set_init_memb_potential("-70mV")
acell.set_specific_capacitance("1 uF_per_cm2")
soma = acell.add_segment(
prox=[10, 10, 10, 15],
dist=[10, 10, 10, 15],
Expand Down

0 comments on commit 520c183

Please sign in to comment.