run() inside loop

The basics of how to develop, test, and use models.
Post Reply
ulrikhp

run() inside loop

Post by ulrikhp »

Hi,

I'm having some problems using run() inside a while loop. I have inserted a Exp2Syn
in a dendrite and now want to see the effect of changing the time constants.
For each set of tau0 and tau1 values I increase the value of the peak conductance
until I get the desired response in soma (I do this using a while loop). For some reason, the value of tau1
changes inside the while loop (during run() ). Once the value has changed, it stays the same for the remaining iterations.

Here's the part of my code where things go wrong:

Code: Select all

tau1_max = 1
tau1_bins = 100
incr1 = tau1_bins/tau1_max

tau2_max = 2.5
tau2_bins = 10
incr2 = tau1_bins/tau2_max
 
depol = 3
recsoma.record(&soma.v(0.5))
// _________________________________________________________________________
// ___________FOR LOOPS: VARYING TIME CONSTANTS AND PEAK CONDUCTANCE_______
for i=0,tau1_bins {
        AMPAsyn.tau1 = (i+1)/incr1
        for n=0,tau2_bins {
                AMPAsyn.tau2 = (n+1)/incr2
                nc.weight=0
                run()                    
                print "tau1 = ", AMPAsyn.tau1, "; tau1 = ", AMPAsyn.tau2               
                //increasing peak conductance until depolarization in soma is reached                
                while (recsoma.max+70 < depol) {
                        nc.weight = nc.weight+.0001
                        recsoma.resize(0)
                        run()
                                        }
                        recsoma.resize(0)
                //appending correct value to conductance vector
                CondVector.append(nc.weight)
                }
        //saving CondVector to next column in matrix
        CondMatrix.resize(CondVector.size(),i+1)
        CondMatrix.setcol(i, CondVector)
        CondVector.resize(0)        
        }
The problem seems to arise at the thrid iteration of the outside loop (setting tau1) regardless of the loop parameters.
Could the problem be my understanding of what run() actually does?

~Ulrik
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: run() inside loop

Post by ted »

The Programmer's Reference entry for Exp2Syn contains the following statements:
"Two state kinetic scheme synapse described by rise time tau1, and decay time constant tau2. . . . Decay time MUST be greater than rise time.
. . .
See $NEURONHOME/src/nrnoc/exp2syn.mod"

The INITIAL block of exp2syn.mod contains the following conditional statement

Code: Select all

        if (tau1/tau2 > .9999) {
                tau1 = .9999*tau2
        }
to ensure that tau2>tau1. This code is executed on every initialization, which means every time run() is called.
ulrikhp

Re: run() inside loop

Post by ulrikhp »

Of course! And thank you - that solved the problem!

Best regards,
Ulrik
Post Reply