Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename the variable "Ca" in astrocyte_lr_1994 to "Ca_astro" #3093

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions doc/htmldoc/model_details/astrocyte_model_implementation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -84,39 +84,39 @@
" Parameters\n",
" ----------\n",
" y : list\n",
" Vector containing the state variables [IP3, Ca, h_IP3R]\n",
" Vector containing the state variables [IP3, Ca_astro, h_IP3R]\n",
" _ : unused var\n",
" p : Params instance\n",
" Object containing the astrocyte parameters.\n",
"\n",
" Returns\n",
" -------\n",
" dCa : double\n",
" Derivative of Ca\n",
" dCa_astro : double\n",
" Derivative of Ca_astro\n",
" dIP3 : double\n",
" Derivative of IP3\n",
" dh_IP3R : double\n",
" Derivative of h_IP3R\n",
" \"\"\"\n",
" IP3 = y[0]\n",
" Ca = y[1]\n",
" Ca_astro = y[1]\n",
" h_IP3R = y[2]\n",
"\n",
" Ca = max(0, min(Ca, p.Ca_tot * (1 + p.ratio_ER_cyt)))\n",
" Ca_astro = max(0, min(Ca_astro, p.Ca_tot * (1 + p.ratio_ER_cyt)))\n",
" alpha = p.k_IP3R * p.Kd_inh * (IP3 + p.Kd_IP3_1) / (IP3 + p.Kd_IP3_2)\n",
" beta = p.k_IP3R * Ca\n",
" Ca_ER = (p.Ca_tot - Ca) / p.ratio_ER_cyt\n",
" beta = p.k_IP3R * Ca_astro\n",
" Ca_ER = (p.Ca_tot - Ca_astro) / p.ratio_ER_cyt\n",
" m_inf = IP3 / (IP3 + p.Kd_IP3_1)\n",
" n_inf = Ca / (Ca + p.Kd_act)\n",
" J_ch = p.ratio_ER_cyt * p.rate_IP3R * ((m_inf * n_inf * h_IP3R) ** 3) * (Ca_ER - Ca)\n",
" J_pump = p.rate_SERCA * (Ca**2) / (p.Km_SERCA**2 + Ca**2)\n",
" J_leak = p.ratio_ER_cyt * p.rate_L * (Ca_ER - Ca)\n",
" n_inf = Ca_astro / (Ca_astro + p.Kd_act)\n",
" J_ch = p.ratio_ER_cyt * p.rate_IP3R * ((m_inf * n_inf * h_IP3R) ** 3) * (Ca_ER - Ca_astro)\n",
" J_pump = p.rate_SERCA * (Ca_astro**2) / (p.Km_SERCA**2 + Ca_astro**2)\n",
" J_leak = p.ratio_ER_cyt * p.rate_L * (Ca_ER - Ca_astro)\n",
"\n",
" dCa = J_ch - J_pump + J_leak\n",
" dCa_astro = J_ch - J_pump + J_leak\n",
" dIP3 = (p.IP3_0 - IP3) / p.tau_IP3\n",
" dh_IP3R = alpha * (1 - h_IP3R) - beta * h_IP3R\n",
"\n",
" return dIP3, dCa, dh_IP3R"
" return dIP3, dCa_astro, dh_IP3R"
]
},
{
Expand Down Expand Up @@ -164,7 +164,7 @@
" \"\"\"\n",
" t = np.arange(0, simtime, dt) # time axis\n",
" n = len(t)\n",
" y = np.zeros((n, 3)) # state variables: IP3, Ca, h_IP3R\n",
" y = np.zeros((n, 3)) # state variables: IP3, Ca_astro, h_IP3R\n",
" # for the state variables, assign the same initial values as in test_astrocyte.py\n",
" y[0, 0] = 1.0\n",
" y[0, 1] = 1.0\n",
Expand Down Expand Up @@ -282,7 +282,7 @@
"implementation detailed in\n",
"``doc/htmldoc/model_details/astrocyte_model_implementation.ipynb``.\n",
"This data is used as reference for the tests in ``test_astrocyte.py``.\\n\n",
" Times IP3 Ca h_IP3R \"\"\",\n",
" Times IP3 Ca_astro h_IP3R\"\"\",\n",
")"
]
},
Expand Down
18 changes: 9 additions & 9 deletions models/astrocyte_lr_1994.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RecordablesMap< astrocyte_lr_1994 >::create()
{
// use standard names whereever you can for consistency!
insert_( names::IP3, &astrocyte_lr_1994::get_y_elem_< astrocyte_lr_1994::State_::IP3 > );
insert_( names::Ca, &astrocyte_lr_1994::get_y_elem_< astrocyte_lr_1994::State_::Ca > );
insert_( names::Ca_astro, &astrocyte_lr_1994::get_y_elem_< astrocyte_lr_1994::State_::Ca_astro > );
insert_( names::h_IP3R, &astrocyte_lr_1994::get_y_elem_< astrocyte_lr_1994::State_::h_IP3R > );
}

