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

Removed plural forms of certain parameter names (fixes #531) #551

Merged
merged 5 commits into from Nov 29, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions models/aeif_cond_alpha_multisynapse.cpp
Expand Up @@ -88,7 +88,7 @@ aeif_cond_alpha_multisynapse::Parameters_::Parameters_()
, num_of_receptors_( 0 )
, has_connections_( false )
{
taus_syn.clear();
tau_syn.clear();
}

aeif_cond_alpha_multisynapse::State_::State_( const Parameters_& p )
Expand Down Expand Up @@ -158,8 +158,8 @@ aeif_cond_alpha_multisynapse::Parameters_::get( DictionaryDatum& d ) const
def< double >( d, names::V_reset, V_reset_ );
def< double >( d, names::E_ex, E_ex );
def< double >( d, names::E_in, E_in );
ArrayDatum taus_syn_ad( taus_syn );
def< ArrayDatum >( d, names::taus_syn, taus_syn_ad );
ArrayDatum tau_syn_ad( tau_syn );
def< ArrayDatum >( d, names::tau_syn, tau_syn_ad );
def< double >( d, names::a, a );
def< double >( d, names::b, b );
def< double >( d, names::Delta_T, Delta_T );
Expand Down Expand Up @@ -189,11 +189,11 @@ aeif_cond_alpha_multisynapse::Parameters_::set( const DictionaryDatum& d )
updateValue< double >( d, names::g_L, g_L );

std::vector< double > tau_tmp;
if ( updateValue< std::vector< double > >( d, names::taus_syn, tau_tmp ) )
if ( updateValue< std::vector< double > >( d, names::tau_syn, tau_tmp ) )
{
for ( size_t i = 0; i < tau_tmp.size(); ++i )
{
if ( tau_tmp.size() < taus_syn.size() && has_connections_ == true )
if ( tau_tmp.size() < tau_syn.size() && has_connections_ == true )
{
throw BadProperty(
"The neuron has connections, therefore the number of ports cannot be "
Expand All @@ -205,8 +205,8 @@ aeif_cond_alpha_multisynapse::Parameters_::set( const DictionaryDatum& d )
"All synaptic time constants must be strictly positive" );
}
}
taus_syn = tau_tmp;
num_of_receptors_ = taus_syn.size();
tau_syn = tau_tmp;
num_of_receptors_ = tau_syn.size();
}

updateValue< double >( d, names::a, a );
Expand Down Expand Up @@ -443,8 +443,8 @@ aeif_cond_alpha_multisynapse::calibrate()

for ( size_t i = 0; i < P_.num_of_receptors_; ++i )
{
V_.g0_ex_[ i ] = 1.0 * numerics::e / P_.taus_syn[ i ];
V_.g0_in_[ i ] = 1.0 * numerics::e / P_.taus_syn[ i ];
V_.g0_ex_[ i ] = 1.0 * numerics::e / P_.tau_syn[ i ];
V_.g0_in_[ i ] = 1.0 * numerics::e / P_.tau_syn[ i ];
}

// set the right function for the dynamics
Expand Down
24 changes: 12 additions & 12 deletions models/aeif_cond_alpha_multisynapse.h
Expand Up @@ -58,7 +58,7 @@

neuron = nest.Create('aeif_cond_alpha_multisynapse')
nest.SetStatus(neuron, {"V_peak": 0.0, "a": 4.0, "b":80.5})
nest.SetStatus(neuron, {'taus_syn':[0.2,2.0,20.0,20.0]})
nest.SetStatus(neuron, {'tau_syn':[0.2,2.0,20.0,20.0]})

spike = nest.Create('spike_generator', params = {'spike_times':
np.array([100.0])})
Expand Down Expand Up @@ -166,9 +166,9 @@ class aeif_cond_alpha_multisynapse : public Archiving_Node
double b; //!< Spike-triggered adaptation in pA
double V_th; //!< Spike threshold in mV.
double t_ref; //!< Refractory period in ms.
std::vector< double > taus_syn; //!< Time constants of synaptic currents
//!< in ms..
double I_e; //!< Intrinsic current in pA.
std::vector< double > tau_syn; //!< Time constants of synaptic currents
//!< in ms..
double I_e; //!< Intrinsic current in pA.
double MAXERR; //!< Maximal error for adaptive stepsize solver
double HMIN; //!< Smallest permissible stepsize in ms.

Expand Down Expand Up @@ -440,13 +440,13 @@ aeif_cond_alpha_multisynapse::aeif_cond_alpha_multisynapse_dynamics(
for ( size_t i = 0; i < P_.num_of_receptors_; ++i )
{
j = i * S::NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR;
f[ S::DG_EXC + j ] = -y[ S::DG_EXC + j ] / P_.taus_syn[ i ];
f[ S::DG_EXC + j ] = -y[ S::DG_EXC + j ] / P_.tau_syn[ i ];
f[ S::G_EXC + j ] = y[ S::DG_EXC + j ]
- y[ S::G_EXC + j ] / P_.taus_syn[ i ]; // Synaptic Conductance (nS)
- y[ S::G_EXC + j ] / P_.tau_syn[ i ]; // Synaptic Conductance (nS)

f[ S::DG_INH + j ] = -y[ S::DG_INH + j ] / P_.taus_syn[ i ];
f[ S::DG_INH + j ] = -y[ S::DG_INH + j ] / P_.tau_syn[ i ];
f[ S::G_INH + j ] = y[ S::DG_INH + j ]
- y[ S::G_INH + j ] / P_.taus_syn[ i ]; // Synaptic Conductance (nS)
- y[ S::G_INH + j ] / P_.tau_syn[ i ]; // Synaptic Conductance (nS)
}
}

Expand Down Expand Up @@ -495,13 +495,13 @@ aeif_cond_alpha_multisynapse::aeif_cond_alpha_multisynapse_dynamics_DT0(
for ( size_t i = 0; i < P_.num_of_receptors_; ++i )
{
j = i * S::NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR;
f[ S::DG_EXC + j ] = -y[ S::DG_EXC + j ] / P_.taus_syn[ i ];
f[ S::DG_EXC + j ] = -y[ S::DG_EXC + j ] / P_.tau_syn[ i ];
f[ S::G_EXC + j ] = y[ S::DG_EXC + j ]
- y[ S::G_EXC + j ] / P_.taus_syn[ i ]; // Synaptic Conductance (nS)
- y[ S::G_EXC + j ] / P_.tau_syn[ i ]; // Synaptic Conductance (nS)

f[ S::DG_INH + j ] = -y[ S::DG_INH + j ] / P_.taus_syn[ i ];
f[ S::DG_INH + j ] = -y[ S::DG_INH + j ] / P_.tau_syn[ i ];
f[ S::G_INH + j ] = y[ S::DG_INH + j ]
- y[ S::G_INH + j ] / P_.taus_syn[ i ]; // Synaptic Conductance (nS)
- y[ S::G_INH + j ] / P_.tau_syn[ i ]; // Synaptic Conductance (nS)
}
}

Expand Down
85 changes: 42 additions & 43 deletions models/aeif_cond_beta_multisynapse.cpp
Expand Up @@ -71,21 +71,21 @@ RecordablesMap< aeif_cond_beta_multisynapse >::create()
* ---------------------------------------------------------------- */

aeif_cond_beta_multisynapse::Parameters_::Parameters_()
: V_peak_( 0.0 ) // mV
, V_reset_( -60.0 ) // mV
, t_ref_( 0.0 ) // ms
, g_L( 30.0 ) // nS
, C_m( 281.0 ) // pF
, E_L( -70.6 ) // mV
, Delta_T( 2.0 ) // mV
, tau_w( 144.0 ) // ms
, a( 4.0 ) // nS
, b( 80.5 ) // pA
, V_th( -50.4 ) // mV
, taus_rise( 1, 2.0 ) // ms
, taus_decay( 1, 20.0 ) // ms
, E_rev( 1, 0.0 ) // mV
, I_e( 0.0 ) // pA
: V_peak_( 0.0 ) // mV
, V_reset_( -60.0 ) // mV
, t_ref_( 0.0 ) // ms
, g_L( 30.0 ) // nS
, C_m( 281.0 ) // pF
, E_L( -70.6 ) // mV
, Delta_T( 2.0 ) // mV
, tau_w( 144.0 ) // ms
, a( 4.0 ) // nS
, b( 80.5 ) // pA
, V_th( -50.4 ) // mV
, tau_rise( 1, 2.0 ) // ms
, tau_decay( 1, 20.0 ) // ms
, E_rev( 1, 0.0 ) // mV
, I_e( 0.0 ) // pA
, gsl_error_tol( 1e-6 )
, has_connections_( false )
{
Expand Down Expand Up @@ -129,11 +129,11 @@ aeif_cond_beta_multisynapse::Parameters_::get( DictionaryDatum& d ) const
def< double >( d, names::V_reset, V_reset_ );
def< size_t >( d, names::n_receptors, n_receptors() );
ArrayDatum E_rev_ad( E_rev );
ArrayDatum taus_rise_ad( taus_rise );
ArrayDatum taus_decay_ad( taus_decay );
ArrayDatum tau_rise_ad( tau_rise );
ArrayDatum tau_decay_ad( tau_decay );
def< ArrayDatum >( d, names::E_rev, E_rev_ad );
def< ArrayDatum >( d, names::taus_rise, taus_rise_ad );
def< ArrayDatum >( d, names::taus_decay, taus_decay_ad );
def< ArrayDatum >( d, names::tau_rise, tau_rise_ad );
def< ArrayDatum >( d, names::tau_decay, tau_decay_ad );
def< double >( d, names::a, a );
def< double >( d, names::b, b );
def< double >( d, names::Delta_T, Delta_T );
Expand All @@ -160,45 +160,44 @@ aeif_cond_beta_multisynapse::Parameters_::set( const DictionaryDatum& d )
bool Erev_flag =
updateValue< std::vector< double > >( d, names::E_rev, E_rev );
bool taur_flag =
updateValue< std::vector< double > >( d, names::taus_rise, taus_rise );
updateValue< std::vector< double > >( d, names::tau_rise, tau_rise );
bool taud_flag =
updateValue< std::vector< double > >( d, names::taus_decay, taus_decay );
updateValue< std::vector< double > >( d, names::tau_decay, tau_decay );
if ( Erev_flag || taur_flag || taud_flag )
{ // receptor arrays have been modified
if ( ( E_rev.size() != old_n_receptors
|| taus_rise.size() != old_n_receptors
|| taus_decay.size() != old_n_receptors )
if ( ( E_rev.size() != old_n_receptors || tau_rise.size() != old_n_receptors
|| tau_decay.size() != old_n_receptors )
&& ( !Erev_flag || !taur_flag || !taud_flag ) )
{
throw BadProperty(
"If the number of receptor ports is changed, all three arrays "
"E_rev, taus_rise and taus_decay must be provided." );
"E_rev, tau_rise and tau_decay must be provided." );
}
if ( ( E_rev.size() != taus_rise.size() )
|| ( E_rev.size() != taus_decay.size() ) )
if ( ( E_rev.size() != tau_rise.size() )
|| ( E_rev.size() != tau_decay.size() ) )
{
throw BadProperty(
"The reversal potential, synaptic rise time and synaptic decay time "
"arrays must have the same size." );
}
if ( taus_rise.size() == 0 )
if ( tau_rise.size() == 0 )
{
throw BadProperty( "The neuron must have at least one port." );
}
if ( taus_rise.size() < old_n_receptors && has_connections_ )
if ( tau_rise.size() < old_n_receptors && has_connections_ )
{
throw BadProperty(
"The neuron has connections, therefore the number of ports cannot be "
"reduced." );
}
for ( size_t i = 0; i < taus_rise.size(); ++i )
for ( size_t i = 0; i < tau_rise.size(); ++i )
{
if ( taus_rise[ i ] <= 0 || taus_decay[ i ] <= 0 )
if ( tau_rise[ i ] <= 0 || tau_decay[ i ] <= 0 )
{
throw BadProperty(
"All synaptic time constants must be strictly positive" );
}
if ( taus_decay[ i ] < taus_rise[ i ] )
if ( tau_decay[ i ] < tau_rise[ i ] )
{
throw BadProperty(
"Synaptic rise time must be smaller than or equal to decay time." );
Expand Down Expand Up @@ -444,30 +443,30 @@ aeif_cond_beta_multisynapse::calibrate()
// is computed here to check that it is != 0
// another denominator denom2 appears in the expression of the
// normalization factor g0
// Both denom1 and denom2 are null if taus_decay = taus_rise, but they
// can also be null if taus_decay and taus_rise are not equal but very
// Both denom1 and denom2 are null if tau_decay = tau_rise, but they
// can also be null if tau_decay and tau_rise are not equal but very
// close to each other, due to the numerical precision limits.
// In such case the beta function reduces to the alpha function,
// and the normalization factor for the alpha function should be used.
double denom1 = P_.taus_decay[ i ] - P_.taus_rise[ i ];
double denom1 = P_.tau_decay[ i ] - P_.tau_rise[ i ];
double denom2 = 0;
if ( denom1 != 0 )
{
// peak time
const double t_p = P_.taus_decay[ i ] * P_.taus_rise[ i ]
* std::log( P_.taus_decay[ i ] / P_.taus_rise[ i ] ) / denom1;
const double t_p = P_.tau_decay[ i ] * P_.tau_rise[ i ]
* std::log( P_.tau_decay[ i ] / P_.tau_rise[ i ] ) / denom1;
// another denominator is computed here to check that it is != 0
denom2 = std::exp( -t_p / P_.taus_decay[ i ] )
- std::exp( -t_p / P_.taus_rise[ i ] );
denom2 = std::exp( -t_p / P_.tau_decay[ i ] )
- std::exp( -t_p / P_.tau_rise[ i ] );
}
if ( denom2 == 0 ) // if rise time == decay time use alpha function
{ // use normalization for alpha function in this case
V_.g0_[ i ] = 1.0 * numerics::e / P_.taus_decay[ i ];
V_.g0_[ i ] = 1.0 * numerics::e / P_.tau_decay[ i ];
}
else // if rise time != decay time use beta function
{
V_.g0_[ i ] // normalization factor for conductance
= ( 1. / P_.taus_rise[ i ] - 1. / P_.taus_decay[ i ] ) / denom2;
= ( 1. / P_.tau_rise[ i ] - 1. / P_.tau_decay[ i ] ) / denom2;
}
}

Expand Down Expand Up @@ -699,8 +698,8 @@ aeif_cond_beta_multisynapse_dynamics( double,
{
const size_t j = i * S::NUMBER_OF_STATES_ELEMENTS_PER_RECEPTOR;
// Synaptic conductance derivative dG/dt
f[ S::DG + j ] = -y[ S::DG + j ] / node.P_.taus_rise[ i ];
f[ S::G + j ] = y[ S::DG + j ] - y[ S::G + j ] / node.P_.taus_decay[ i ];
f[ S::DG + j ] = -y[ S::DG + j ] / node.P_.tau_rise[ i ];
f[ S::G + j ] = y[ S::DG + j ] - y[ S::G + j ] / node.P_.tau_decay[ i ];
}

return GSL_SUCCESS;
Expand Down
20 changes: 10 additions & 10 deletions models/aeif_cond_beta_multisynapse.h
Expand Up @@ -58,7 +58,7 @@
in Computational Modeling Methods for Neuroscientists, MIT Press 2013,
Chapter 6.

The time constants are supplied by two arrays, "taus_rise" and "taus_decay" for
The time constants are supplied by two arrays, "tau_rise" and "tau_decay" for
the synaptic rise time and decay time, respectively. The synaptic
reversal potentials are supplied by the array "E_rev". The port numbers
are automatically assigned in the range from 1 to n_receptors.
Expand Down Expand Up @@ -101,9 +101,9 @@ Spike adaptation parameters:

Synaptic parameters
E_rev double vector - Reversal potential in mV.
taus_rise double vector - Rise time of synaptic conductance in ms (beta
tau_rise double vector - Rise time of synaptic conductance in ms (beta
function).
taus_decay double vector - Decay time of synaptic conductance in ms (beta
tau_decay double vector - Decay time of synaptic conductance in ms (beta
function).

Integration parameters
Expand All @@ -119,8 +119,8 @@ Integration parameters
neuron = nest.Create('aeif_cond_beta_multisynapse')
nest.SetStatus(neuron, {"V_peak": 0.0, "a": 4.0, "b":80.5})
nest.SetStatus(neuron, {'E_rev':[0.0,0.0,0.0,-85.0],
'taus_decay':[50.0,20.0,20.0,20.0],
'taus_rise':[10.0,10.0,1.0,1.0]})
'tau_decay':[50.0,20.0,20.0,20.0],
'tau_rise':[10.0,10.0,1.0,1.0]})

spike = nest.Create('spike_generator', params = {'spike_times':
np.array([10.0])})
Expand Down Expand Up @@ -235,11 +235,11 @@ class aeif_cond_beta_multisynapse : public Archiving_Node
double b; //!< Spike-triggered adaptation in pA
double V_th; //!< Spike threshold in mV.

std::vector< double > taus_rise; //!< Rise time of synaptic conductance
//!< in ms..
std::vector< double > taus_decay; //!< Decay time of synaptic conductance
//!< in ms..
std::vector< double > E_rev; //!< reversal potentials in mV
std::vector< double > tau_rise; //!< Rise time of synaptic conductance
//!< in ms.
std::vector< double > tau_decay; //!< Decay time of synaptic conductance
//!< in ms.
std::vector< double > E_rev; //!< reversal potentials in mV

double I_e; //!< Intrinsic current in pA.

Expand Down
2 changes: 1 addition & 1 deletion models/gif_cond_exp.cpp
Expand Up @@ -300,7 +300,7 @@ nest::gif_cond_exp::State_::get( DictionaryDatum& d,
{
def< double >( d, names::V_m, neuron_state_[ V_M ] ); // Membrane potential
def< double >( d, names::E_sfa, sfa_ ); // Adaptive threshold potential
def< double >( d, names::stc, stc_ ); // Spike-triggered current
def< double >( d, names::I_stc, stc_ ); // Spike-triggered current
}

void
Expand Down
6 changes: 3 additions & 3 deletions models/gif_cond_exp_multisynapse.cpp
Expand Up @@ -243,7 +243,7 @@ nest::gif_cond_exp_multisynapse::Parameters_::get( DictionaryDatum& d ) const
def< double >( d, names::gsl_error_tol, gsl_error_tol );

ArrayDatum tau_syn_ad( tau_syn_ );
def< ArrayDatum >( d, names::taus_syn, tau_syn_ad );
def< ArrayDatum >( d, names::tau_syn, tau_syn_ad );

ArrayDatum tau_sfa_list_ad( tau_sfa_ );
def< ArrayDatum >( d, names::tau_sfa, tau_sfa_list_ad );
Expand Down Expand Up @@ -285,7 +285,7 @@ nest::gif_cond_exp_multisynapse::Parameters_::set( const DictionaryDatum& d )
updateValue< std::vector< double > >( d, names::q_stc, q_stc_ );

std::vector< double > tau_tmp;
if ( updateValue< std::vector< double > >( d, names::taus_syn, tau_tmp ) )
if ( updateValue< std::vector< double > >( d, names::tau_syn, tau_tmp ) )
{
if ( has_connections_ && tau_tmp.size() < tau_syn_.size() )
throw BadProperty(
Expand Down Expand Up @@ -346,7 +346,7 @@ nest::gif_cond_exp_multisynapse::State_::get( DictionaryDatum& d,
{
def< double >( d, names::V_m, y_[ V_M ] ); // Membrane potential
def< double >( d, names::E_sfa, sfa_ ); // Adaptive threshold potential
def< double >( d, names::stc, stc_ ); // Spike-triggered current
def< double >( d, names::I_stc, stc_ ); // Spike-triggered current
}

void
Expand Down
4 changes: 2 additions & 2 deletions models/gif_cond_exp_multisynapse.h
Expand Up @@ -128,8 +128,8 @@
V_T_star double - Base threshold in mV

Synaptic parameters
taus_syn vector of double - Time constants of the synaptic conductance
in ms.
tau_syn vector of double - Time constants of the synaptic conductance
in ms.
E_ex double - Excitatory reversal potential in mV.
E_in double - Inhibitory reversal potential in mV.

Expand Down
2 changes: 1 addition & 1 deletion models/gif_psc_exp.cpp
Expand Up @@ -203,7 +203,7 @@ nest::gif_psc_exp::State_::get( DictionaryDatum& d, const Parameters_& p ) const
{
def< double >( d, names::V_m, V_ ); // Membrane potential
def< double >( d, names::E_sfa, sfa_ ); // Adaptive threshold potential
def< double >( d, names::stc, stc_ ); // Spike-triggered current
def< double >( d, names::I_stc, stc_ ); // Spike-triggered current
}

void
Expand Down