Skip to content

Commit 19ee099

Browse files
Merge pull request #343 from NeuroML/experimental
Minor fixes and tests for XPP export; to v1.2.10
2 parents 92c1056 + 81ee57f commit 19ee099

File tree

8 files changed

+127
-9
lines changed

8 files changed

+127
-9
lines changed

.github/workflows/python-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- name: Set up Python
23-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v5
2424
with:
2525
python-version: '3.x'
2626
- name: Install dependencies

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,5 @@ arm64
171171
.vscode
172172
/tests/pyneuroml_20*
173173
/pyneuroml/xppaut/report.txt
174+
/examples/test_data/xppaut/fhn_2.ode
175+
/examples/test_data/xppaut/fhn_brain.py

examples/test_data/xppaut/fhn.ode

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Forced Fitzhugh-Nagumo fhn.ode
2+
dv/dt = f(v)-w+s(t)+I_0
3+
dw/dt = eps*(v-gamma*w)
4+
f(v)=v*(1-v)*(v-a)
5+
s(t)=al*sin(omega*t)
6+
param a=.25,eps=.05,gamma=1,I_0=.25
7+
param al=0,omega=2
8+
@ total=100,dt=.2,xhi=100
9+
@ nplot=2,xp2=t,yp2=w
10+
done

examples/test_data/xppaut/nca.ode

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Excitatory cortical neurons, normal [Ca].
2+
#
3+
number Cm=1.0
4+
number pms=3,pns=4
5+
number VNa=55.0,t_tauh=-40.5,t_taun=-27.0
6+
number thetaa=-50.0,sigmaa=20.0,thetab=-80.0,sigmab=-6.0,tauBs=15.0
7+
number thetam=-30.0,sigmam=9.5,sigmah=-7.0,sigman=10.0,sigmaz=5.0
8+
number VCa=120
9+
number thetar=-20.0,sigmar=10.0,thetac=-30,sigmac=7
10+
number pwrc=1,pwrq=4
11+
#
12+
p gNa=35.0,gKdr=6.0,gL=0.05,Iapp=1.0
13+
p gA=1.4,gNaP=0.2,gZ=1.0
14+
p thetaz=-39.0,tauZs=75.0
15+
p phi=10.0, thetah=-45.0
16+
p thetan=-35.0,thetap=-41.0,sigmap=3.0
17+
p VK=-90.0,VL=-70.0
18+
p gCa=0.08,gKCa=10.0,gKAHP=5
19+
p tauRs=1.0,aq=2,ac=6,tauq=450,tauCa=13,uuCa=0.13,tauKc=2
20+
#
21+
GAMMAF(VV,theta,sigma)=1.0/(1.0+exp(-(VV-theta)/sigma))
22+
ZFUNC(AA,CA,zz)=1/(1+(AA^zz/CA^zz))
23+
#
24+
VVs'=(-gL*(VVs-VL)-INa-INaP-IKdr-IA-Iz-ICa-IKC-IAHP+Iappx)/Cm
25+
hhs'=phi*(GAMMAF(VVs,thetah,sigmah)-hhs)/(1.0+7.5*GAMMAF(VVs,t_tauh,-6.0))
26+
nns'=phi*(GAMMAF(VVs,thetan,sigman)-nns)/(1.0+5.0*GAMMAF(VVs,t_taun,-15.0))
27+
bbs'=(GAMMAF(VVs,thetab,sigmab)-bbs)/tauBs
28+
zzs'=(GAMMAF(VVs,thetaz,sigmaz)-zzs)/tauZs
29+
rrs'=(GAMMAF(VVs,thetar,sigmar)-rrs)/tauRs
30+
ccs'=(GAMMAF(VVs,thetac,sigmac)-ccs)/tauKc
31+
qqs'=(ZFUNC(aq,Ca,pwrq)-qqs)/tauq
32+
Ca'=-uuCa*ICa-Ca/tauCa
33+
#
34+
Iappx=Iapp
35+
Minfs=GAMMAF(VVs,thetam,sigmam)
36+
Pinfs=GAMMAF(VVs,thetap,sigmap)
37+
Ainfs=GAMMAF(VVs,thetaa,sigmaa)
38+
mKCa=ZFUNC(ac,Ca,pwrc)
39+
#
40+
INa=gNa*(Minfs^pms)*hhs*(VVs-VNa)
41+
INaP=gNaP*Pinfs*(VVs-VNa)
42+
IKdr=gKdr*(nns^pns)*(VVs-VK)
43+
IA=gA*Ainfs^3*bbs*(VVs-VK)
44+
Iz=gZ*zzs*(VVs-VK)
45+
ICa=gCa*rrs^2*(VVs-VCa)
46+
IKC=gKCa*mKCa*ccs*(VVs-VK)
47+
IAHP=gKAHP*qqs*(VVs-VK)
48+
#
49+
VVs(0)=-71.962
50+
hhs(0)=0.979199
51+
nns(0)=0.0242166
52+
bbs(0)=0.207565
53+
zzs(0)=0.0013689
54+
Ca[0]=0.000787
55+
rrs(0)=0.005507
56+
ccs(0)=0.002486
57+
qqs(0)=0.0
58+
#
59+
@ MAXSTOR=800000
60+
@ BACK=Black
61+
@ XP=T
62+
@ YP=VVs
63+
@ AXES=2
64+
@ TOTAL=500.0
65+
@ DT=0.05
66+
@ NJMP=1
67+
@ T0=0.0
68+
@ TRANS=0.0
69+
@ NMESH=40
70+
@ METH=rungekutta
71+
@ DTMIN=0.001
72+
@ DTMAX=1.0
73+
@ TOLER=0.00001
74+
@ BOUND=10000.0
75+
@ DELAY=0
76+
@ XLO=0.0, XHI=500.0, YLO=-90.0, YHI=30.0
77+
@ NTST=50,NMAX=2000,NPR=50
78+
@ DS=0.02,DSMIN=0.001,DSMAX=0.5
79+
@ PARMIN=-10,PARMAX=50,NORMMIN=0.0,NORMMAX=10000.0
80+
@ AUTOVAR=VVs1,AUTOXMIN=-10.0,AUTOXMAX=50.0,AUTOYMIN=-90.0,AUTOYMAX=50.0
81+
done