Expand All @@ -85,7 +85,7 @@ astrocyte_lr_1994_dynamics( double time, const double y[], double f[], void* pno
const double& ip3 = y[ S::IP3 ];
// Ca_tot_ corresponds to the c_0 (total [Ca++] in terms of cytosolic vol)
// in De Young & Keizer (1992) and Li & Rinzel (1994)
const double& calc = std::max( 0.0, std::min( y[ S::Ca ], node.P_.Ca_tot_ ) ); // keep calcium within limits
const double& calc = std::max( 0.0, std::min( y[ S::Ca_astro ], node.P_.Ca_tot_ ) ); // keep calcium within limits
const double& h_ip3r = y[ S::h_IP3R ];

const double alpha_h_ip3r =
Expand All @@ -101,7 +101,7 @@ astrocyte_lr_1994_dynamics( double time, const double y[], double f[], void* pno
* std::pow( h_ip3r, 3 ) * ( calc_ER - calc );

f[ S::IP3 ] = ( node.P_.IP3_0_ - ip3 ) / node.P_.tau_IP3_;
f[ S::Ca ] = J_channel - J_pump + J_leak + node.B_.J_noise_;
f[ S::Ca_astro ] = J_channel - J_pump + J_leak + node.B_.J_noise_;
f[ S::h_IP3R ] = alpha_h_ip3r * ( 1.0 - h_ip3r ) - beta_h_ip3r * h_ip3r;

return GSL_SUCCESS;
Expand Down Expand Up @@ -137,7 +137,7 @@ nest::astrocyte_lr_1994::State_::State_( const Parameters_& p )
{
// initial values based on Li & Rinzel (1994) and Nadkarni & Jung (2003)
y_[ IP3 ] = p.IP3_0_;
y_[ Ca ] = 0.073;
y_[ Ca_astro ] = 0.073;
y_[ h_IP3R ] = 0.793;
}

Expand Down Expand Up @@ -278,22 +278,22 @@ void
nest::astrocyte_lr_1994::State_::get( DictionaryDatum& d ) const
{
def< double >( d, names::IP3, y_[ IP3 ] );
def< double >( d, names::Ca, y_[ Ca ] );
def< double >( d, names::Ca_astro, y_[ Ca_astro ] );
def< double >( d, names::h_IP3R, y_[ h_IP3R ] );
}

void
nest::astrocyte_lr_1994::State_::set( const DictionaryDatum& d, const Parameters_&, Node* node )
{
updateValueParam< double >( d, names::IP3, y_[ IP3 ], node );
updateValueParam< double >( d, names::Ca, y_[ Ca ], node );
updateValueParam< double >( d, names::Ca_astro, y_[ Ca_astro ], node );
updateValueParam< double >( d, names::h_IP3R, y_[ h_IP3R ], node );

if ( y_[ IP3 ] < 0 )
{
throw BadProperty( "IP3 concentration must be non-negative." );
}
if ( y_[ Ca ] < 0 )
if ( y_[ Ca_astro ] < 0 )
{
throw BadProperty( "Calcium concentration must be non-negative." );
}
Expand Down Expand Up @@ -465,15 +465,15 @@ nest::astrocyte_lr_1994::update( Time const& origin, const long from, const long
}

// keep calcium within limits
S_.y_[ State_::Ca ] = std::max( 0.0, std::min( S_.y_[ State_::Ca ], P_.Ca_tot_ ) );
S_.y_[ State_::Ca_astro ] = std::max( 0.0, std::min( S_.y_[ State_::Ca_astro ], P_.Ca_tot_ ) );

// this is to add the incoming spikes to IP3
S_.y_[ State_::IP3 ] += P_.delta_IP3_ * B_.spike_exc_.get_value( lag );

// SIC generation according to Nadkarni & Jung, 2003
// Suprathreshold log of calcium concentration determines SIC generation
// 1000.0: change unit to nM as in the original paper
const double calc_thr = ( S_.y_[ State_::Ca ] - P_.SIC_th_ ) * 1000.0;
const double calc_thr = ( S_.y_[ State_::Ca_astro ] - P_.SIC_th_ ) * 1000.0;
const double sic_value = calc_thr > 1.0 ? std::log( calc_thr ) * P_.SIC_scale_ : 0.0;
B_.sic_values[ lag ] = sic_value;

Expand Down
20 changes: 10 additions & 10 deletions models/astrocyte_lr_1994.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ Parameters

The following parameters can be set in the status dictionary.

====== ========= =============================================================
======== ========= =============================================================
**Dynamic state variables**
-------------------------------------------------------------------------------
IP3 µM Inositol 1,4,5-trisphosphate concentration in the astrocytic
cytosol
Ca µM Calcium concentration in the astrocytic cytosol
h_IP3R unitless Fraction of IP3 receptors on the astrocytic ER that are not
yet inactivated by calcium
====== ========= =============================================================
--------------------------------------------------------------------------------
IP3 µM Inositol 1,4,5-trisphosphate concentration in the astrocytic
cytosol
Ca_astro µM Calcium concentration in the astrocytic cytosol
h_IP3R unitless Fraction of IP3 receptors on the astrocytic ER that are not
yet inactivated by calcium
======== ========= =============================================================

=============== ========= =====================================================
**Parameters**
Expand Down Expand Up @@ -354,8 +354,8 @@ class astrocyte_lr_1994 : public StructuralPlasticityNode
enum StateVecElems
{
IP3 = 0,
Ca, // 1
h_IP3R, // 2
Ca_astro, // 1
h_IP3R, // 2
STATE_VEC_SIZE
};

Expand Down
1 change: 1 addition & 0 deletions nestkernel/nest_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const Name buffer_size_target_data( "buffer_size_target_data" );

const Name C_m( "C_m" );
const Name Ca( "Ca" );
const Name Ca_astro( "Ca_astro" );
const Name Ca_tot( "Ca_tot" );
const Name c( "c" );
const Name c_1( "c_1" );
Expand Down
1 change: 1 addition & 0 deletions nestkernel/nest_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ extern const Name buffer_size_target_data;

extern const Name C_m;
extern const Name Ca;
extern const Name Ca_astro;
extern const Name Ca_tot;
extern const Name c;
extern const Name c_1;
Expand Down
4 changes: 2 additions & 2 deletions pynest/examples/astrocytes/astrocyte_brunel.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def plot_dynamics(astro_data, neuron_data, start):
# astrocyte data
astro_mask = astro_data["times"] > start
astro_ip3 = astro_data["IP3"][astro_mask]
astro_cal = astro_data["Ca"][astro_mask]
astro_cal = astro_data["Ca_astro"][astro_mask]
astro_times = astro_data["times"][astro_mask]
astro_times_set = list(set(astro_times))
ip3_means = np.array([np.mean(astro_ip3[astro_times == t]) for t in astro_times_set])
Expand Down Expand Up @@ -329,7 +329,7 @@ def run_simulation():
# create and connect recorders (multimeter default resolution = 1 ms)
sr_neuron = nest.Create("spike_recorder")
mm_neuron = nest.Create("multimeter", params={"record_from": ["I_SIC"]})
mm_astro = nest.Create("multimeter", params={"record_from": ["IP3", "Ca"]})
mm_astro = nest.Create("multimeter", params={"record_from": ["IP3", "Ca_astro"]})

# select nodes randomly and connect them with recorders
print("Connecting recorders ...")
Expand Down
4 changes: 2 additions & 2 deletions pynest/examples/astrocytes/astrocyte_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
# Create and connect the astrocyte and its devices.

astrocyte = nest.Create("astrocyte_lr_1994", params=params_astro)
mm_astro = nest.Create("multimeter", params={"record_from": ["IP3", "Ca"]})
mm_astro = nest.Create("multimeter", params={"record_from": ["IP3", "Ca_astro"]})
nest.Connect(mm_astro, astrocyte)

###############################################################################
Expand Down Expand Up @@ -133,7 +133,7 @@
axes[0].plot(data_pre["times"], data_pre["V_m"])
axes[1].plot(data_astro["times"], data_astro["IP3"])
axes[2].plot(data_post["times"], data_post["I_SIC"])
axes[3].plot(data_astro["times"], data_astro["Ca"])
axes[3].plot(data_astro["times"], data_astro["Ca_astro"])
axes[0].set_title(f"Presynaptic neuron\n(Poisson rate = {poisson_rate_neuro} Hz)")
axes[0].set_ylabel("Membrane potential (mV)")
axes[2].set_title("Postsynaptic neuron")
Expand Down
4 changes: 2 additions & 2 deletions pynest/examples/astrocytes/astrocyte_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

astrocyte = nest.Create("astrocyte_lr_1994", params=params_astro)
ps_astro = nest.Create("poisson_generator", params={"rate": poisson_rate})
mm_astro = nest.Create("multimeter", params={"record_from": ["IP3", "Ca"]})
mm_astro = nest.Create("multimeter", params={"record_from": ["IP3", "Ca_astro"]})
nest.Connect(ps_astro, astrocyte, syn_spec={"weight": poisson_weight})
nest.Connect(mm_astro, astrocyte)

Expand All @@ -93,7 +93,7 @@

fig, axes = plt.subplots(2, 1, sharex=True, figsize=(6.4, 4.8), dpi=100)
axes[0].plot(data["times"], data["IP3"])
axes[1].plot(data["times"], data["Ca"])
axes[1].plot(data["times"], data["Ca_astro"])
axes[0].set_ylabel(r"[IP$_{3}$] ($\mu$M)")
axes[1].set_ylabel(r"[Ca$^{2+}$] ($\mu$M)")
axes[1].set_xlabel("Time (ms)")
Expand Down
4 changes: 2 additions & 2 deletions pynest/examples/astrocytes/astrocyte_small_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def plot_dynamics(astro_data, neuron_data, start):
print("Plotting dynamics ...")
# get astrocyte data
astro_times, astro_ip3_mean, astro_ip3_sd = get_plot_data(astro_data, "IP3")
astro_times, astro_ca_mean, astro_ca_sd = get_plot_data(astro_data, "Ca")
astro_times, astro_ca_mean, astro_ca_sd = get_plot_data(astro_data, "Ca_astro")
# get neuron data
neuron_times, neuron_sic_mean, neuron_sic_sd = get_plot_data(neuron_data, "I_SIC")
# set plots
Expand Down Expand Up @@ -413,7 +413,7 @@ def plot_dynamics(astro_data, neuron_data, start):
)
mm_pre_neurons = nest.Create("multimeter", params={"record_from": ["V_m"]})
mm_post_neurons = nest.Create("multimeter", params={"record_from": ["V_m", "I_SIC"]})
mm_astrocytes = nest.Create("multimeter", params={"record_from": ["IP3", "Ca"]})
mm_astrocytes = nest.Create("multimeter", params={"record_from": ["IP3", "Ca_astro"]})
nest.Connect(mm_pre_neurons, pre_neurons)
nest.Connect(mm_post_neurons, post_neurons)
nest.Connect(mm_astrocytes, astrocytes)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/pytests/test_astrocyte.dat
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# ``doc/htmldoc/model_details/astrocyte_model_implementation.ipynb``.
# This data is used as reference for the tests in ``test_astrocyte.py``.
#
# Times IP3 Ca h_IP3R
# Times IP3 Ca_astro h_IP3R
1.000000000000000056e-01 9.999882386709698645e-01 1.000187105302611235e+00 9.999799984511013040e-01
2.000000000000000111e-01 9.999764775066160016e-01 1.000374129429669079e+00 9.999599938057039950e-01
3.000000000000000444e-01 9.999647165069364130e-01 1.000561072405474095e+00 9.999399860656773553e-01
Expand Down
6 changes: 3 additions & 3 deletions testsuite/pytests/test_astrocyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def test_closeness_nest_odeint():

# create astrocyte and devices
# initial values of the state variables as in the reference solution
astrocyte = nest.Create("astrocyte_lr_1994", params={"IP3": 1.0, "Ca": 1.0, "h_IP3R": 1.0})
astrocyte = nest.Create("astrocyte_lr_1994", params={"IP3": 1.0, "Ca_astro": 1.0, "h_IP3R": 1.0})
mm = nest.Create(
"multimeter",
{"interval": nest.resolution, "record_from": ["IP3", "Ca", "h_IP3R"]},
{"interval": nest.resolution, "record_from": ["IP3", "Ca_astro", "h_IP3R"]},
)
spk_ge = nest.Create("spike_generator", {"spike_times": spike_times, "spike_weights": spike_weights})

Expand All @@ -74,5 +74,5 @@ def test_closeness_nest_odeint():

# compare results with reference data
assert mm.events["IP3"] == pytest.approx(ref_ip3)
assert mm.events["Ca"] == pytest.approx(ref_ca)
assert mm.events["Ca_astro"] == pytest.approx(ref_ca)
assert mm.events["h_IP3R"] == pytest.approx(ref_h_ip3r)
6 changes: 3 additions & 3 deletions testsuite/pytests/test_sic_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def test_SynapseFunctionWithAeifModel():
resol = nest.resolution

# Create neurons and devices
astrocyte = nest.Create("astrocyte_lr_1994", {"Ca": 0.2}) # a calcium value which produces SIC
astrocyte = nest.Create("astrocyte_lr_1994", {"Ca_astro": 0.2}) # a calcium value which produces SIC
neuron = nest.Create("aeif_cond_alpha_astro")

mm_neuron = nest.Create("multimeter", params={"record_from": ["I_SIC"], "interval": resol})
mm_astro = nest.Create("multimeter", params={"record_from": ["Ca"], "interval": resol})
mm_astro = nest.Create("multimeter", params={"record_from": ["Ca_astro"], "interval": resol})

nest.Connect(astrocyte, neuron, syn_spec={"synapse_model": "sic_connection"})
nest.Connect(mm_neuron, neuron)
Expand All @@ -80,7 +80,7 @@ def test_SynapseFunctionWithAeifModel():
# The expected SIC values are calculated based on the astrocyte dynamics
# implemented in astrocyte_lr_1994.cpp.
actual_sic_values = mm_neuron.events["I_SIC"]
Ca = mm_astro.events["Ca"]
Ca = mm_astro.events["Ca_astro"]
f_v = np.vectorize(lambda x: np.log(x * 1000.0 - 196.69) if x * 1000.0 - 196.69 > 1.0 else 0.0)
expected_sic_values = f_v(Ca)

Expand Down
Loading