Skip to content

Commit

Permalink
To v0.6.1; Update schema to latest - require specCap & init memb pot
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Jun 11, 2024
1 parent 259505c commit bcea5a4
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 14 deletions.
4 changes: 2 additions & 2 deletions neuroml/nml/NeuroML_v2.3.1.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -2118,8 +2118,8 @@
<xs:element name="channelDensityNonUniformNernst" type="ChannelDensityNonUniformNernst" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="channelDensityNonUniformGHK" type="ChannelDensityNonUniformGHK" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="spikeThresh" type="SpikeThresh" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="specificCapacitance" type="SpecificCapacitance" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="initMembPotential" type="InitMembPotential" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="specificCapacitance" type="SpecificCapacitance" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="initMembPotential" type="InitMembPotential" minOccurs="1" maxOccurs="unbounded"/>
<!-- Taking this out until confirmation it's needed
<xs:element name="reversalPotential" type="ReversalPotential" minOccurs="0" maxOccurs="unbounded"/>-->
</xs:sequence>
Expand Down
22 changes: 11 additions & 11 deletions neuroml/nml/nml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

#
# Generated Tue Jun 11 13:57:16 2024 by generateDS.py version 2.43.3.
# Generated Tue Jun 11 14:00:16 2024 by generateDS.py version 2.43.3.
# Python 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0]
#
# Command line options:
Expand Down Expand Up @@ -24597,10 +24597,10 @@ class MembraneProperties(BaseWithoutId):
"specific_capacitances",
"SpecificCapacitance",
1,
1,
0,
{
"maxOccurs": "unbounded",
"minOccurs": "0",
"minOccurs": "1",
"name": "specificCapacitance",
"type": "SpecificCapacitance",
},
Expand All @@ -24610,10 +24610,10 @@ class MembraneProperties(BaseWithoutId):
"init_memb_potentials",
"InitMembPotential",
1,
1,
0,
{
"maxOccurs": "unbounded",
"minOccurs": "0",
"minOccurs": "1",
"name": "initMembPotential",
"type": "InitMembPotential",
},
Expand All @@ -24635,8 +24635,8 @@ def __init__(
channel_density_non_uniform_nernsts: "list of ChannelDensityNonUniformNernst(s) (optional)" = None,
channel_density_non_uniform_ghks: "list of ChannelDensityNonUniformGHK(s) (optional)" = None,
spike_threshes: "list of SpikeThresh(s) (required)" = None,
specific_capacitances: "list of SpecificCapacitance(s) (optional)" = None,
init_memb_potentials: "list of InitMembPotential(s) (optional)" = None,
specific_capacitances: "list of SpecificCapacitance(s) (required)" = None,
init_memb_potentials: "list of InitMembPotential(s) (required)" = None,
extensiontype_=None,
gds_collector_=None,
**kwargs_,
Expand Down Expand Up @@ -25088,13 +25088,13 @@ def validate_(self, gds_collector, recursive=False):
self.gds_check_cardinality_(
self.specific_capacitances,
"specific_capacitances",
min_occurs=0,
min_occurs=1,
max_occurs=9999999,
)
self.gds_check_cardinality_(
self.init_memb_potentials,
"init_memb_potentials",
min_occurs=0,
min_occurs=1,
max_occurs=9999999,
)
if recursive:
Expand Down Expand Up @@ -47930,8 +47930,8 @@ def __init__(
channel_density_non_uniform_nernsts: "list of ChannelDensityNonUniformNernst(s) (optional)" = None,
channel_density_non_uniform_ghks: "list of ChannelDensityNonUniformGHK(s) (optional)" = None,
spike_threshes: "list of SpikeThresh(s) (required)" = None,
specific_capacitances: "list of SpecificCapacitance(s) (optional)" = None,
init_memb_potentials: "list of InitMembPotential(s) (optional)" = None,
specific_capacitances: "list of SpecificCapacitance(s) (required)" = None,
init_memb_potentials: "list of InitMembPotential(s) (required)" = None,
channel_density_nernst_ca2s: "list of ChannelDensityNernstCa2(s) (optional)" = None,
gds_collector_=None,
**kwargs_,
Expand Down
45 changes: 45 additions & 0 deletions neuroml/test/test_nml.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ def test_info(self):
"""Test getting member info."""
cell = neuroml.Cell(id="testcell")
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
info = cell.info()
self.assertRegex(info, "morphology")
self.assertRegex(info, "biophysical_properties")
Expand Down Expand Up @@ -214,6 +216,8 @@ def test_parentinfo(self):
"""Test the parent info method"""
cell = neuroml.Cell(id="testcell")
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
info = cell.parentinfo()
self.assertRegex(info, "NeuroMLDocument")

Expand All @@ -240,6 +244,8 @@ def test_add_segment(self):
"""Test adding a segment."""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
segment = new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand All @@ -259,6 +265,8 @@ def test_add_segment_no_group(self):
"""Test adding a segment but without a group."""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
segment = new_cell.add_segment(
(0, 0, 0, 20), (20, 0, 0, 20), name="soma", group_id=None, seg_type="soma"
)
Expand All @@ -274,6 +282,7 @@ def test_setting_init_memb_potential(self):
"""Test adding initial membrane potential."""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand All @@ -296,6 +305,8 @@ def test_setting_spike_thresh(self):
seg_type="soma",
)
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")

self.assertIsNone(new_cell.validate(True))

Expand Down Expand Up @@ -327,6 +338,8 @@ def test_setting_resistivity(self):
)
new_cell.set_resistivity("2000 ohm_cm")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
self.assertIsNone(new_cell.validate(True))

