Skip to content

Commit 5b3b4ac

Browse files
committed
More tests
1 parent 61f266b commit 5b3b4ac

5 files changed

Lines changed: 459 additions & 4 deletions

File tree

NeuroML/LEMS_SomaTest2.xml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<Lems>
2+
3+
4+
<!-- Specify which component to run -->
5+
<Target component="Sim_IClamp" reportFile="report.Soma.__SIMULATOR__.txt"/>
6+
7+
<!-- Include core NeuroML2 ComponentType definitions -->
8+
<Include file="Cells.xml"/>
9+
<Include file="Networks.xml"/>
10+
<Include file="Simulation.xml"/>
11+
12+
<Include file="PyNN.xml"/>
13+
14+
<include href="leak.channel.nml"/>
15+
<include href="kqt1.channel.nml"/>
16+
<include href="CaDynamics.nml"/>
17+
18+
19+
<pulseGenerator id="stim" delay="100ms" duration="500ms" amplitude="5pA"/>
20+
21+
<cell id="TestCell">
22+
23+
<morphology id="morphology">
24+
<segment id="0" name="soma">
25+
<proximal x="0.0" y="0.0" z="0.0" diameter="12.922774419120067"/>
26+
<distal x="0.0" y="12.922774419120067" z="0.0" diameter="12.922774419120067"/>
27+
</segment>
28+
<segmentGroup id="soma_group" neuroLexId="GO:0043025">
29+
<notes>Default soma segment group for the cell</notes>
30+
<member segment="0"/>
31+
</segmentGroup>
32+
<segmentGroup id="all">
33+
<notes>Default segment group for all segments in the cell</notes>
34+
<member segment="0"/>
35+
</segmentGroup>
36+
</morphology>
37+
<biophysicalProperties id="biophys">
38+
<membraneProperties>
39+
<channelDensity id="leak_chans" ionChannel="leak" condDensity="0.00021247533768401888 S_per_cm2" erev="-89.57mV" ion="non_specific"/>
40+
<channelDensity id="kqt1_chans" ionChannel="kqt1" condDensity="0.000303536 S_per_cm2" erev="-80mV" ion="k"/>
41+
42+
43+
<spikeThresh value="0mV"/>
44+
<specificCapacitance value="1.5 uF_per_cm2"/>
45+
<initMembPotential value="-70mV"/>
46+
</membraneProperties>
47+
<intracellularProperties>
48+
<species id="ca" concentrationModel="CaDynamics_VA5" ion="ca" initialConcentration=".0001 mM" initialExtConcentration="2 mM"/>
49+
<resistivity value="0.1 kohm_cm"/>
50+
</intracellularProperties>
51+
</biophysicalProperties>
52+
</cell>
53+
54+
<network id="TestNet" type="networkWithTemperature" temperature="6.3degC">
55+
56+
<property tag="recommended_dt_ms" value="0.025"/>
57+
<property tag="recommended_duration_ms" value="11000.0"/>
58+
59+
<population id="pop0" component="TestCell" size="1" type="populationList">
60+
<property tag="color" value="0 0.5 1"/>
61+
<property tag="region" value="Worm"/>
62+
<instance id="0">
63+
<location x="966.453535692138757" y="44.073259917535268" z="7.491470058587191"/>
64+
</instance>
65+
66+
</population>
67+
68+
<inputList id="input0" population="pop0" component="stim">
69+
<input id="0" target="../pop0/0/TestCell" destination="synapses"/>
70+
</inputList>
71+
72+
</network>
73+
74+
<Simulation id="Sim_IClamp" length="700.0ms" step="0.01ms" target="TestNet" seed="12345"> <!-- Note seed: ensures same random numbers used every run -->
75+
76+
<!--
77+
<Display id="pop_m_h" title="Plots of m" timeScale="1ms" xmin="-50.0" xmax="750" ymin="-.1" ymax="1.1">
78+
79+
<Line id="egl19_m_q" quantity="pop0/0/TestCell/biophys/membraneProperties/egl19_chans/egl19/m/q" scale="1" color="#0534e4" timeScale="1ms"/>
80+
<Line id="egl19_h_q" quantity="pop0/0/TestCell/biophys/membraneProperties/egl19_chans/egl19/h/q" scale="1" color="#fff4e4" timeScale="1ms"/>
81+
82+
<Line id="slo1egl19_m_egl19" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/m_egl19" scale="1" color="#ff3333" timeScale="1ms"/>
83+
<Line id="slo1egl19_m" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/q" scale="1" color="#ff33ff" timeScale="1ms"/>
84+
85+
<Line id="slo1egl19_kcm2" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/kcm2" scale="1" color="#faaaaf" timeScale="1ms"/>
86+
<Line id="slo1egl19_kom2" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/kom2" scale="1" color="#444aaf" timeScale="1ms"/>
87+
<Line id="slo1egl19_kop2" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/kop2" scale="1" color="#4999af" timeScale="1ms"/>
88+
89+
</Display>
90+
91+
<Display id="pop_caConc" title="Plots of caConc" timeScale="1ms" xmin="-50.0" xmax="750" ymin="0" ymax="6e-4">
92+
<Line id="pop_ca" quantity="pop0/0/TestCell/caConc" scale="1" color="#ff4f33" timeScale="1ms"/>
93+
<Line id="caconc_eca" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/caConc" scale="1" color="#faaaaf" timeScale="1ms"/>
94+
95+
</Display>
96+
97+
<Display id="pop_eca" title="Plots of eca" timeScale="1ms" xmin="-50.0" xmax="750" ymin="0" ymax="130">
98+
<Line id="pop_ca" quantity="pop0/0/TestCell/biophys/membraneProperties/egl19_chans/erev" scale="1mV" color="#ff4f33" timeScale="1ms"/>
99+
<Line id="slo1egl19_eca" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/eca" scale="1" color="#faaaaf" timeScale="1ms"/>
100+
</Display>
101+
-->
102+
103+
<Display id="pop_v" title="Plots of pop_v" timeScale="1ms" xmin="-50.0" xmax="750" ymin="-92" ymax="0">
104+
<Line id="v" quantity="pop0/0/TestCell/v" scale="1mV" color="#85ff96" timeScale="1ms"/>
105+
</Display>
106+
107+
<OutputFile id="Sim_v_dat" fileName="Soma.v.dat">
108+
<OutputColumn id="pop_v" quantity="pop0/0/TestCell/v"/>
109+
</OutputFile>
110+
<!--
111+
<OutputFile id="pop_caConc_dat" fileName="Soma.ca.dat">
112+
<OutputColumn id="pop_caConc" quantity="pop0/0/TestCell/caConc"/>
113+
</OutputFile>
114+
115+
<OutputFile id="pop_eca_dat" fileName="Soma.eca.dat">
116+
<OutputColumn id="pop_eca" quantity="pop0/0/TestCell/biophys/membraneProperties/egl19_chans/erev"/>
117+
</OutputFile>
118+
119+
<OutputFile id="pop_chans" fileName="Soma.chans.dat">
120+
<OutputColumn id="0" quantity="pop0/0/TestCell/biophys/membraneProperties/egl19_chans/egl19/m/q"/>
121+
<OutputColumn id="1" quantity="pop0/0/TestCell/biophys/membraneProperties/egl19_chans/egl19/h/q"/>
122+
<OutputColumn id="2" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/m_egl19"/>
123+
<OutputColumn id="3" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/q"/>
124+
</OutputFile>
125+
126+
<OutputFile id="pop_vars" fileName="Soma.vars.dat">
127+
<OutputColumn id="0" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/kcm2"/>
128+
<OutputColumn id="1" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/kom2"/>
129+
<OutputColumn id="2" quantity="pop0/0/TestCell/biophys/membraneProperties/slo1egl19_chans/slo1egl19/m/steadyState/kop2"/>
130+
</OutputFile>
131+
-->
132+
</Simulation>
133+
134+
</Lems>

