Skip to content

Commit bcea5a4

Browse files
committed
To v0.6.1; Update schema to latest - require specCap & init memb pot
1 parent 259505c commit bcea5a4

File tree

4 files changed

+59
-14
lines changed

4 files changed

+59
-14
lines changed

neuroml/nml/NeuroML_v2.3.1.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,8 +2118,8 @@
21182118
<xs:element name="channelDensityNonUniformNernst" type="ChannelDensityNonUniformNernst" minOccurs="0" maxOccurs="unbounded"/>
21192119
<xs:element name="channelDensityNonUniformGHK" type="ChannelDensityNonUniformGHK" minOccurs="0" maxOccurs="unbounded"/>
21202120
<xs:element name="spikeThresh" type="SpikeThresh" minOccurs="1" maxOccurs="unbounded"/>
2121-
<xs:element name="specificCapacitance" type="SpecificCapacitance" minOccurs="0" maxOccurs="unbounded"/>
2122-
<xs:element name="initMembPotential" type="InitMembPotential" minOccurs="0" maxOccurs="unbounded"/>
2121+
<xs:element name="specificCapacitance" type="SpecificCapacitance" minOccurs="1" maxOccurs="unbounded"/>
2122+
<xs:element name="initMembPotential" type="InitMembPotential" minOccurs="1" maxOccurs="unbounded"/>
21232123
<!-- Taking this out until confirmation it's needed
21242124
<xs:element name="reversalPotential" type="ReversalPotential" minOccurs="0" maxOccurs="unbounded"/>-->
21252125
</xs:sequence>

