diff --git a/examples/axon/act.go b/examples/axon/act.go index 66c5285..712634e 100644 --- a/examples/axon/act.go +++ b/examples/axon/act.go @@ -92,8 +92,8 @@ func (sk *SpikeParams) ActToISI(act, timeInc, integ float32) float32 { return (1 / (timeInc * integ * act * sk.MaxHz)) } -// ActFmISI computes rate-code activation from estimated spiking interval -func (sk *SpikeParams) ActFmISI(isi, timeInc, integ float32) float32 { +// ActFromISI computes rate-code activation from estimated spiking interval +func (sk *SpikeParams) ActFromISI(isi, timeInc, integ float32) float32 { if isi <= 0 { return 0 } @@ -101,8 +101,8 @@ func (sk *SpikeParams) ActFmISI(isi, timeInc, integ float32) float32 { return maxInt / isi // normalized } -// AvgFmISI updates spiking ISI from current isi interval value -func (sk *SpikeParams) AvgFmISI(avg *float32, isi float32) { +// AvgFromISI updates spiking ISI from current isi interval value +func (sk *SpikeParams) AvgFromISI(avg *float32, isi float32) { if *avg <= 0 { *avg = isi } else if isi < 0.8**avg { @@ -288,29 +288,29 @@ func (dp *DtParams) Defaults() { dp.Update() } -// GeSynFmRaw integrates a synaptic conductance from raw spiking using GeTau -func (dp *DtParams) GeSynFmRaw(geSyn, geRaw float32) float32 { +// GeSynFromRaw integrates a synaptic conductance from raw spiking using GeTau +func (dp *DtParams) GeSynFromRaw(geSyn, geRaw float32) float32 { return geSyn + geRaw - dp.GeDt*geSyn } -// GeSynFmRawSteady returns the steady-state GeSyn that would result from +// GeSynFromRawSteady returns the steady-state GeSyn that would result from // receiving a steady increment of GeRaw every time step = raw * GeTau. // dSyn = Raw - dt*Syn; solve for dSyn = 0 to get steady state: // dt*Syn = Raw; Syn = Raw / dt = Raw * Tau -func (dp *DtParams) GeSynFmRawSteady(geRaw float32) float32 { +func (dp *DtParams) GeSynFromRawSteady(geRaw float32) float32 { return geRaw * dp.GeTau } -// GiSynFmRaw integrates a synaptic conductance from raw spiking using GiTau -func (dp *DtParams) GiSynFmRaw(giSyn, giRaw float32) float32 { +// GiSynFromRaw integrates a synaptic conductance from raw spiking using GiTau +func (dp *DtParams) GiSynFromRaw(giSyn, giRaw float32) float32 { return giSyn + giRaw - dp.GiDt*giSyn } -// GiSynFmRawSteady returns the steady-state GiSyn that would result from +// GiSynFromRawSteady returns the steady-state GiSyn that would result from // receiving a steady increment of GiRaw every time step = raw * GiTau. // dSyn = Raw - dt*Syn; solve for dSyn = 0 to get steady state: // dt*Syn = Raw; Syn = Raw / dt = Raw * Tau -func (dp *DtParams) GiSynFmRawSteady(giRaw float32) float32 { +func (dp *DtParams) GiSynFromRawSteady(giRaw float32) float32 { return giRaw * dp.GiTau } @@ -746,9 +746,9 @@ func (ac *ActParams) InitLongActs(nrn *Neuron) { /////////////////////////////////////////////////////////////////////// // Cycle -// NMDAFmRaw updates all the NMDA variables from +// NMDAFromRaw updates all the NMDA variables from // total Ge (GeRaw + Ext) and current Vm, Spiking -func (ac *ActParams) NMDAFmRaw(nrn *Neuron, geTot float32) { +func (ac *ActParams) NMDAFromRaw(nrn *Neuron, geTot float32) { if geTot < 0 { geTot = 0 } @@ -757,32 +757,32 @@ func (ac *ActParams) NMDAFmRaw(nrn *Neuron, geTot float32) { // note: nrn.NmdaCa computed via Learn.LrnNMDA in learn.go, CaM method } -// GvgccFmVm updates all the VGCC voltage-gated calcium channel variables +// GvgccFromVm updates all the VGCC voltage-gated calcium channel variables // from VmDend -func (ac *ActParams) GvgccFmVm(nrn *Neuron) { +func (ac *ActParams) GvgccFromVm(nrn *Neuron) { nrn.Gvgcc = ac.VGCC.Gvgcc(nrn.VmDend, nrn.VgccM, nrn.VgccH) var dm, dh float32 - ac.VGCC.DMHFmV(nrn.VmDend, nrn.VgccM, nrn.VgccH, &dm, &dh) + ac.VGCC.DMHFromV(nrn.VmDend, nrn.VgccM, nrn.VgccH, &dm, &dh) nrn.VgccM += dm nrn.VgccH += dh - nrn.VgccCa = ac.VGCC.CaFmG(nrn.VmDend, nrn.Gvgcc, nrn.VgccCa) // note: may be overwritten! + nrn.VgccCa = ac.VGCC.CaFromG(nrn.VmDend, nrn.Gvgcc, nrn.VgccCa) // note: may be overwritten! } -// GkFmVm updates all the Gk-based conductances: Mahp, KNa, Gak -func (ac *ActParams) GkFmVm(nrn *Neuron) { - dn := ac.Mahp.DNFmV(nrn.Vm, nrn.MahpN) +// GkFromVm updates all the Gk-based conductances: Mahp, KNa, Gak +func (ac *ActParams) GkFromVm(nrn *Neuron) { + dn := ac.Mahp.DNFromV(nrn.Vm, nrn.MahpN) nrn.MahpN += dn nrn.Gak = ac.AK.Gak(nrn.VmDend) nrn.Gk = nrn.Gak + ac.Mahp.GmAHP(nrn.MahpN) + ac.Sahp.GsAHP(nrn.SahpN) if ac.KNa.On.IsTrue() { - ac.KNa.GcFmSpike(&nrn.GknaMed, &nrn.GknaSlow, nrn.Spike > .5) + ac.KNa.GcFromSpike(&nrn.GknaMed, &nrn.GknaSlow, nrn.Spike > .5) nrn.Gk += nrn.GknaMed + nrn.GknaSlow } } -// GeFmSyn integrates Ge excitatory conductance from GeSyn. +// GeFromSyn integrates Ge excitatory conductance from GeSyn. // geExt is extra conductance to add to the final Ge value -func (ac *ActParams) GeFmSyn(ni int, nrn *Neuron, geSyn, geExt float32, randctr *sltype.Uint2) { +func (ac *ActParams) GeFromSyn(ni int, nrn *Neuron, geSyn, geExt float32, randctr *sltype.Uint2) { nrn.GeExt = 0 if ac.Clamp.Add.IsTrue() && nrn.HasFlag(NeuronHasExt) { nrn.GeExt = nrn.Ext * ac.Clamp.Ge @@ -809,7 +809,7 @@ func (ac *ActParams) GeNoise(ni int, nrn *Neuron, randctr *sltype.Uint2) { return } ge := ac.Noise.PGe(&nrn.GeNoiseP, ni, randctr) - nrn.GeNoise = ac.Dt.GeSynFmRaw(nrn.GeNoise, ge) + nrn.GeNoise = ac.Dt.GeSynFromRaw(nrn.GeNoise, ge) nrn.Ge += nrn.GeNoise } @@ -820,12 +820,12 @@ func (ac *ActParams) GiNoise(ni int, nrn *Neuron, randctr *sltype.Uint2) { } gi := ac.Noise.PGi(&nrn.GiNoiseP, ni, randctr) // fmt.Printf("rc: %v\n", *randctr) - nrn.GiNoise = ac.Dt.GiSynFmRaw(nrn.GiNoise, gi) + nrn.GiNoise = ac.Dt.GiSynFromRaw(nrn.GiNoise, gi) } -// GiFmSyn integrates GiSyn inhibitory synaptic conductance from GiRaw value +// GiFromSyn integrates GiSyn inhibitory synaptic conductance from GiRaw value // (can add other terms to geRaw prior to calling this) -func (ac *ActParams) GiFmSyn(ni int, nrn *Neuron, giSyn float32, randctr *sltype.Uint2) float32 { +func (ac *ActParams) GiFromSyn(ni int, nrn *Neuron, giSyn float32, randctr *sltype.Uint2) float32 { ac.GiNoise(ni, nrn, randctr) if giSyn < 0 { // negative inhib G doesn't make any sense giSyn = 0 @@ -833,8 +833,8 @@ func (ac *ActParams) GiFmSyn(ni int, nrn *Neuron, giSyn float32, randctr *sltype return giSyn } -// InetFmG computes net current from conductances and Vm -func (ac *ActParams) InetFmG(vm, ge, gl, gi, gk float32) float32 { +// InetFromG computes net current from conductances and Vm +func (ac *ActParams) InetFromG(vm, ge, gl, gi, gk float32) float32 { inet := ge*(ac.Erev.E-vm) + gl*ac.Gbar.L*(ac.Erev.L-vm) + gi*(ac.Erev.I-vm) + gk*(ac.Erev.K-vm) if inet > ac.Dt.VmTau { inet = ac.Dt.VmTau @@ -844,8 +844,8 @@ func (ac *ActParams) InetFmG(vm, ge, gl, gi, gk float32) float32 { return inet } -// VmFmInet computes new Vm value from inet, clamping range -func (ac *ActParams) VmFmInet(vm, dt, inet float32) float32 { +// VmFromInet computes new Vm value from inet, clamping range +func (ac *ActParams) VmFromInet(vm, dt, inet float32) float32 { return ac.VmRange.ClipValue(vm + dt*inet) } @@ -855,13 +855,13 @@ func (ac *ActParams) VmInteg(vm, dt, ge, gl, gi, gk float32, nvm, inet *float32) dt *= ac.Dt.DtStep *nvm = vm for i := int32(0); i < ac.Dt.VmSteps; i++ { - *inet = ac.InetFmG(*nvm, ge, gl, gi, gk) - *nvm = ac.VmFmInet(*nvm, dt, *inet) + *inet = ac.InetFromG(*nvm, ge, gl, gi, gk) + *nvm = ac.VmFromInet(*nvm, dt, *inet) } } -// VmFmG computes membrane potential Vm from conductances Ge, Gi, and Gk. -func (ac *ActParams) VmFmG(nrn *Neuron) { +// VmFromG computes membrane potential Vm from conductances Ge, Gi, and Gk. +func (ac *ActParams) VmFromG(nrn *Neuron) { updtVm := true // note: nrn.ISI has NOT yet been updated at this point: 0 right after spike, etc // so it takes a full 3 time steps after spiking for Tr period @@ -883,7 +883,7 @@ func (ac *ActParams) VmFmG(nrn *Neuron) { expi = ac.Dt.VmTau } inet += expi - nvm = ac.VmFmInet(nvm, ac.Dt.VmDt, expi) + nvm = ac.VmFromInet(nvm, ac.Dt.VmDt, expi) } nrn.Vm = nvm nrn.Inet = inet @@ -906,14 +906,14 @@ func (ac *ActParams) VmFmG(nrn *Neuron) { giEff := gi + ac.Gbar.I*nrn.SSGiDend ac.VmInteg(nrn.VmDend, ac.Dt.VmDendDt, ge, glEff, giEff, gk, &nvm, &inet) if updtVm { - nvm = ac.VmFmInet(nvm, ac.Dt.VmDendDt, ac.Dend.GbarExp*expi) + nvm = ac.VmFromInet(nvm, ac.Dt.VmDendDt, ac.Dend.GbarExp*expi) } nrn.VmDend = nvm } } -// SpikeFmG computes Spike from Vm and ISI-based activation -func (ac *ActParams) SpikeFmVm(nrn *Neuron) { +// SpikeFromG computes Spike from Vm and ISI-based activation +func (ac *ActParams) SpikeFromVm(nrn *Neuron) { var thr float32 if slbool.IsTrue(ac.Spike.Exp) { thr = ac.Spike.ExpThr @@ -925,7 +925,7 @@ func (ac *ActParams) SpikeFmVm(nrn *Neuron) { if nrn.ISIAvg == -1 { nrn.ISIAvg = -2 } else if nrn.ISI > 0 { // must have spiked to update - ac.Spike.AvgFmISI(&nrn.ISIAvg, nrn.ISI+1) + ac.Spike.AvgFromISI(&nrn.ISIAvg, nrn.ISI+1) } nrn.ISI = 0 } else { @@ -941,11 +941,11 @@ func (ac *ActParams) SpikeFmVm(nrn *Neuron) { nrn.Spiked = 0 } if nrn.ISIAvg >= 0 && nrn.ISI > 0 && nrn.ISI > 1.2*nrn.ISIAvg { - ac.Spike.AvgFmISI(&nrn.ISIAvg, nrn.ISI) + ac.Spike.AvgFromISI(&nrn.ISIAvg, nrn.ISI) } } - nwAct := ac.Spike.ActFmISI(nrn.ISIAvg, .001, ac.Dt.Integ) + nwAct := ac.Spike.ActFromISI(nrn.ISIAvg, .001, ac.Dt.Integ) if nwAct > 1 { nwAct = 1 } diff --git a/examples/axon/chans/ak.go b/examples/axon/chans/ak.go index b63fded..653b279 100644 --- a/examples/axon/chans/ak.go +++ b/examples/axon/chans/ak.go @@ -65,28 +65,28 @@ func (ap *AKParams) Proximal() { ap.Hf = 0.1112 } -// AlphaFmVK returns the Alpha function from vbio (not normalized, must not exceed 0) -func (ap *AKParams) AlphaFmVK(vbio, k float32) float32 { +// AlphaFromVK returns the Alpha function from vbio (not normalized, must not exceed 0) +func (ap *AKParams) AlphaFromVK(vbio, k float32) float32 { return mat32.FastExp(0.03707 * k * (vbio - ap.Voff)) } -// BetaFmVK returns the Beta function from vbio (not normalized, must not exceed 0) -func (ap *AKParams) BetaFmVK(vbio, k float32) float32 { +// BetaFromVK returns the Beta function from vbio (not normalized, must not exceed 0) +func (ap *AKParams) BetaFromVK(vbio, k float32) float32 { return mat32.FastExp(ap.Beta * k * (vbio - ap.Voff)) } -// KFmV returns the K value from vbio (not normalized, must not exceed 0) -func (ap *AKParams) KFmV(vbio float32) float32 { +// KFromV returns the K value from vbio (not normalized, must not exceed 0) +func (ap *AKParams) KFromV(vbio float32) float32 { return -ap.Koff - 1.0/(1.0+mat32.FastExp((vbio+40)/5)) } -// HFmV returns the H gate value from vbio (not normalized, must not exceed 0) -func (ap *AKParams) HFmV(vbio float32) float32 { +// HFromV returns the H gate value from vbio (not normalized, must not exceed 0) +func (ap *AKParams) HFromV(vbio float32) float32 { return 1.0 / (1.0 + mat32.FastExp(ap.Hf*(vbio+56))) } -// HTauFmV returns the HTau rate constant in msec from vbio (not normalized, must not exceed 0) -func (ap *AKParams) HTauFmV(vbio float32) float32 { +// HTauFromV returns the HTau rate constant in msec from vbio (not normalized, must not exceed 0) +func (ap *AKParams) HTauFromV(vbio float32) float32 { tau := 0.26 * (vbio + 50) if tau < 2 { tau = 2 @@ -94,30 +94,30 @@ func (ap *AKParams) HTauFmV(vbio float32) float32 { return tau } -// MFmAlpha returns the M gate factor from alpha -func (ap *AKParams) MFmAlpha(alpha float32) float32 { +// MFromAlpha returns the M gate factor from alpha +func (ap *AKParams) MFromAlpha(alpha float32) float32 { return 1.0 / (1.0 + alpha) } -// MTauFmAlphaBeta returns the MTau rate constant in msec from alpha, beta -func (ap *AKParams) MTauFmAlphaBeta(alpha, beta float32) float32 { +// MTauFromAlphaBeta returns the MTau rate constant in msec from alpha, beta +func (ap *AKParams) MTauFromAlphaBeta(alpha, beta float32) float32 { return 1 + beta/(ap.Dm*(1+alpha)) // minimum of 1 msec } -// DMHFmV returns the change at msec update scale in M, H factors +// DMHFromV returns the change at msec update scale in M, H factors // as a function of V normalized (0-1) -func (ap *AKParams) DMHFmV(v, m, h float32) (float32, float32) { +func (ap *AKParams) DMHFromV(v, m, h float32) (float32, float32) { vbio := VToBio(v) if vbio > 0 { vbio = 0 } - k := ap.KFmV(vbio) - a := ap.AlphaFmVK(vbio, k) - b := ap.BetaFmVK(vbio, k) - mt := ap.MTauFmAlphaBeta(a, b) - ht := ap.HTauFmV(vbio) - dm := (ap.MFmAlpha(a) - m) / mt - dh := (ap.HFmV(vbio) - h) / ht + k := ap.KFromV(vbio) + a := ap.AlphaFromVK(vbio, k) + b := ap.BetaFromVK(vbio, k) + mt := ap.MTauFromAlphaBeta(a, b) + ht := ap.HTauFromV(vbio) + dm := (ap.MFromAlpha(a) - m) / mt + dh := (ap.HFromV(vbio) - h) / ht return dm, dh } @@ -167,23 +167,23 @@ func (ap *AKsParams) Defaults() { func (ap *AKsParams) Update() { } -// MFmV returns the M gate function from vbio -func (ap *AKsParams) MFmV(vbio float32) float32 { +// MFromV returns the M gate function from vbio +func (ap *AKsParams) MFromV(vbio float32) float32 { if vbio > ap.Vmax { vbio = ap.Vmax } return ap.Hf / (1.0 + mat32.FastExp(-ap.Mf*(vbio+ap.Voff))) } -// MFmVnorm returns the M gate function from vnorm -func (ap *AKsParams) MFmVnorm(v float32) float32 { - return ap.MFmV(VToBio(v)) +// MFromVnorm returns the M gate function from vnorm +func (ap *AKsParams) MFromVnorm(v float32) float32 { + return ap.MFromV(VToBio(v)) } // Gak returns the conductance as a function of normalized Vm -// GBar * MFmVnorm(v) +// GBar * MFromVnorm(v) func (ap *AKsParams) Gak(v float32) float32 { - return ap.Gbar * ap.MFmVnorm(v) + return ap.Gbar * ap.MFromVnorm(v) } //gosl: end axon diff --git a/examples/axon/chans/chans.go b/examples/axon/chans/chans.go index e06d48c..c71caab 100644 --- a/examples/axon/chans/chans.go +++ b/examples/axon/chans/chans.go @@ -34,9 +34,9 @@ func VToBio(vm float32) float32 { return vm*100 - 100 } -// VFmBio returns normalized 0-1 voltage from biological mV voltage +// VFromBio returns normalized 0-1 voltage from biological mV voltage // where 0 = -100mV and 1 = 0mV -func VFmBio(vm float32) float32 { +func VFromBio(vm float32) float32 { return (vm + 100) / 100 } @@ -49,16 +49,16 @@ func (ch *Chans) SetAll(e, l, i, k float32) { ch.E, ch.L, ch.I, ch.K = e, l, i, k } -// SetFmOtherMinus sets all the values from other Chans minus given value -func (ch *Chans) SetFmOtherMinus(oth Chans, minus float32) { +// SetFromOtherMinus sets all the values from other Chans minus given value +func (ch *Chans) SetFromOtherMinus(oth Chans, minus float32) { ch.E = oth.E - minus ch.L = oth.L - minus ch.I = oth.I - minus ch.K = oth.K - minus } -// SetFmMinusOther sets all the values from given value minus other Chans -func (ch *Chans) SetFmMinusOther(minus float32, oth Chans) { +// SetFromMinusOther sets all the values from given value minus other Chans +func (ch *Chans) SetFromMinusOther(minus float32, oth Chans) { ch.E = minus - oth.E ch.L = minus - oth.L ch.I = minus - oth.I diff --git a/examples/axon/chans/gabab.go b/examples/axon/chans/gabab.go index 5ae95ea..97ad68e 100644 --- a/examples/axon/chans/gabab.go +++ b/examples/axon/chans/gabab.go @@ -52,8 +52,8 @@ func (gp *GABABParams) Update() { gp.MaxTime = ((gp.RiseTau * gp.DecayTau) / (gp.DecayTau - gp.RiseTau)) * mat32.Log(gp.DecayTau/gp.RiseTau) } -// GFmV returns the GABA-B conductance as a function of normalized membrane potential -func (gp *GABABParams) GFmV(v float32) float32 { +// GFromV returns the GABA-B conductance as a function of normalized membrane potential +func (gp *GABABParams) GFromV(v float32) float32 { var vbio float32 vbio = VToBio(v) if vbio < -90 { @@ -62,9 +62,9 @@ func (gp *GABABParams) GFmV(v float32) float32 { return 1.0 / (1.0 + mat32.FastExp(0.1*((vbio+90)+10))) } -// GFmS returns the GABA-B conductance as a function of GABA spiking rate, +// GFromS returns the GABA-B conductance as a function of GABA spiking rate, // based on normalized spiking factor (i.e., Gi from FFFB etc) -func (gp *GABABParams) GFmS(s float32) float32 { +func (gp *GABABParams) GFromS(s float32) float32 { var ss float32 ss = s * gp.GiSpike if ss > 10 { @@ -83,22 +83,22 @@ func (gp *GABABParams) DX(x float32) float32 { return -x / gp.DecayTau } -// GFmGX returns the updated GABA-B / GIRK conductance +// GFromGX returns the updated GABA-B / GIRK conductance // based on current values and gi inhibitory conductance (proxy for GABA spikes) -func (gp *GABABParams) GFmGX(gabaB, gabaBx float32) float32 { +func (gp *GABABParams) GFromGX(gabaB, gabaBx float32) float32 { return gabaB + gp.DG(gabaB, gabaBx) } -// XFmGiX returns the updated GABA-B x value +// XFromGiX returns the updated GABA-B x value // based on current values and gi inhibitory conductance (proxy for GABA spikes) -func (gp *GABABParams) XFmGiX(gabaBx, gi float32) float32 { - return gabaBx + gp.GFmS(gi) + gp.DX(gabaBx) +func (gp *GABABParams) XFromGiX(gabaBx, gi float32) float32 { + return gabaBx + gp.GFromS(gi) + gp.DX(gabaBx) } // GgabaB returns the overall net GABAB / GIRK conductance including // Gbar, Gbase, and voltage-gating func (gp *GABABParams) GgabaB(gabaB, vm float32) float32 { - return gp.Gbar * gp.GFmV(vm) * (gabaB + gp.Gbase) + return gp.Gbar * gp.GFromV(vm) * (gabaB + gp.Gbase) } //gosl: end axon diff --git a/examples/axon/chans/kna.go b/examples/axon/chans/kna.go index c65093c..765321d 100644 --- a/examples/axon/chans/kna.go +++ b/examples/axon/chans/kna.go @@ -45,8 +45,8 @@ func (ka *KNaParams) Update() { ka.Dt = 1 / ka.Tau } -// GcFmSpike updates the KNa conductance based on spike or not -func (ka *KNaParams) GcFmSpike(gKNa *float32, spike bool) { +// GcFromSpike updates the KNa conductance based on spike or not +func (ka *KNaParams) GcFromSpike(gKNa *float32, spike bool) { if slbool.IsTrue(ka.On) { if spike { *gKNa += ka.Rise * (ka.Max - *gKNa) @@ -92,10 +92,10 @@ func (ka *KNaMedSlow) Update() { ka.Slow.Update() } -// GcFmSpike updates med, slow time scales of KNa adaptation from spiking -func (ka *KNaMedSlow) GcFmSpike(gKNaM, gKNaS *float32, spike bool) { - ka.Med.GcFmSpike(gKNaM, spike) - ka.Slow.GcFmSpike(gKNaS, spike) +// GcFromSpike updates med, slow time scales of KNa adaptation from spiking +func (ka *KNaMedSlow) GcFromSpike(gKNaM, gKNaS *float32, spike bool) { + ka.Med.GcFromSpike(gKNaM, spike) + ka.Slow.GcFromSpike(gKNaS, spike) } //gosl: end axon diff --git a/examples/axon/chans/mahp.go b/examples/axon/chans/mahp.go index 53353e9..2f7c511 100644 --- a/examples/axon/chans/mahp.go +++ b/examples/axon/chans/mahp.go @@ -59,9 +59,9 @@ func (mp *MahpParams) EFun(z float32) float32 { return z / (mat32.FastExp(z) - 1.0) } -// NinfTauFmV returns the target infinite-time N gate value and +// NinfTauFromV returns the target infinite-time N gate value and // voltage-dependent time constant tau, from vbio -func (mp *MahpParams) NinfTauFmV(vbio float32, ninf, tau *float32) { +func (mp *MahpParams) NinfTauFromV(vbio float32, ninf, tau *float32) { var vo, a, b float32 vo = vbio - mp.Voff @@ -76,16 +76,16 @@ func (mp *MahpParams) NinfTauFmV(vbio float32, ninf, tau *float32) { *tau /= mp.Tadj // correct right away.. } -// NinfTauFmVnorm returns the target infinite-time N gate value and +// NinfTauFromVnorm returns the target infinite-time N gate value and // voltage-dependent time constant tau, from normalized vm -func (mp *MahpParams) NinfTauFmVnorm(v float32, ninf, tau *float32) { - mp.NinfTauFmV(VToBio(v), ninf, tau) +func (mp *MahpParams) NinfTauFromVnorm(v float32, ninf, tau *float32) { + mp.NinfTauFromV(VToBio(v), ninf, tau) } -// DNFmV returns the change in gating factor N based on normalized Vm -func (mp *MahpParams) DNFmV(v, n float32) float32 { +// DNFromV returns the change in gating factor N based on normalized Vm +func (mp *MahpParams) DNFromV(v, n float32) float32 { var ninf, tau float32 - mp.NinfTauFmVnorm(v, &ninf, &tau) + mp.NinfTauFromVnorm(v, &ninf, &tau) // dt := 1.0 - mat32.FastExp(-mp.Tadj/tau) // Mainen comments out this form; Poirazi uses // dt := mp.Tadj / tau // simple linear fix return (ninf - n) / tau diff --git a/examples/axon/chans/nmda.go b/examples/axon/chans/nmda.go index 2525cd2..419dd46 100644 --- a/examples/axon/chans/nmda.go +++ b/examples/axon/chans/nmda.go @@ -55,9 +55,9 @@ func (np *NMDAParams) Update() { np.MgFact = np.MgC / 3.57 } -// MgGFmVbio returns the NMDA conductance as a function of biological membrane potential +// MgGFromVbio returns the NMDA conductance as a function of biological membrane potential // based on Mg ion blocking -func (np *NMDAParams) MgGFmVbio(vbio float32) float32 { +func (np *NMDAParams) MgGFromVbio(vbio float32) float32 { vbio += np.Voff if vbio >= 0 { return 0 @@ -65,16 +65,16 @@ func (np *NMDAParams) MgGFmVbio(vbio float32) float32 { return 1.0 / (1.0 + np.MgFact*mat32.FastExp(-0.062*vbio)) } -// MgGFmV returns the NMDA conductance as a function of normalized membrane potential +// MgGFromV returns the NMDA conductance as a function of normalized membrane potential // based on Mg ion blocking -func (np *NMDAParams) MgGFmV(v float32) float32 { - return np.MgGFmVbio(VToBio(v)) +func (np *NMDAParams) MgGFromV(v float32) float32 { + return np.MgGFromVbio(VToBio(v)) } -// CaFmVbio returns the calcium current factor as a function of biological membrane -// potential -- this factor is needed for computing the calcium current * MgGFmV. +// CaFromVbio returns the calcium current factor as a function of biological membrane +// potential -- this factor is needed for computing the calcium current * MgGFromV. // This is the same function used in VGCC for their conductance factor. -func (np *NMDAParams) CaFmVbio(vbio float32) float32 { +func (np *NMDAParams) CaFromVbio(vbio float32) float32 { vbio += np.Voff if vbio > -0.1 && vbio < 0.1 { return 1.0 / (0.0756 + 0.5*vbio) @@ -82,10 +82,10 @@ func (np *NMDAParams) CaFmVbio(vbio float32) float32 { return -vbio / (1.0 - mat32.FastExp(0.0756*vbio)) } -// CaFmV returns the calcium current factor as a function of normalized membrane -// potential -- this factor is needed for computing the calcium current * MgGFmV -func (np *NMDAParams) CaFmV(v float32) float32 { - return np.CaFmVbio(VToBio(v)) +// CaFromV returns the calcium current factor as a function of normalized membrane +// potential -- this factor is needed for computing the calcium current * MgGFromV +func (np *NMDAParams) CaFromV(v float32) float32 { + return np.CaFromVbio(VToBio(v)) } // NMDASyn returns the updated synaptic NMDA Glu binding @@ -97,13 +97,13 @@ func (np *NMDAParams) NMDASyn(nmda, raw float32) float32 { // Gnmda returns the NMDA net conductance from nmda Glu binding and Vm // including the GBar factor func (np *NMDAParams) Gnmda(nmda, vm float32) float32 { - return np.Gbar * np.MgGFmV(vm) * nmda + return np.Gbar * np.MgGFromV(vm) * nmda } -// SnmdaFmSpike updates sender-based NMDA channel opening based on neural spiking +// SnmdaFromSpike updates sender-based NMDA channel opening based on neural spiking // using the inhibition and decay factors. These dynamics closely match the // Urakubo et al (2008) allosteric NMDA receptor behavior, with ITau = 100, Tau = 30 -func (np *NMDAParams) SnmdaFmSpike(spike float32, snmdaO, snmdaI *float32) { +func (np *NMDAParams) SnmdaFromSpike(spike float32, snmdaO, snmdaI *float32) { if spike > 0 { var inh float32 inh = (1 - *snmdaI) diff --git a/examples/axon/chans/sahp.go b/examples/axon/chans/sahp.go index c6fee9a..7e0994b 100644 --- a/examples/axon/chans/sahp.go +++ b/examples/axon/chans/sahp.go @@ -64,9 +64,9 @@ func (mp *SahpParams) EFun(z float32) float32 { return z / (mat32.FastExp(z) - 1.0) } -// NinfTauFmCa returns the target infinite-time N gate value and +// NinfTauFromCa returns the target infinite-time N gate value and // time constant tau, from integrated Ca value -func (mp *SahpParams) NinfTauFmCa(ca float32, ninf, tau *float32) { +func (mp *SahpParams) NinfTauFromCa(ca float32, ninf, tau *float32) { var co, a, b float32 co = ca - mp.Off @@ -86,11 +86,11 @@ func (mp *SahpParams) CaInt(caInt, ca float32) float32 { return caInt } -// DNFmCa returns the change in gating factor N based on integrated Ca +// DNFromCa returns the change in gating factor N based on integrated Ca // Omit this and just use ninf directly for theta-cycle updating. -func (mp *SahpParams) DNFmV(ca, n float32) float32 { +func (mp *SahpParams) DNFromV(ca, n float32) float32 { var ninf, tau float32 - mp.NinfTauFmCa(ca, &ninf, &tau) + mp.NinfTauFromCa(ca, &ninf, &tau) return (ninf - n) / tau } diff --git a/examples/axon/chans/vgcc.go b/examples/axon/chans/vgcc.go index df09034..6ec2afb 100644 --- a/examples/axon/chans/vgcc.go +++ b/examples/axon/chans/vgcc.go @@ -30,8 +30,8 @@ func (np *VGCCParams) Defaults() { func (np *VGCCParams) Update() { } -// GFmV returns the VGCC conductance as a function of normalized membrane potential -func (np *VGCCParams) GFmV(v float32) float32 { +// GFromV returns the VGCC conductance as a function of normalized membrane potential +func (np *VGCCParams) GFromV(v float32) float32 { var vbio float32 vbio = VToBio(v) if vbio > -0.1 && vbio < 0.1 { @@ -40,8 +40,8 @@ func (np *VGCCParams) GFmV(v float32) float32 { return -vbio / (1.0 - mat32.FastExp(0.0756*vbio)) } -// MFmV returns the M gate function from vbio (not normalized, must not exceed 0) -func (np *VGCCParams) MFmV(vbio float32) float32 { +// MFromV returns the M gate function from vbio (not normalized, must not exceed 0) +func (np *VGCCParams) MFromV(vbio float32) float32 { if vbio < -60 { return 0 } @@ -51,8 +51,8 @@ func (np *VGCCParams) MFmV(vbio float32) float32 { return 1.0 / (1.0 + mat32.FastExp(-(vbio + 37))) } -// HFmV returns the H gate function from vbio (not normalized, must not exceed 0) -func (np *VGCCParams) HFmV(vbio float32) float32 { +// HFromV returns the H gate function from vbio (not normalized, must not exceed 0) +func (np *VGCCParams) HFromV(vbio float32) float32 { if vbio < -50 { return 1 } @@ -62,26 +62,26 @@ func (np *VGCCParams) HFmV(vbio float32) float32 { return 1.0 / (1.0 + mat32.FastExp((vbio+41)*2)) } -// DMHFmV returns the change at msec update scale in M, H factors +// DMHFromV returns the change at msec update scale in M, H factors // as a function of V normalized (0-1) -func (np *VGCCParams) DMHFmV(v, m, h float32, dm, dh *float32) { +func (np *VGCCParams) DMHFromV(v, m, h float32, dm, dh *float32) { var vbio float32 vbio = VToBio(v) if vbio > 0 { vbio = 0 } - *dm = (np.MFmV(vbio) - m) / 3.6 - *dh = (np.HFmV(vbio) - h) / 29.0 + *dm = (np.MFromV(vbio) - m) / 3.6 + *dh = (np.HFromV(vbio) - h) / 29.0 } // Gvgcc returns the VGCC net conductance from m, h activation and vm func (np *VGCCParams) Gvgcc(vm, m, h float32) float32 { - return np.Gbar * np.GFmV(vm) * m * m * m * h + return np.Gbar * np.GFromV(vm) * m * m * m * h } -// CaFmG returns the Ca from Gvgcc conductance, current Ca level, +// CaFromG returns the Ca from Gvgcc conductance, current Ca level, // and normalized membrane potential. -func (np *VGCCParams) CaFmG(v, g, ca float32) float32 { +func (np *VGCCParams) CaFromG(v, g, ca float32) float32 { var vbio float32 vbio = VToBio(v) return -vbio * np.Ca * g diff --git a/examples/axon/kinase/kinase.go b/examples/axon/kinase/kinase.go index 5bc004c..3dea39a 100644 --- a/examples/axon/kinase/kinase.go +++ b/examples/axon/kinase/kinase.go @@ -77,27 +77,27 @@ func (kp *CaParams) Update() { kp.Dt.Update() } -// FmSpike computes updates to CaM, CaP, CaD from current spike value. +// FromSpike computes updates to CaM, CaP, CaD from current spike value. // The SpikeG factor determines strength of increase to CaM. -func (kp *CaParams) FmSpike(spike float32, caM, caP, caD *float32) { +func (kp *CaParams) FromSpike(spike float32, caM, caP, caD *float32) { *caM += kp.Dt.MDt * (kp.SpikeG*spike - *caM) *caP += kp.Dt.PDt * (*caM - *caP) *caD += kp.Dt.DDt * (*caP - *caD) } -// FmCa computes updates to CaM, CaP, CaD from current calcium level. +// FromCa computes updates to CaM, CaP, CaD from current calcium level. // The SpikeG factor is NOT applied to Ca and should be pre-applied // as appropriate. -func (kp *CaParams) FmCa(ca float32, caM, caP, caD *float32) { +func (kp *CaParams) FromCa(ca float32, caM, caP, caD *float32) { *caM += kp.Dt.MDt * (ca - *caM) *caP += kp.Dt.PDt * (*caM - *caP) *caD += kp.Dt.DDt * (*caP - *caD) } -// IntFmTime returns the interval from current time +// IntFromTime returns the interval from current time // and last update time, which is -1 if never updated // (in which case return is -1) -func (kp *CaParams) IntFmTime(ctime, utime int32) int32 { +func (kp *CaParams) IntFromTime(ctime, utime int32) int32 { if utime < 0 { return -1 } @@ -108,7 +108,7 @@ func (kp *CaParams) IntFmTime(ctime, utime int32) int32 { // optimized spike-time update versions. // ctime is current time in msec, and utime is last update time (-1 if never) func (kp *CaParams) CurCa(ctime, utime int32, caM, caP, caD *float32) { - isi := kp.IntFmTime(ctime, utime) + isi := kp.IntFromTime(ctime, utime) if isi <= 0 { return } @@ -119,7 +119,7 @@ func (kp *CaParams) CurCa(ctime, utime int32, caM, caP, caD *float32) { return } for i := int32(0); i < isi; i++ { - kp.FmCa(0, caM, caP, caD) // just decay to 0 + kp.FromCa(0, caM, caP, caD) // just decay to 0 } } diff --git a/examples/axon/layer.go b/examples/axon/layer.go index ddd5c4f..72a5243 100644 --- a/examples/axon/layer.go +++ b/examples/axon/layer.go @@ -47,15 +47,15 @@ func (ly *Layer) UpdateParams() { func (ly *Layer) GiInteg(ni int, nrn *Neuron, ctime *Time) { nrn.Gi = nrn.GiSyn + nrn.GiNoise nrn.SSGiDend = ly.Act.Dend.SSGi - nrn.GABAB = ly.Act.GABAB.GFmGX(nrn.GABAB, nrn.GABABx) - nrn.GABABx = ly.Act.GABAB.XFmGiX(nrn.GABABx, nrn.Gi) + nrn.GABAB = ly.Act.GABAB.GFromGX(nrn.GABAB, nrn.GABABx) + nrn.GABABx = ly.Act.GABAB.XFromGiX(nrn.GABABx, nrn.Gi) nrn.GgabaB = ly.Act.GABAB.GgabaB(nrn.GABAB, nrn.VmDend) nrn.Gk += nrn.GgabaB // Gk was already init } -// GFmSpikeRaw integrates G*Raw and G*Syn values for given neuron +// GFromSpikeRaw integrates G*Raw and G*Syn values for given neuron // from the Prjn-level GSyn integrated values. -func (ly *Layer) GFmSpikeRaw(ni int, nrn *Neuron, ctime *Time) { +func (ly *Layer) GFromSpikeRaw(ni int, nrn *Neuron, ctime *Time) { nrn.GeRaw = 0.4 nrn.GiRaw = 0 nrn.GeSyn = nrn.GeBase @@ -63,35 +63,35 @@ func (ly *Layer) GFmSpikeRaw(ni int, nrn *Neuron, ctime *Time) { nrn.GeSyn = nrn.GeRaw } -// GFmRawSyn computes overall Ge and GiSyn conductances for neuron +// GFromRawSyn computes overall Ge and GiSyn conductances for neuron // from GeRaw and GeSyn values, including NMDA, VGCC, AMPA, and GABA-A channels. -func (ly *Layer) GFmRawSyn(ni int, nrn *Neuron, ctime *Time, randctr *sltype.Uint2) { - ly.Act.NMDAFmRaw(nrn, nrn.GeRaw) - ly.Learn.LrnNMDAFmRaw(nrn, nrn.GeRaw) - ly.Act.GvgccFmVm(nrn) - ly.Act.GeFmSyn(ni, nrn, nrn.GeSyn, nrn.Gnmda+nrn.Gvgcc, randctr) // sets nrn.GeExt too - ly.Act.GkFmVm(nrn) - nrn.GiSyn = ly.Act.GiFmSyn(ni, nrn, nrn.GiSyn, randctr) +func (ly *Layer) GFromRawSyn(ni int, nrn *Neuron, ctime *Time, randctr *sltype.Uint2) { + ly.Act.NMDAFromRaw(nrn, nrn.GeRaw) + ly.Learn.LrnNMDAFromRaw(nrn, nrn.GeRaw) + ly.Act.GvgccFromVm(nrn) + ly.Act.GeFromSyn(ni, nrn, nrn.GeSyn, nrn.Gnmda+nrn.Gvgcc, randctr) // sets nrn.GeExt too + ly.Act.GkFromVm(nrn) + nrn.GiSyn = ly.Act.GiFromSyn(ni, nrn, nrn.GiSyn, randctr) } // GInteg integrates conductances G over time (Ge, NMDA, etc). // reads pool Gi values func (ly *Layer) GInteg(ni int, nrn *Neuron, ctime *Time, randctr *sltype.Uint2) { - ly.GFmSpikeRaw(ni, nrn, ctime) + ly.GFromSpikeRaw(ni, nrn, ctime) // note: can add extra values to GeRaw and GeSyn here - ly.GFmRawSyn(ni, nrn, ctime, randctr) + ly.GFromRawSyn(ni, nrn, ctime, randctr) ly.GiInteg(ni, nrn, ctime) } -// SpikeFmG computes Vm from Ge, Gi, Gl conductances and then Spike from that -func (ly *Layer) SpikeFmG(ni int, nrn *Neuron, ctime *Time) { +// SpikeFromG computes Vm from Ge, Gi, Gl conductances and then Spike from that +func (ly *Layer) SpikeFromG(ni int, nrn *Neuron, ctime *Time) { intdt := ly.Act.Dt.IntDt if slbool.IsTrue(ctime.PlusPhase) { intdt *= 3.0 } - ly.Act.VmFmG(nrn) - ly.Act.SpikeFmVm(nrn) - ly.Learn.CaFmSpike(nrn) + ly.Act.VmFromG(nrn) + ly.Act.SpikeFromVm(nrn) + ly.Learn.CaFromSpike(nrn) if ctime.Cycle >= ly.Act.Dt.MaxCycStart { nrn.SpkMaxCa += ly.Learn.CaSpk.Dt.PDt * (nrn.CaSpkM - nrn.SpkMaxCa) if nrn.SpkMaxCa > nrn.SpkMax { @@ -109,7 +109,7 @@ func (ly *Layer) SpikeFmG(ni int, nrn *Neuron, ctime *Time) { func (ly *Layer) CycleNeuron(ni int, nrn *Neuron, ctime *Time) { randctr := ctime.RandCtr.Uint2() // use local var ly.GInteg(ni, nrn, ctime, &randctr) - ly.SpikeFmG(ni, nrn, ctime) + ly.SpikeFromG(ni, nrn, ctime) } func (ly *Layer) CycleTimeInc(ctime *Time) { diff --git a/examples/axon/learn.go b/examples/axon/learn.go index 931229e..cf25712 100644 --- a/examples/axon/learn.go +++ b/examples/axon/learn.go @@ -122,8 +122,8 @@ func (np *CaSpkParams) Update() { np.SynSpkG = mat32.Sqrt(30) / mat32.Sqrt(np.SynTau) } -// CaFmSpike computes CaSpk* and CaSyn calcium signals based on current spike. -func (np *CaSpkParams) CaFmSpike(nrn *Neuron) { +// CaFromSpike computes CaSpk* and CaSyn calcium signals based on current spike. +func (np *CaSpkParams) CaFromSpike(nrn *Neuron) { nsp := np.SpikeG * nrn.Spike nrn.CaSyn += np.SynDt * (nsp - nrn.CaSyn) nrn.CaSpkM += np.Dt.MDt * (nsp - nrn.CaSpkM) @@ -343,24 +343,24 @@ func (ln *LearnNeurParams) DecayCaLrnSpk(nrn *Neuron, decay float32) { nrn.CaD -= decay * nrn.CaD } -// LrnNMDAFmRaw updates the separate NMDA conductance and calcium values +// LrnNMDAFromRaw updates the separate NMDA conductance and calcium values // based on GeTot = GeRaw + external ge conductance. These are the variables // that drive learning -- can be the same as activation but also can be different // for testing learning Ca effects independent of activation effects. -func (ln *LearnNeurParams) LrnNMDAFmRaw(nrn *Neuron, geTot float32) { +func (ln *LearnNeurParams) LrnNMDAFromRaw(nrn *Neuron, geTot float32) { if geTot < 0 { geTot = 0 } nrn.GnmdaLrn = ln.LrnNMDA.NMDASyn(nrn.GnmdaLrn, geTot) gnmda := ln.LrnNMDA.Gnmda(nrn.GnmdaLrn, nrn.VmDend) - nrn.NmdaCa = gnmda * ln.LrnNMDA.CaFmV(nrn.VmDend) - ln.LrnNMDA.SnmdaFmSpike(nrn.Spike, &nrn.SnmdaO, &nrn.SnmdaI) + nrn.NmdaCa = gnmda * ln.LrnNMDA.CaFromV(nrn.VmDend) + ln.LrnNMDA.SnmdaFromSpike(nrn.Spike, &nrn.SnmdaO, &nrn.SnmdaI) } -// CaFmSpike updates all spike-driven calcium variables, including CaLrn and CaSpk. +// CaFromSpike updates all spike-driven calcium variables, including CaLrn and CaSpk. // Computed after new activation for current cycle is updated. -func (ln *LearnNeurParams) CaFmSpike(nrn *Neuron) { - ln.CaSpk.CaFmSpike(nrn) +func (ln *LearnNeurParams) CaFromSpike(nrn *Neuron) { + ln.CaSpk.CaFromSpike(nrn) ln.CaLrn.CaLrn(nrn) } diff --git a/examples/basic/compute.go b/examples/basic/compute.go index 45c2c97..982b3c8 100644 --- a/examples/basic/compute.go +++ b/examples/basic/compute.go @@ -40,8 +40,8 @@ type ParamStruct struct { pad, pad1 float32 } -// IntegFmRaw computes integrated value from current raw value -func (ps *ParamStruct) IntegFmRaw(ds *DataStruct) { +// IntegFromRaw computes integrated value from current raw value +func (ps *ParamStruct) IntegFromRaw(ds *DataStruct) { ds.Integ += ps.Dt * (ds.Raw - ds.Integ) ds.Exp = mat32.FastExp(-ds.Integ) } @@ -68,7 +68,7 @@ func (ps *ParamStruct) Update() { [numthreads(64, 1, 1)] void main(uint3 idx : SV_DispatchThreadID) { - Params[0].IntegFmRaw(Data[idx.x]); + Params[0].IntegFromRaw(Data[idx.x]); } */ //gosl: end basic diff --git a/examples/basic/main.go b/examples/basic/main.go index 14fd65b..a0c9690 100644 --- a/examples/basic/main.go +++ b/examples/basic/main.go @@ -56,7 +56,7 @@ func main() { cpuTmr.Start() for i := range data { d := &data[i] - pars.IntegFmRaw(d) + pars.IntegFromRaw(d) } cpuTmr.Stop() diff --git a/testdata/basic.go b/testdata/basic.go index c6fbf7a..88bed56 100644 --- a/testdata/basic.go +++ b/testdata/basic.go @@ -112,7 +112,7 @@ type ParamStruct struct { pad float32 // comment this out to trigger alignment warning } -func (ps *ParamStruct) IntegFmRaw(ds *DataStruct, modArg *float32) { +func (ps *ParamStruct) IntegFromRaw(ds *DataStruct, modArg *float32) { // note: the following are just to test basic control structures newVal := ps.Dt*(ds.Raw-ds.Integ) + *modArg if newVal < -10 || ps.Option.IsTrue() { @@ -162,7 +162,7 @@ func (ps *ParamStruct) Update() { [[vk::binding(0, 1)]] RWStructuredBuffer Data; [numthreads(1, 1, 1)] void main(uint3 idx : SV_DispatchThreadID) { - Params[0].IntegFmRaw(Data[idx.x], Data[idx.x].Pad2); + Params[0].IntegFromRaw(Data[idx.x], Data[idx.x].Pad2); } */ //gosl: end basic