Bus Errors with NetCon/VecStim

Anything that doesn't fit elsewhere.
Post Reply
adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Bus Errors with NetCon/VecStim

Post by adamimos » Mon May 30, 2011 6:00 pm

I am trying to run code that has N number of Exp2Syn synapses across a dendritic tree. The Exp2Syns are in a list object, and there are corresponding lists of both netcons and vecstim objects. The vecstims have a vector with length >1 that they play from. When I try to run this setup I get the following code:

Code: Select all

oc>run()
/Applications/NEURON-7.2/nrn/umac/bin/nrniv.app/Contents/MacOS/nrniv: Bus error See $NEURONHOME/lib/help/oc.help
 near line 1
 run()
      ^
        finitialize(-65)
      init()
    stdinit()
  run()
I have a few parameters, which might be helpful in figuring out what's wrong. The following two seem relevant:

* Cycles - the length of the vector which the vecstims play from
* synapses - the length of the list of synapses, netcons, and vecstims.

If I make both = 1, then there are no errors. If i make cycles = 1, and synapses = 2, then I get a different error:

Code: Select all

net_send td-t = -2.75253e-307 SelfEvent target=VecStim[0] 0 flag=1
/myfolder/2011May21-CA1BarragesWithNetstim/umac/special: line 13: 27946 Abort trap              "${NRNIV}" -dll "/myfolder/2011May21-CA1BarragesWithNetstim/umac/.libs/libnrnmech.so" "$@"
If I make cycles = 1, and synapses = 20, then I get the bus error. If I make synapses = 1 and cycles = 2 then I get the td-t error. It seems like there is some threshold for the total number of events (somewhere between 2 and 20) that switches which error I get.

I've obviously left out a lot of code, because I don't want to just send my code to someone else to labor through. I was hoping that maybe there were enough hints here to maybe steer me in some direction for where to look!

If none of this makes any sense without some outline of a code, here is this outline:

Code: Select all

FREQ = 8
NUMBER_SYNS = 1
CYCLES = 2


printf("\n\n\n\n\n NEURON SIMULATION")
printf("In this simulation we distribute %d synapses across the apical dendrite.\n",NUMBER_SYNS)
printf("The stimulation will occur according to a sinusoidal distribution with frequence %d.\n\n\n",FREQ)


// DISTRIBUTE THE EXP2SYNS STOCHASTICLY ACCORSS GIVEN SECTIONLIST
// USAGE: OUTPUT_SYNAPSE_LIST = distSyns(NUMBER_SYNAPSES,SECTIONLIST,REVERSAL_POTENTIAL,TAU1,TAU2)
objref theSyns
theSyns = distSyns(NUMBER_SYNS,apical_dendrite,0,1,10)

// RETURN A VECTOR OF SINUSOIDAL DISTRIBUTED SPIKE TIMES
// USAGE: OUTPUT_SPIKE_TIMES = sinDist(SYNAPSE_LIST, NUMBER_CYCLES, FREQUENCY)
objref synTimes
synTimes = sinDist(theSyns,CYCLES,FREQ)

// DISTRIBUTE THE INPUT STIMULUS TIMES TO THE SYNAPSES
// USAGE: OUTPUT_VECSTIM_LIST = defStim(SYNAPSE_LIST, SYNAPSE_TIMES, FREQUENCY)
objref stimVec
stimVec = defStim(theSyns,synTimes,FREQ)

// CONNECT THE INPUT STIMULUS TO THE SYNAPSES
// USAGE: OUTPUT_NETCON_LIST = defNC(SYNAPSE_LIST, VECSTIM_LIST)
objref theNCons
theNCons = defNC(theSyns,stimVec)

Thanks,
Adam

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

Re: Bus Errors with NetCon/VecStim

Post by ted » Mon May 30, 2011 10:06 pm

Not enough information in your post. Maybe not enough in your code either, or at least "not expressed clearly enough to succeed when fed to a (stupid) computer." Which suggests maybe not enough for a human to guess what you're thinking, either.

Can you state, in plain language, what you're trying to achieve?
What is your definition of "sinusoidal distribiton"?

adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Re: Bus Errors with NetCon/VecStim

Post by adamimos » Tue May 31, 2011 12:57 am

ted wrote:Not enough information in your post. Maybe not enough in your code either, or at least "not expressed clearly enough to succeed when fed to a (stupid) computer." Which suggests maybe not enough for a human to guess what you're thinking, either.