neuroml/nml/nml.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
#
5-
# Generated Tue Jun 11 13:57:16 2024 by generateDS.py version 2.43.3.
5+
# Generated Tue Jun 11 14:00:16 2024 by generateDS.py version 2.43.3.
66
# Python 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0]
77
#
88
# Command line options:
@@ -24597,10 +24597,10 @@ class MembraneProperties(BaseWithoutId):
2459724597
"specific_capacitances",
2459824598
"SpecificCapacitance",
2459924599
1,
24600-
1,
24600+
0,
2460124601
{
2460224602
"maxOccurs": "unbounded",
24603-
"minOccurs": "0",
24603+
"minOccurs": "1",
2460424604
"name": "specificCapacitance",
2460524605
"type": "SpecificCapacitance",
2460624606
},
@@ -24610,10 +24610,10 @@ class MembraneProperties(BaseWithoutId):
2461024610
"init_memb_potentials",
2461124611
"InitMembPotential",
2461224612
1,
24613-
1,
24613+
0,
2461424614
{
2461524615
"maxOccurs": "unbounded",
24616-
"minOccurs": "0",
24616+
"minOccurs": "1",
2461724617
"name": "initMembPotential",
2461824618
"type": "InitMembPotential",
2461924619
},
@@ -24635,8 +24635,8 @@ def __init__(
2463524635
channel_density_non_uniform_nernsts: "list of ChannelDensityNonUniformNernst(s) (optional)" = None,
2463624636
channel_density_non_uniform_ghks: "list of ChannelDensityNonUniformGHK(s) (optional)" = None,
2463724637
spike_threshes: "list of SpikeThresh(s) (required)" = None,
24638-
specific_capacitances: "list of SpecificCapacitance(s) (optional)" = None,
24639-
init_memb_potentials: "list of InitMembPotential(s) (optional)" = None,
24638+
specific_capacitances: "list of SpecificCapacitance(s) (required)" = None,
24639+
init_memb_potentials: "list of InitMembPotential(s) (required)" = None,
2464024640
extensiontype_=None,
2464124641
gds_collector_=None,
2464224642
**kwargs_,
@@ -25088,13 +25088,13 @@ def validate_(self, gds_collector, recursive=False):
2508825088
self.gds_check_cardinality_(
2508925089
self.specific_capacitances,
2509025090
"specific_capacitances",
25091-
min_occurs=0,
25091+
min_occurs=1,
2509225092
max_occurs=9999999,
2509325093
)
2509425094
self.gds_check_cardinality_(
2509525095
self.init_memb_potentials,
2509625096
"init_memb_potentials",
25097-
min_occurs=0,
25097+
min_occurs=1,
2509825098
max_occurs=9999999,
2509925099
)
2510025100
if recursive:
@@ -47930,8 +47930,8 @@ def __init__(
4793047930
channel_density_non_uniform_nernsts: "list of ChannelDensityNonUniformNernst(s) (optional)" = None,
4793147931
channel_density_non_uniform_ghks: "list of ChannelDensityNonUniformGHK(s) (optional)" = None,
4793247932
spike_threshes: "list of SpikeThresh(s) (required)" = None,
47933-
specific_capacitances: "list of SpecificCapacitance(s) (optional)" = None,
47934-
init_memb_potentials: "list of InitMembPotential(s) (optional)" = None,
47933+
specific_capacitances: "list of SpecificCapacitance(s) (required)" = None,
47934+
init_memb_potentials: "list of InitMembPotential(s) (required)" = None,
4793547935
channel_density_nernst_ca2s: "list of ChannelDensityNernstCa2(s) (optional)" = None,
4793647936
gds_collector_=None,
4793747937
**kwargs_,

neuroml/test/test_nml.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def test_info(self):
178178
"""Test getting member info."""
179179
cell = neuroml.Cell(id="testcell")
180180
cell.set_spike_thresh("40mV")
181+
cell.set_init_memb_potential("-70mV")
182+
cell.set_specific_capacitance("1 uF_per_cm2")
181183
info = cell.info()
182184
self.assertRegex(info, "morphology")
183185
self.assertRegex(info, "biophysical_properties")
@@ -214,6 +216,8 @@ def test_parentinfo(self):
214216
"""Test the parent info method"""
215217
cell = neuroml.Cell(id="testcell")
216218
cell.set_spike_thresh("40mV")
219+
cell.set_init_memb_potential("-70mV")
220+
cell.set_specific_capacitance("1 uF_per_cm2")
217221
info = cell.parentinfo()
218222
self.assertRegex(info, "NeuroMLDocument")
219223

@@ -240,6 +244,8 @@ def test_add_segment(self):
240244
"""Test adding a segment."""
241245
new_cell = component_factory("Cell", id="test_cell")
242246
new_cell.set_spike_thresh("40mV")
247+
new_cell.set_init_memb_potential("-70mV")
248+
new_cell.set_specific_capacitance("1 uF_per_cm2")
243249
segment = new_cell.add_segment(
244250
(0, 0, 0, 20),
245251
(20, 0, 0, 20),
@@ -259,6 +265,8 @@ def test_add_segment_no_group(self):
259265
"""Test adding a segment but without a group."""
260266
new_cell = component_factory("Cell", id="test_cell")
261267
new_cell.set_spike_thresh("40mV")
268+
new_cell.set_init_memb_potential("-70mV")
269+
new_cell.set_specific_capacitance("1 uF_per_cm2")
262270
segment = new_cell.add_segment(
263271
(0, 0, 0, 20), (20, 0, 0, 20), name="soma", group_id=None, seg_type="soma"
264272
)
@@ -274,6 +282,7 @@ def test_setting_init_memb_potential(self):
274282
"""Test adding initial membrane potential."""
275283
new_cell = component_factory("Cell", id="test_cell")
276284
new_cell.set_spike_thresh("40mV")
285+
new_cell.set_specific_capacitance("1 uF_per_cm2")
277286
new_cell.add_segment(
278287
(0, 0, 0, 20),
279288
(20, 0, 0, 20),
@@ -296,6 +305,8 @@ def test_setting_spike_thresh(self):
296305
seg_type="soma",
297306
)
298307
new_cell.set_spike_thresh("40mV")
308+
new_cell.set_init_memb_potential("-70mV")
309+
new_cell.set_specific_capacitance("1 uF_per_cm2")
299310

300311
self.assertIsNone(new_cell.validate(True))
301312

@@ -327,6 +338,8 @@ def test_setting_resistivity(self):
327338
)
328339
new_cell.set_resistivity("2000 ohm_cm")
329340
new_cell.set_spike_thresh("40mV")
341+
new_cell.set_init_memb_potential("-70mV")
342+
new_cell.set_specific_capacitance("1 uF_per_cm2")
330343
self.assertIsNone(new_cell.validate(True))
331344

332345
@unittest.expectedFailure
@@ -347,6 +360,8 @@ def test_setting_specific_capacitance(self):
347360
"""Test setting the specific_capacitance."""
348361
new_cell = component_factory("Cell", id="test_cell")
349362
new_cell.set_spike_thresh("40mV")
363+
new_cell.set_init_memb_potential("-70mV")
364+
new_cell.set_specific_capacitance("1 uF_per_cm2")
350365
new_cell.add_segment(
351366
(0, 0, 0, 20),
352367
(20, 0, 0, 20),
@@ -362,6 +377,8 @@ def test_setting_specific_capacitance_should_fail(self):
362377
"""Test setting the specific_capacitance."""
363378
new_cell = component_factory("Cell", id="test_cell")
364379
new_cell.set_spike_thresh("40mV")
380+
new_cell.set_init_memb_potential("-70mV")
381+
new_cell.set_specific_capacitance("1 uF_per_cm2")
365382
new_cell.add_segment(
366383
(0, 0, 0, 20),
367384
(20, 0, 0, 20),
@@ -376,6 +393,8 @@ def test_setting_channel_density(self):
376393
"""Test setting the channel_density."""
377394
new_cell = component_factory("Cell", id="test_cell")
378395
new_cell.set_spike_thresh("40mV")
396+
new_cell.set_init_memb_potential("-70mV")
397+
new_cell.set_specific_capacitance("1 uF_per_cm2")
379398
new_cell.add_segment(
380399
(0, 0, 0, 20),
381400
(20, 0, 0, 20),
@@ -421,6 +440,8 @@ def test_setting_channel_density_v(self):
421440
"""Test setting the channel_density."""
422441
new_cell = component_factory("Cell", id="test_cell")
423442
new_cell.set_spike_thresh("40mV")
443+
new_cell.set_init_memb_potential("-70mV")
444+
new_cell.set_specific_capacitance("1 uF_per_cm2")
424445
new_cell.add_segment(
425446
(0, 0, 0, 20),
426447
(20, 0, 0, 20),
@@ -469,6 +490,8 @@ def test_setting_channel_density_should_fail(self):
469490
"""Test setting the channel_density."""
470491
new_cell = component_factory("Cell", id="test_cell")
471492
new_cell.set_spike_thresh("40mV")
493+
new_cell.set_init_memb_potential("-70mV")
494+
new_cell.set_specific_capacitance("1 uF_per_cm2")
472495
new_cell.add_segment(
473496
(0, 0, 0, 20),
474497
(20, 0, 0, 20),
@@ -502,6 +525,7 @@ def test_setting_membrane_property(self):
502525
"""Test adding a new membrane property"""
503526
new_cell = component_factory("Cell", id="test_cell")
504527
new_cell.set_spike_thresh("40mV")
528+
new_cell.set_specific_capacitance("1 uF_per_cm2")
505529
new_cell.add_segment(
506530
(0, 0, 0, 20),
507531
(20, 0, 0, 20),
@@ -524,6 +548,8 @@ def test_setting_intracellular_property(self):
524548
"""Test adding a new membrane property"""
525549
new_cell = component_factory("Cell", id="test_cell")
526550
new_cell.set_spike_thresh("40mV")
551+
new_cell.set_init_memb_potential("-70mV")
552+
new_cell.set_specific_capacitance("1 uF_per_cm2")
527553
new_cell.add_segment(
528554
(0, 0, 0, 20),
529555
(20, 0, 0, 20),
@@ -550,6 +576,8 @@ def test_simple_cell(self):
550576
# test with component_factory
551577
cell = component_factory("Cell", id="simple_cell")
552578
cell.set_spike_thresh("40mV")
579+
cell.set_init_memb_potential("-70mV")
580+
cell.set_specific_capacitance("1 uF_per_cm2")
553581
cell.notes = "NeuroML cell created by CellBuilder"
554582

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

576606
# Add soma segment
@@ -600,6 +630,8 @@ def test_component_factory_create_cell(self):
600630
"""Test cell creation"""
601631
new_cell = component_factory("Cell", id="test_cell")
602632
new_cell.set_spike_thresh("40mV")
633+
new_cell.set_init_memb_potential("-70mV")
634+
new_cell.set_specific_capacitance("1 uF_per_cm2")
603635
self.assertIsInstance(new_cell, neuroml.Cell)
604636

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

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

652688
# Add soma segment
@@ -688,6 +724,8 @@ def test_create_unbranched_segment_group_branches(self):
688724
"Test create_unbranched_segment_group_branches"
689725
cell = component_factory("Cell", id="simple_cell") # type: neuroml.Cell
690726
cell.set_spike_thresh("40mV")
727+
cell.set_init_memb_potential("-70mV")
728+
cell.set_specific_capacitance("1 uF_per_cm2")
691729
cell.notes = "NeuroML cell created by CellBuilder"
692730

693731
# Add soma segment
@@ -758,6 +796,8 @@ def test_morphinfo(self):
758796
# with component_factory
759797
cell = component_factory("Cell", id="complex_cell") # type: neuroml.Cell
760798
cell.set_spike_thresh("40mV")
799+
cell.set_init_memb_potential("-70mV")
800+
cell.set_specific_capacitance("1 uF_per_cm2")
761801
cell.notes = "NeuroML cell created by CellBuilder"
762802

763803
# Add soma segment
@@ -797,3 +837,8 @@ def test_class_hierarchy(self):
797837
print(hier)
798838
print()
799839
print_hierarchy(hier)
840+
841+
if __name__ == "__main__":
842+
ta = TestNML()
843+
844+
ta.test_add_segment()

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = libNeuroML
3-
version = 0.6.0
3+
version = 0.6.1
44
55
author = libNeuroML authors and contributors
66
description = A Python library for working with NeuroML descriptions of neuronal models

0 commit comments

Comments
 (0)