diff --git a/neuroml/nml/NeuroML_v2.3.1.xsd b/neuroml/nml/NeuroML_v2.3.1.xsd index 877edef..741f1e8 100644 --- a/neuroml/nml/NeuroML_v2.3.1.xsd +++ b/neuroml/nml/NeuroML_v2.3.1.xsd @@ -2118,8 +2118,8 @@ - - + + diff --git a/neuroml/nml/nml.py b/neuroml/nml/nml.py index cec507f..dc3a5bc 100644 --- a/neuroml/nml/nml.py +++ b/neuroml/nml/nml.py @@ -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: @@ -24597,10 +24597,10 @@ class MembraneProperties(BaseWithoutId): "specific_capacitances", "SpecificCapacitance", 1, - 1, + 0, { "maxOccurs": "unbounded", - "minOccurs": "0", + "minOccurs": "1", "name": "specificCapacitance", "type": "SpecificCapacitance", }, @@ -24610,10 +24610,10 @@ class MembraneProperties(BaseWithoutId): "init_memb_potentials", "InitMembPotential", 1, - 1, + 0, { "maxOccurs": "unbounded", - "minOccurs": "0", + "minOccurs": "1", "name": "initMembPotential", "type": "InitMembPotential", }, @@ -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_, @@ -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: @@ -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_, diff --git a/neuroml/test/test_nml.py b/neuroml/test/test_nml.py index 88de884..d01176b 100644 --- a/neuroml/test/test_nml.py +++ b/neuroml/test/test_nml.py @@ -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") @@ -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") @@ -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), @@ -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" ) @@ -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), @@ -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)) @@ -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 @@ -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), @@ -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), @@ -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), @@ -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), @@ -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), @@ -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), @@ -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), @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -797,3 +837,8 @@ def test_class_hierarchy(self): print(hier) print() print_hierarchy(hier) + +if __name__ == "__main__": + ta = TestNML() + + ta.test_add_segment() \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 9cb6342..7f402f1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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