Can you state, in plain language, what you're trying to achieve?
What is your definition of "sinusoidal distribiton"?
I am, as an example, trying to distribute 200 Exp2Syn synapses across a sectionList (I'm pretty sure this part works completely). This gives me a list of 200 pointproccesses. I want to have oscillatory input that works in this fashion: each cycle (period), the synapse timing comes according to a distribution that looks like sin(2 pi f t). although obviously normalized so that the distribution integrates to 1 within each period. So what I do is the following:

If I want the simulation to run with oscillatory input with f = 5 Hz for 3 cycles, then I make a vector with 3*200 values picked from a distribution propto sin(2 pi 5 t) from t = -125 ms to 125 ms. (again, pretty sure this part works fine) Then I make a list of 200 vecStim point processes, and for each I do vecstim[n].play(vector) where vector is 3 numbers long, and the numbers are: [rand1+125, rand2+125*2,rand3+125*3], where the rands are the previously discused sinusoidal distributed values.

After that I make a list of netcons which connect each Exp2Syn from the list of pointProcesses to a vecStim from the list of vecStims.

adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Re: Bus Errors with NetCon/VecStim

Post by adamimos » Tue May 31, 2011 1:17 am

maybe putting some more code is appropriate at this point:

this is the function that defines the list of vecStims

Code: Select all

objref stimList

obfunc defStim() { local nSyns, nCycs, OFFSET, f localobj tobj, tvec, sTimes
       nSyns = $o1.count()         // THE NUMBER OF SYNAPSES
       nCycs = $o2.size()/nSyns  // THE NUMBER OF CYCLES
       OFFSET = 100
       f = $3/1000                      //CONVERT HZ TO 1/MS
       sTimes = $o2                    //A VECTOR OF SINUSOIDALLY DISTRIBUTED TIMES (WITHIN ONE PERIOD)

       stimList = new List()
       
       printf("SYNAPSE #\t")
       for i=0,nCycs-1 { printf("CYCLE %d \t",i+1) }
       printf("\n")
       printf("_________\t")
       for i=0,nCycs-1 { printf("__________ \t") }
       printf("\n")
       
       for i=0,nSyns-1 {
       	   tobj = new VecStim()                                      // TEMPORARY VECSTIM OBJECT
	   tvec = new Vector(nCycs)

	   printf("Synapse %d\t",i+1)

	   for j=0,nCycs-1 {	
	       tvec.x[j]=OFFSET+j/f+sTimes.x[j+i*nCycs]  // BUILD UP THE TIMES IN ALL CYCLES FOR ONE SYNAPSE
	       printf("%f\t",tvec.x[j])	      
	   }
	   tobj.play(tvec)                                             // ASSIGN THE TIMES TO THE VECSTIM
       	   stimList.append(tobj)                                    // APPEND THE VECSTIM OBJECT TO THE LIST

	   printf("\n")
	   
       }
       return stimList
}

and then here is the code for defining the netcon list

Code: Select all

objref ncList

obfunc defNC() { localobj synL, stimL, tnc
       
       synL = $o1                              \\ LIST OF SYNAPSES
       stimL = $o2                             \\ LIST OF VECSTIMS
       ncList = new List()

       for i=0,synL.count()-1 {
       	   tnc = new NetCon(stimL.o(i),synL.o(i))           \\ DEFINE CONNECTION BETWEEN 1 VECSTIM AND 1 SYNAPSE
	   tnc.weight = 100                                           \\ SET THE WEIGHT OF THE NETCON
	   ncList.append(tnc)                                        \\ APPEND THE NETCON TO THE LIST
       }
       
       return ncList
}

adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Re: Bus Errors with NetCon/VecStim

Post by adamimos » Tue May 31, 2011 11:38 am

Ok, I am trying to play with the code a bit to see where the problem lies. Is there a way to print the vector which the vecstim object plays from (to make sure that the times are correct?)

I believe that something is going wrong with assigning the vector to play from, when I modified my code to force a lone synapse in a lone cycle to recieve a vecstim at 500 ms, the exp2syn went off at t=0... which leads me to believe that something with the play vector isnt working.

adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Re: Bus Errors with NetCon/VecStim

Post by adamimos » Tue May 31, 2011 5:42 pm

I got it working. :)

I'll post up what the problem was and how to fix it within the next day for posterity.

adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Re: Bus Errors with NetCon/VecStim

Post by adamimos » Tue May 31, 2011 6:17 pm

OK. What seemed to be the problem was that I was assigning the play vector for the vecStim objects within an objectfunction and passing a list of those vecStim objects back to my main code. For some reason (maybe Ted will know the answer), this did not work.

When instead, I called vecStim.play(some_vector) within a procedure directly (and not within a function), the code worked.

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

Re: Bus Errors with NetCon/VecStim

Post by ted » Tue May 31, 2011 7:45 pm

Can't tell much without seeing more of your code than necessary (not "necessary" any more because you solved the problem to your own satisfaction). Interesting to see how others solve problems. Thanks for sharing what you did. After you publish your work, please be sure to contribute a new model entry to ModelDB.

Post Reply