examples/test_data/xppaut/wc.ode

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# wilson-cowan
2+
f(u)=1/(1+exp(-1*(u)))
3+
par aee=10,aie=8,aei=12,aii=3,ze=.2,zi=4
4+
par tau=1
5+
i_e(t)=ie0+ie1*sin(w*t)
6+
i_i(t)=ii0+ii1*sin(w*t)
7+
par ie0=0,ie1=0,w=.25
8+
par ii0=0,ii1=0
9+
init u=.1,v=.05
10+
u'=-u+f(aee*u-aie*v-ze+i_e(t))
11+
v'=(-v+f(aei*u-aii*v-zi+i_i(t)))/tau
12+
@ total=40
13+
@ xp=u,yp=v,xlo=-.1,xhi=1,ylo=-.1,yhi=1
14+
done

pyneuroml/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from datetime import datetime
2424
from pathlib import Path
2525

26-
import libsedml
2726
import neuroml
2827
import numpy
2928
import pyneuroml.utils.misc
@@ -556,6 +555,7 @@ def get_model_file_list(
556555
lems_def_dir = get_model_file_list(inc, filelist, rootdir, lems_def_dir)
557556

558557
elif rootfile.endswith(".sedml"):
558+
import libsedml
559559
if pathlib.Path(rootfile).is_absolute():
560560
rootdoc = libsedml.readSedMLFromFile(rootfile)
561561
else:

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = pyNeuroML
3-
version = 1.2.9
3+
version = 1.2.10
44
author = Padraig Gleeson
55
author_email = [email protected]
66
url = https://github.com/NeuroML/pyNeuroML
@@ -31,6 +31,7 @@ install_requires =
3131
graphviz
3232
typing; python_version<"3.5"
3333
lxml
34+
sympy
3435
ppft[dill]
3536

3637
packages = find:

test-ghactions.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ echo "## Multi-validate with jNeuroML"
6868
pynml -validate *.channel.nml
6969

7070

71+
echo
72+
echo "################################################"
73+
echo "## Test XPP"
74+
75+
pynml-xpp test_data/xppaut/fhn.ode
76+
pynml-xpp test_data/xppaut/fhn.ode -xpp
77+
pynml-xpp test_data/xppaut/fhn.ode -lems -run
78+
pynml-xpp test_data/xppaut/wc.ode -lems -run
79+
pynml-xpp test_data/xppaut/nca.ode -lems -run
80+
7181
echo
7282
echo "################################################"
7383
echo "## Test some conversions"
@@ -200,9 +210,9 @@ if [ "$run_neuron_examples" == true ]; then
200210
python tunePyr.py -tune -nogui
201211
popd
202212

203-
echo
204-
echo "################################################"
205-
echo "## Finished all tests! "
206-
echo "################################################"
207-
208213
fi
214+
215+
echo
216+
echo "################################################"
217+
echo "## Finished all tests! "
218+
echo "################################################"

0 commit comments

Comments
 (0)