Skip to content

Commit b1c7be2

Browse files
polinpolin
polin
authored and
polin
committed
Fixed issues
1 parent e2f0f47 commit b1c7be2

35 files changed

+225516
-1
lines changed

example.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

maketrace.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Created on Thu Nov 19 13:22:12 2020
5+
6+
@author: adam
7+
"""
8+
import os.path
9+
import json
10+
import matplotlib.pyplot as plt
11+
import numpy as np
12+
13+
dirs1 = 't42_data'
14+
15+
ndends = 1 + 20
16+
17+
apicnum = 6
18+
19+
20+
starttime = 300
21+
22+
asBatch = False
23+
24+
if asBatch:
25+
filename1 = dirs1 + '/t42_0' + '.json'
26+
else:
27+
filename1 = 'model_output.json'
28+
29+
30+
31+
if os.path.isfile(filename1):
32+
with open(filename1) as f:
33+
data = json.load(f)
34+
35+
pyrind = data['net']['pops']['PYR_pop']['cellGids'][0]
36+
x1 = np.array(data['simData']['V_soma']['cell_' + str(pyrind)])
37+
x1all = np.zeros(x1.shape[0]*ndends).reshape(x1.shape[0],ndends)
38+
x1all[:,0] = x1all[:,0] + x1
39+
l1 = [key for key, val in data['simData'].items()
40+
if (key[0:6]=='V_apic' and 'cell_' + str(pyrind) in val)]
41+
42+
for x, xval1 in enumerate(l1):
43+
x1 = np.array(data['simData'][xval1]['cell_' + str(pyrind)])
44+
x1all[:,x+1] = x1all[:,x+1] + x1
45+
46+
x1all = x1all - x1all[int(starttime-1),:]
47+
48+
plt.figure('traces2')
49+
plt.xlim(0,200)
50+
plt.plot(x1all[int(starttime-20):,0], 'k' , linewidth = 6, label = 'soma')
51+
plt.plot(x1all[int(starttime-20):,apicnum], 'xkcd:light blue', linewidth = 6, label = 'apical')
52+
pltaxis = True
53+
54+
if pltaxis:
55+
plt.grid(b=True, which='major')
56+
plt.minorticks_on()
57+
plt.grid(b=True, which='minor')
58+
plt.ylabel('membrane potential (mV)')
59+
plt.xlabel('time (ms)')
60+
else:
61+
plt.axis('off')
62+
63+
if asBatch:
64+
plt.savefig(dirs1 + '/traces2' + '.png', transparent = True)
65+
else:
66+
plt.savefig('traces2' + '.png', transparent = True)

mechanisms/DetAMPANMDA.mod

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
COMMENT
2+
/**
3+
* @file DetAMPANMDA.mod
4+
* @brief Adapted from ProbAMPANMDA_EMS.mod by Eilif, Michael and Srikanth
5+
* @author chindemi
6+
* @date 2014-05-25
7+
* @remark Copyright © BBP/EPFL 2005-2014; All rights reserved. Do not distribute without further notice.
8+
*/
9+
ENDCOMMENT
10+
11+
12+
TITLE AMPA and NMDA receptor with presynaptic short-term plasticity
13+
14+
15+
COMMENT
16+
AMPA and NMDA receptor conductance using a dual-exponential profile
17+
presynaptic short-term plasticity based on Fuhrmann et al. 2002, deterministic
18+
version.
19+
ENDCOMMENT
20+
21+
22+
NEURON {
23+
THREADSAFE
24+
25+
POINT_PROCESS DetAMPANMDA
26+
RANGE tau_r_AMPA, tau_d_AMPA, tau_r_NMDA, tau_d_NMDA
27+
RANGE Use, u, Dep, Fac, u0, mg, NMDA_ratio
28+
RANGE i, i_AMPA, i_NMDA, g_AMPA, g_NMDA, g, e
29+
NONSPECIFIC_CURRENT i
30+
RANGE synapseID, verboseLevel
31+
}
32+
33+
34+
PARAMETER {
35+
tau_r_AMPA = 0.2 (ms) : Dual-exponential conductance profile
36+
tau_d_AMPA = 1.7 (ms) : IMPORTANT: tau_r < tau_d
37+
tau_r_NMDA = 9.0 (ms) : Dual-exponential conductance profile (from Andrasfalvy and Magee 2001)
38+
tau_d_NMDA = 61.0 (ms) : IMPORTANT: tau_r < tau_d (from Andrasfalvy and Magee 2001)
39+
Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values)
40+
Dep = 100 (ms) : Relaxation time constant from depression
41+
Fac = 10 (ms) : Relaxation time constant from facilitation
42+
e = 0 (mV) : AMPA and NMDA reversal potential
43+
mg = 1 (mM) : Initial concentration of mg2+
44+
mggate
45+
gmax = .001 (uS) : Weight conversion factor (from nS to uS)
46+
u0 = 0 : Initial value of u, which is the running value of Use
47+
NMDA_ratio = 1.22 (1) : The peak ratio of NMDA to AMPA (from Myme et al. 2003)
48+
synapseID = 0
49+
verboseLevel = 0
50+
}
51+
52+
53+
ASSIGNED {
54+
v (mV)
55+
i (nA)
56+
i_AMPA (nA)
57+
i_NMDA (nA)
58+
g_AMPA (uS)
59+
g_NMDA (uS)
60+
g (uS)
61+
factor_AMPA
62+
factor_NMDA
63+
}
64+
65+
STATE {
66+
A_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_r_AMPA
67+
B_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_d_AMPA
68+
A_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_r_NMDA
69+
B_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_d_NMDA
70+
}
71+
72+
73+
INITIAL{
74+
LOCAL tp_AMPA, tp_NMDA
75+
76+
A_AMPA = 0
77+
B_AMPA = 0
78+
79+
A_NMDA = 0
80+
B_NMDA = 0
81+
82+
tp_AMPA = (tau_r_AMPA*tau_d_AMPA)/(tau_d_AMPA-tau_r_AMPA)*log(tau_d_AMPA/tau_r_AMPA) :time to peak of the conductance
83+
tp_NMDA = (tau_r_NMDA*tau_d_NMDA)/(tau_d_NMDA-tau_r_NMDA)*log(tau_d_NMDA/tau_r_NMDA) :time to peak of the conductance
84+
85+
factor_AMPA = -exp(-tp_AMPA/tau_r_AMPA)+exp(-tp_AMPA/tau_d_AMPA) :AMPA Normalization factor - so that when t = tp_AMPA, gsyn = gpeak
86+
factor_AMPA = 1/factor_AMPA
87+
88+
factor_NMDA = -exp(-tp_NMDA/tau_r_NMDA)+exp(-tp_NMDA/tau_d_NMDA) :NMDA Normalization factor - so that when t = tp_NMDA, gsyn = gpeak
89+
factor_NMDA = 1/factor_NMDA
90+
}
91+
92+
93+
BREAKPOINT {
94+
SOLVE state METHOD cnexp
95+
mggate = 1 / (1 + exp(0.062 (/mV) * -(v)) * (mg / 2.62 (mM))) :mggate kinetics - Jahr & Stevens 1990 (LJP corrected)
96+
g_AMPA = gmax*(B_AMPA-A_AMPA) :compute time varying conductance as the difference of state variables B_AMPA and A_AMPA
97+
g_NMDA = gmax*(B_NMDA-A_NMDA) * mggate :compute time varying conductance as the difference of state variables B_NMDA and A_NMDA and mggate kinetics
98+
g = g_AMPA + g_NMDA
99+
i_AMPA = g_AMPA*(v-e) :compute the AMPA driving force based on the time varying conductance, membrane potential, and AMPA reversal
100+
i_NMDA = g_NMDA*(v-e) :compute the NMDA driving force based on the time varying conductance, membrane potential, and NMDA reversal
101+
i = i_AMPA + i_NMDA
102+
}
103+
104+
105+
DERIVATIVE state{
106+
A_AMPA' = -A_AMPA/tau_r_AMPA
107+
B_AMPA' = -B_AMPA/tau_d_AMPA
108+
A_NMDA' = -A_NMDA/tau_r_NMDA
109+
B_NMDA' = -B_NMDA/tau_d_NMDA
110+
}
111+
112+
113+
NET_RECEIVE (weight,weight_AMPA, weight_NMDA, R, Pr, u, tsyn (ms)){
114+
LOCAL result
115+
weight_AMPA = weight
116+
weight_NMDA = weight * NMDA_ratio
117+
118+
INITIAL{
119+
R=1
120+
u=u0
121+
tsyn=t
122+
}
123+
124+
: calc u at event-
125+
if (Fac > 0) {
126+
u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al.
127+
} else {
128+
u = Use
129+
}
130+
if(Fac > 0){
131+
u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al.
132+
}
133+
134+
R = 1 - (1-R) * exp(-(t-tsyn)/Dep) :Probability R for a vesicle to be available for release, analogous to the pool of synaptic
135+
:resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al.
136+
Pr = u * R :Pr is calculated as R * u (running value of Use)
137+
R = R - u * R :update R as per Eq. 3 in Fuhrmann et al.
138+
139+
if( verboseLevel > 0 ) {
140+
printf("Synapse %f at time %g: R = %g Pr = %g erand = %g\n", synapseID, t, R, Pr, result )
141+
}
142+
143+
tsyn = t
144+
145+
A_AMPA = A_AMPA + Pr*weight_AMPA*factor_AMPA
146+
B_AMPA = B_AMPA + Pr*weight_AMPA*factor_AMPA
147+
A_NMDA = A_NMDA + Pr*weight_NMDA*factor_NMDA
148+
B_NMDA = B_NMDA + Pr*weight_NMDA*factor_NMDA
149+
150+
if( verboseLevel > 0 ) {
151+
printf( " vals %g %g %g %g\n", A_AMPA, weight_AMPA, factor_AMPA, weight )
152+
}
153+
}
154+
155+
156+
FUNCTION toggleVerbose() {
157+
verboseLevel = 1-verboseLevel
158+
}

mechanisms/DetGABAAB.mod

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
COMMENT
2+
/**
3+
* @file DetGABAAB.mod
4+
* @brief Adapted from ProbGABAA_EMS.mod by Eilif, Michael and Srikanth
5+
* @author chindemi
6+
* @date 2014-05-25
7+
* @remark Copyright © BBP/EPFL 2005-2014; All rights reserved. Do not distribute without further notice.
8+
*/
9+
ENDCOMMENT
10+
11+
12+
TITLE GABAA and GABAB receptor with presynaptic short-term plasticity
13+
14+
15+
COMMENT
16+
GABAA and GABAB receptor conductance using a dual-exponential profile
17+
presynaptic short-term plasticity based on Fuhrmann et al. 2002, deterministic
18+
version.
19+
ENDCOMMENT
20+
21+
22+
NEURON {
23+
THREADSAFE
24+
25+
POINT_PROCESS DetGABAAB
26+
RANGE tau_r_GABAA, tau_d_GABAA, tau_r_GABAB, tau_d_GABAB
27+
RANGE Use, u, Dep, Fac, u0, GABAB_ratio
28+
RANGE i, i_GABAA, i_GABAB, g_GABAA, g_GABAB, g, e_GABAA, e_GABAB
29+
NONSPECIFIC_CURRENT i
30+
RANGE synapseID, verboseLevel
31+
}
32+
33+
34+
PARAMETER {
35+
tau_r_GABAA = 0.2 (ms) : dual-exponential conductance profile
36+
tau_d_GABAA = 8 (ms) : IMPORTANT: tau_r < tau_d
37+
tau_r_GABAB = 3.5 (ms) : dual-exponential conductance profile :Placeholder value from hippocampal recordings SR
38+
tau_d_GABAB = 260.9 (ms) : IMPORTANT: tau_r < tau_d :Placeholder value from hippocampal recordings
39+
Use = 1.0 (1) : Utilization of synaptic efficacy
40+
Dep = 100 (ms) : relaxation time constant from depression
41+
Fac = 10 (ms) : relaxation time constant from facilitation
42+
e_GABAA = -80 (mV) : GABAA reversal potential
43+
e_GABAB = -97 (mV) : GABAB reversal potential
44+
gmax = .001 (uS) : weight conversion factor (from nS to uS)
45+
u0 = 0 :initial value of u, which is the running value of release probability
46+
synapseID = 0
47+
verboseLevel = 0
48+
GABAB_ratio = 0 (1) : The ratio of GABAB to GABAA
49+
}
50+
51+
52+
ASSIGNED {
53+
v (mV)
54+
i (nA)
55+
i_GABAA (nA)
56+
i_GABAB (nA)
57+
g_GABAA (uS)
58+
g_GABAB (uS)
59+
g (uS)
60+
factor_GABAA
61+
factor_GABAB
62+
}
63+
64+
STATE {
65+
A_GABAA : GABAA state variable to construct the dual-exponential profile - decays with conductance tau_r_GABAA
66+
B_GABAA : GABAA state variable to construct the dual-exponential profile - decays with conductance tau_d_GABAA
67+
A_GABAB : GABAB state variable to construct the dual-exponential profile - decays with conductance tau_r_GABAB
68+
B_GABAB : GABAB state variable to construct the dual-exponential profile - decays with conductance tau_d_GABAB
69+
}
70+
71+
72+
INITIAL{
73+
LOCAL tp_GABAA, tp_GABAB
74+
75+
A_GABAA = 0
76+
B_GABAA = 0
77+
78+
A_GABAB = 0
79+
B_GABAB = 0
80+
81+
tp_GABAA = (tau_r_GABAA*tau_d_GABAA)/(tau_d_GABAA-tau_r_GABAA)*log(tau_d_GABAA/tau_r_GABAA) :time to peak of the conductance
82+
tp_GABAB = (tau_r_GABAB*tau_d_GABAB)/(tau_d_GABAB-tau_r_GABAB)*log(tau_d_GABAB/tau_r_GABAB) :time to peak of the conductance
83+
84+
factor_GABAA = -exp(-tp_GABAA/tau_r_GABAA)+exp(-tp_GABAA/tau_d_GABAA) :GABAA Normalization factor - so that when t = tp_GABAA, gsyn = gpeak
85+
factor_GABAA = 1/factor_GABAA
86+
87+
factor_GABAB = -exp(-tp_GABAB/tau_r_GABAB)+exp(-tp_GABAB/tau_d_GABAB) :GABAB Normalization factor - so that when t = tp_GABAB, gsyn = gpeak
88+
factor_GABAB = 1/factor_GABAB
89+
}
90+
91+
92+
BREAKPOINT {
93+
SOLVE state METHOD cnexp
94+
g_GABAA = gmax*(B_GABAA-A_GABAA) :compute time varying conductance as the difference of state variables B_GABAA and A_GABAA
95+
g_GABAB = gmax*(B_GABAB-A_GABAB) :compute time varying conductance as the difference of state variables B_GABAB and A_GABAB
96+
g = g_GABAA + g_GABAB
97+
i_GABAA = g_GABAA*(v-e_GABAA) :compute the GABAA driving force based on the time varying conductance, membrane potential, and GABAA reversal
98+
i_GABAB = g_GABAB*(v-e_GABAB) :compute the GABAB driving force based on the time varying conductance, membrane potential, and GABAB reversal
99+
i = i_GABAA + i_GABAB
100+
}
101+
102+
103+
DERIVATIVE state{
104+
A_GABAA' = -A_GABAA/tau_r_GABAA
105+
B_GABAA' = -B_GABAA/tau_d_GABAA
106+
A_GABAB' = -A_GABAB/tau_r_GABAB
107+
B_GABAB' = -B_GABAB/tau_d_GABAB
108+
}
109+
110+
111+
NET_RECEIVE (weight,weight_GABAA, weight_GABAB, R, Pr, u, tsyn (ms)){
112+
LOCAL result
113+
weight_GABAA = weight
114+
weight_GABAB = weight * GABAB_ratio
115+
116+
INITIAL{
117+
R=1
118+
u=u0
119+
tsyn=t
120+
}
121+
122+
: calc u at event-
123+
if (Fac > 0) {
124+
u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al.
125+
} else {
126+
u = Use
127+
}
128+
if(Fac > 0){
129+
u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al.
130+
}
131+
132+
R = 1 - (1-R) * exp(-(t-tsyn)/Dep) :Probability R for a vesicle to be available for release, analogous to the pool of synaptic
133+
:resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al.
134+
Pr = u * R :Pr is calculated as R * u (running value of Use)
135+
R = R - u * R :update R as per Eq. 3 in Fuhrmann et al.
136+
137+
if( verboseLevel > 0 ) {
138+
printf("Synapse %f at time %g: R = %g Pr = %g erand = %g\n", synapseID, t, R, Pr, result )
139+
}
140+
141+
tsyn = t
142+
143+
A_GABAA = A_GABAA + Pr*weight_GABAA*factor_GABAA
144+
B_GABAA = B_GABAA + Pr*weight_GABAA*factor_GABAA
145+
A_GABAB = A_GABAB + Pr*weight_GABAB*factor_GABAB
146+
B_GABAB = B_GABAB + Pr*weight_GABAB*factor_GABAB
147+
148+
if( verboseLevel > 0 ) {
149+
printf( " vals %g %g %g %g\n", A_GABAA, weight_GABAA, factor_GABAA, weight )
150+
}
151+
}
152+
153+
154+
FUNCTION toggleVerbose() {
155+
verboseLevel = 1-verboseLevel
156+
}

0 commit comments

Comments
 (0)