NeuroML/compare2.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from pyneuroml import pynml
2+
from pyneuroml.plot.Plot import generate_plot
3+
from matplotlib import pyplot as plt
4+
5+
plots = {
6+
"Membrane potentials": ["Soma.v.dat", "../Soma.si.dat"],
7+
}
8+
9+
for p in plots:
10+
files = plots[p]
11+
12+
times = []
13+
xs = []
14+
labels = []
15+
linewidths = []
16+
17+
d, indices = pynml.reload_standard_dat_file(files[0])
18+
for i in indices:
19+
if i != "t":
20+
times.append(d["t"])
21+
xs.append(d[i])
22+
labels.append("jnml %i" % i if len(d) > 2 else "jnml")
23+
linewidths.append(3)
24+
25+
d, indices = pynml.reload_standard_dat_file(files[1])
26+
27+
for i in indices:
28+
if i != "t":
29+
times.append(d["t"])
30+
xs.append(d[i])
31+
labels.append("nrn %i" % i if len(d) > 2 else "nrn")
32+
linewidths.append(1)
33+
34+
generate_plot(
35+
times,
36+
xs,
37+
p,
38+
labels=labels,
39+
linewidths=linewidths,
40+
show_plot_already=False,
41+
)
42+
43+
44+
plt.show()

NeuroML/kqt1.channel.nml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.1.xsd" id="kqt1">
22
<notes>An ion channel from cell AIY from Nicoletti et al. 2024</notes>
33

4-
54
<ionChannelHH id="kqt1" species="k" conductance="10 pS">
65
<gate id="m" instances="1" type="gateHHtauInf">
76
<timeCourse type="kqt1_m_tau"/>
@@ -10,7 +9,6 @@
109
<gate id="s" instances="1" type="gateHHtauInf">
1110
<timeCourse type="kqt1_s_tau"/>
1211
<steadyState type="kqt1_s_inf"/>
13-
1412
</gate>
1513
</ionChannelHH>
1614

@@ -24,7 +22,6 @@
2422
</Dynamics>
2523
</ComponentType>
2624

27-
2825
<ComponentType name="kqt1_m_tau" extends="baseVoltageDepTime">
2926
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
3027
<Constant name="TIME_SCALE" dimension="time" value="1 ms"/>
@@ -39,7 +36,6 @@
3936
</Dynamics>
4037
</ComponentType>
4138

42-
4339
<ComponentType name="kqt1_s_inf" extends="baseVoltageDepVariable">
4440
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
4541
<Constant name="s1" dimension="none" value="0.41"/>
@@ -68,4 +64,5 @@
6864
value="(p1tskqt1+(p2tskqt1/(1+((V-p3tskqt1)/p4tskqt1)^2))) * TIME_SCALE"/>
6965
</Dynamics>
7066
</ComponentType>
67+
7168
</neuroml>

NeuroML/test2.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
# Format the code
5+
ruff format *.py
6+
7+
./clean.sh || true
8+
9+
cd ..
10+
nrniv Test_Soma2.hoc
11+
cd -
12+
13+
jnml LEMS_SomaTest2.xml -nogui
14+
15+
python compare2.py

0 commit comments

Comments
 (0)