From d12ba02efd015f277c4aa911fc61a7330a5a1e16 Mon Sep 17 00:00:00 2001 From: narawat lamaiin Date: Wed, 24 May 2023 19:27:42 +0700 Subject: [PATCH] bug fix --- src/snn_utils.jl | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/snn_utils.jl b/src/snn_utils.jl index 2b7b2c8..063854a 100644 --- a/src/snn_utils.jl +++ b/src/snn_utils.jl @@ -422,18 +422,22 @@ function neuroplasticity!(n::outputNeuron, firedNeurons::Vector, # add new synaptic connection to neuron for (i, connIndex) in enumerate(zeroWeightConnIndex) newConn::Int64 = 0 - try + if length(nFiredPool) != 0 newConn = popfirst!(nFiredPool) - catch + elseif length(nNonFiredPool) != 0 newConn = popfirst!(nNonFiredPool) + else + # skip end - """ conn that is being replaced has to go into nNonFiredPool so nNonFiredPool isn't empty - """ - push!(nNonFiredPool, n.subscriptionList[connIndex]) - n.subscriptionList[connIndex] = newConn - n.wRec[connIndex] = w[i] * nExInTypeList[newConn] - n.synapticStrength[connIndex] = synapticStrength[i] + if newConn != 0 + """ conn that is being replaced has to go into nNonFiredPool so nNonFiredPool isn't empty + """ + push!(nNonFiredPool, n.subscriptionList[connIndex]) + n.subscriptionList[connIndex] = newConn + n.wRec[connIndex] = w[i] * nExInTypeList[newConn] + n.synapticStrength[connIndex] = synapticStrength[i] + end end end