Find threshold with APCount

The basics of how to develop, test, and use models.
Post Reply
Christine Chung
Posts: 17
Joined: Fri May 03, 2019 2:41 am

Find threshold with APCount

Post by Christine Chung »

Hi,
I have some questions about APCount.

1. I read explanation about APCount at programmer's reference.

apc = h.APCount(section(x))

Here, section(x) should be written only number?
For eaxmple, I write apc=h.APCount(0.5) for see threshold of soma.
Can I use section name?

2. If not, How can I know the number indicating what?
I know that 0.5 indicates soma and dendritic end is 0, the other end is 1.
How about more details?

Thanks in advance,

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

Re: Find threshold with APCount

Post by ted »

APCount doesn't find spike threshold. It monitors membrane potential at a particular location in a model cell, and returns the number of times that membrane potential at that location crossed a threshold in a positive-going direction.
apc = h.APCount(section(x))

Here, section(x) should be written only number?
Replace the string "section" with the name of the section that you're interested in. The value of x should specify the location in that section where you want to monitor membrane potential. If the section is called soma and you want to monitor membrane potential at the middle of the soma, the statement would be
apc = h.APCount(soma(0.5))
I know that 0.5 indicates soma and dendritic end is 0, the other end is 1.
No. In the syntax summary
apc = h.APCount(section(x))
the value of x is the normalized distance between the point of interest and the section's 0 end. Example: if a section is 200 um long and you are interested in a point that is 40 um from the section's 0 end, you'll want the value of x to be 40/200 = 0.2.

Have you read chapter 4 or 5 in the NEURON Book? If you don't have the book, maybe it would help to read this article
Hines, M.L. and Carnevale, N.T.
The NEURON Simulation Environment
Neural Computation 9:1179-1209, 1997
HTML and PDF versions available from https://neuron.yale.edu/neuron/static/p ... /nctoc.htm
Christine Chung
Posts: 17
Joined: Fri May 03, 2019 2:41 am

Re: Find threshold with APCount

Post by Christine Chung »

Thanks for your kind explanation, Ted.

I monitored apc.n by increasing stimulation amplitude to find out the point where apc.n >0 (threshold).
And I want to see apc.n of soma, dendrites and axon.

I read NEURON book ch.4 and 5. Thanks for your suggestion.
But still, there is a problem.

I used apc = new APCount(soma(0.5)) causes error.

Code: Select all

objref apc
proc find_thresh(){ local i, n
apc = new APCount(soma(0.5))
apc.thresh = 0

for n=1, 10{
  printf("amp : %d \n",n*10)
  grindaway_r(n*10)
  run()

  
  if (apc.n >0){
    printf("spike\n")
    for i = 1, 10{
      AP_thresh=(n-1)*10+i
      print AP_thresh 
      grindaway_r(AP_thresh)
      run()
          if(apc.n>0){
            printf("threshold : %d \n", AP_thresh)
            printf("spike from %d \n", AP_thresh)
            break
          }
    }
  break
  }

  if(n == 10 && apc.n < 1) {
    AP_thresh = 100
	  printf("%d th threshold amp is over 100 mA \n", idx)
  } 
}
}
}

find_thresh()
The syntax error occurs
C:\nrn73w64\bin64\nrniv.exe: syntax error
in C:\Hyeyeon\Neuron\patdemo_r7_hyeyeon (2) (3)\Potential_L5_pyramid_sinwave_threshold.hoc near line 506
apc = new APCount(soma(0.5))

And if I use access soma, it works.

Code: Select all

objref apc
access soma 

proc find_thresh(){ local i, n
apc = new APCount(soma(0.5))
apc.thresh = 0

for n=1, 10{
  printf("amp : %d \n",n*10)
  grindaway_r(n*10)
  run()

  
  if (apc.n >0){
    printf("spike\n")
    for i = 1, 10{
      AP_thresh=(n-1)*10+i
      print AP_thresh 
      grindaway_r(AP_thresh)
      run()
          if(apc.n>0){
            printf("threshold : %d \n", AP_thresh)
            printf("spike from %d \n", AP_thresh)
            break
          }
    }
  break
  }

  if(n == 10 && apc.n < 1) {
    AP_thresh = 100
	  printf("%d th threshold amp is over 100 mA \n", idx)
  } 
}
}
}

find_thresh()
However, I want to see dendrites, axon threshold. In this case, should I use 'access soma', 'access dendrite','access axon' respectively?
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Find threshold with APCount

Post by ted »

Important facts
1. The NEURON simulator can be used to execute programs written in hoc, or Python, or programs that contain hoc and Python statements.
2. Because of fact 1, there are two versions of NEURON's online Programmers' Reference. One focuses on how to use NEURON with Python, and the other shows how to use NEURON with hoc. If you go to NEURON's home page
https://neuron.yale.edu/neuron/
and click on the Programmer's Reference link, the Python version of the Programmer's Reference appears. You will know its the Python version because it says so, in big letters, on the second line of the web page:
NEURON Python documentation
If you want to see the hoc documentation instead, click on the
Switch to HOC
link, which appears, in smaller letters, on the first line of the web page.
3. At the top of every page in the Programmers' Reference there is a
Switch to . . .
link, so if you are reading one version of the documentation and you want to see the other version, just click on that link.

Now to address the issues in your most recent post.
apc = new APCount(soma(0.5)) causes error
Your original question was
I read explanation about APCount at programmer's reference.
apc = h.APCount(section(x))
Here, section(x) should be written only number?
That is a question about how to use Python syntax to work with APCount. I gave you an example of correct usage of Python that would place an APCount at the middle of the soma.

But you're using a hoc program, so you really needed to know how to use hoc to attach an APCount to a section at the right location. I can see why you might guess that
apc = new APCount(soma(0.5))
would work in a hoc program, but the hoc version of APCount expects a numerical argument in the range 0..1, and soma(0.5) is not a number.

In hoc, the best way to specify the name of the section to which the APCount (or any other point process) is attached is with what is called "section stack notation"

sectionname objrefname = new APCount(rangeval)

where
objrefname is the name of the objref that will refer to the new APCount
sectionname is the name of the section to which the new APCount will be attached
rangeval is the normalized position of the APCount along the length of the section
if I use access soma, it works
I want to see dendrites, axon threshold. In this case, should I use 'access soma', 'access dendrite','access axon' respectively?
It is not a good idea to use the access keyword to specify where anything is located. There should never be more than one access statement in a program. Read this post about "access abuse" to discover why:
https://www.neuron.yale.edu/phpBB2/view ... t=301#p828

Instead, you should use "section stack" notation to specify the section that the point process will be attached to, like this example:

Code: Select all

objref apc
soma apc = new APCount(0.5)
. . . then find threshold . . .
dendrite apc = new APCount(0.5)
. . . then find threshold . . .
axon apc = new APCount(0.5)
. . . then find threshold . . .
Christine Chung
Posts: 17
Joined: Fri May 03, 2019 2:41 am

Re: Find threshold with APCount

Post by Christine Chung »

Thanks for your answer!
I learned a lot. And all things worked :)
Post Reply