def RateUpdt(ss, nt, inputOn): """ RateUpdt updates the neuron in rate-code mode this just calls the relevant activation code directly, bypassing most other stuff. """ ly = leabra.Layer(ss.Net.LayerByName("Neuron")) nrn = leabra.Neuron(ly.Neurons[0]) ly.Act.VmFmG(nrn) ly.Act.ActFmG(nrn) nrn.Ge = nrn.Ge * ly.Act.Gbar.E
def Harmony(ss, nt): """ Harmony computes the harmony (excitatory net input Ge * Act) """ harm = float(0) nu = 0 for lyi in nt.Layers: ly = leabra.Layer(handle=lyi) if ly.IsOff(): continue for nrni in ly.Neurons: nrn = leabra.Neuron(handle=nrni) harm += nrn.Ge * nrn.Act nu += 1 if nu > 0: harm /= float(nu) return harm
def LogTstCyc(ss, dt, cyc): """ LogTstCyc adds data from current cycle to the TstCycLog table. """ if dt.Rows <= cyc: dt.SetNumRows(cyc + 1) row = cyc ly = leabra.Layer(ss.Net.LayerByName("Neuron")) nrn = leabra.Neuron(ly.Neurons[0]) dt.SetCellFloat("Cycle", row, float(cyc)) dt.SetCellFloat("Ge", row, float(nrn.Ge)) dt.SetCellFloat("Inet", row, float(nrn.Inet)) dt.SetCellFloat("Vm", row, float(nrn.Vm)) dt.SetCellFloat("Act", row, float(nrn.Act)) dt.SetCellFloat("Spike", row, float(nrn.Spike)) dt.SetCellFloat("Gk", row, float(nrn.Gk)) dt.SetCellFloat("ISI", row, float(nrn.ISI)) dt.SetCellFloat("AvgISI", row, float(nrn.ISIAvg)) # note: essential to use Go version of update when called from another goroutine if cyc % ss.UpdtInterval == 0: ss.TstCycPlot.GoUpdate()