@unittest.expectedFailure
Expand All @@ -347,6 +360,8 @@ def test_setting_specific_capacitance(self):
"""Test setting the specific_capacitance."""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand All @@ -362,6 +377,8 @@ def test_setting_specific_capacitance_should_fail(self):
"""Test setting the specific_capacitance."""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand All @@ -376,6 +393,8 @@ def test_setting_channel_density(self):
"""Test setting the channel_density."""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand Down Expand Up @@ -421,6 +440,8 @@ def test_setting_channel_density_v(self):
"""Test setting the channel_density."""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand Down Expand Up @@ -469,6 +490,8 @@ def test_setting_channel_density_should_fail(self):
"""Test setting the channel_density."""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand Down Expand Up @@ -502,6 +525,7 @@ def test_setting_membrane_property(self):
"""Test adding a new membrane property"""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand All @@ -524,6 +548,8 @@ def test_setting_intracellular_property(self):
"""Test adding a new membrane property"""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
new_cell.add_segment(
(0, 0, 0, 20),
(20, 0, 0, 20),
Expand All @@ -550,6 +576,8 @@ def test_simple_cell(self):
# test with component_factory
cell = component_factory("Cell", id="simple_cell")
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
cell.notes = "NeuroML cell created by CellBuilder"

# Add soma segment
Expand All @@ -571,6 +599,8 @@ def test_complex_cell(self):
# with component_factory
cell = component_factory("Cell", id="complex_cell") # type: neuroml.Cell
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
cell.notes = "NeuroML cell created by CellBuilder"

# Add soma segment
Expand Down Expand Up @@ -600,6 +630,8 @@ def test_component_factory_create_cell(self):
"""Test cell creation"""
new_cell = component_factory("Cell", id="test_cell")
new_cell.set_spike_thresh("40mV")
new_cell.set_init_memb_potential("-70mV")
new_cell.set_specific_capacitance("1 uF_per_cm2")
self.assertIsInstance(new_cell, neuroml.Cell)

# cell does not have segments: is invalid NeuroML
Expand All @@ -611,6 +643,8 @@ def test_add_unbranched_segments(self):
# test with component_factory
cell = component_factory("Cell", id="simple_cell")
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
cell.notes = "NeuroML cell created by CellBuilder"

# Add soma segment
Expand Down Expand Up @@ -647,6 +681,8 @@ def test_optimise_segment_group(self):
"""Test `optimise_segment_group`"""
cell = component_factory("Cell", id="simple_cell") # type: neuroml.Cell
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
cell.notes = "NeuroML cell created by CellBuilder"

# Add soma segment
Expand Down Expand Up @@ -688,6 +724,8 @@ def test_create_unbranched_segment_group_branches(self):
"Test create_unbranched_segment_group_branches"
cell = component_factory("Cell", id="simple_cell") # type: neuroml.Cell
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
cell.notes = "NeuroML cell created by CellBuilder"

# Add soma segment
Expand Down Expand Up @@ -758,6 +796,8 @@ def test_morphinfo(self):
# with component_factory
cell = component_factory("Cell", id="complex_cell") # type: neuroml.Cell
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
cell.notes = "NeuroML cell created by CellBuilder"

# Add soma segment
Expand Down Expand Up @@ -797,3 +837,8 @@ def test_class_hierarchy(self):
print(hier)
print()
print_hierarchy(hier)

if __name__ == "__main__":
ta = TestNML()

ta.test_add_segment()
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = libNeuroML
version = 0.6.0
version = 0.6.1
author_email = vellamike@gmail.com, p.gleeson@gmail.com
author = libNeuroML authors and contributors
description = A Python library for working with NeuroML descriptions of neuronal models
Expand Down

0 comments on commit bcea5a4

Please sign in to comment.