Code: Getting Value of Voltage at end of current pulse

Anything that doesn't fit elsewhere.
Post Reply
TrZ
Posts: 7
Joined: Wed May 31, 2023 12:37 am

Code: Getting Value of Voltage at end of current pulse

Post by TrZ »

Hi,
I am new to NEURON and am trying to code a model in Python of a Section with current injected into it under current clamp. I am trying to plot a graph of the voltage at the end of the current pulse versus the amplitude of the current pulse for various current amplitudes. So far my voltages are stored in a single vector for each run. However, from the programmer's reference Vector.record() notes, it seems to me that the vector does not record all the voltages from the stream of voltages. Then is there a way to get the value of the voltage at a given exact time point?
Thank you for the help! I am having difficulty finding my answer from the documentation.
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Code: Getting Value of Voltage at end of current pulse

Post by ted »

from the programmer's reference Vector.record() notes, it seems to me that the vector does not record all the voltages from the stream of voltages.
Hmm, if the documentation of Vector.record is that vague, we need to fix it. Can you point to (or quote) the particular part that led to your question?

And regarding your particular use of Vector.record: are you using fixed time step integration or adaptive integration ("cvode")?
TrZ
Posts: 7
Joined: Wed May 31, 2023 12:37 am

Re: Code: Getting Value of Voltage at end of current pulse

Post by TrZ »

Thank you for the reply!
For the first question I found that " At the end of fadvance, var will be saved if t (after being incremented by fadvance) is equal or greater than the associated time of the next index." I am assuming if t does not meet the criteria, var(t) for that t will not be saved in the vector.
For the secnd question, I did not set a dt value. For that reason I am assuming I am using fixed time step integration.
The line in my code that creates the vector that is relevant here is:
vn = h.Vector().record(axon(0.5)._ref_v)
Are there any suggestions for how I can get the list of voltages I need for my IV curve? Thank you!
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Code: Getting Value of Voltage at end of current pulse

Post by ted »

Sometimes the best way to understand documentation, and avoid analysis paralysis, is to run your own tests. In this case, actually use Vector.record to capture your variable(s) of interest. Also record t. What did you discover?

Now let me ask you another question: if you only want to know the value of some variable(s) at a particular time, why bother with Vector.record? Why not simply capture those values at that particular time? How? Use events. For an example of how to use events to make something happen at a specific time, see "Using events to implement parameter changes during a run" in the Forum's Hot tips area. Yes, the example is in hoc, but it will give you some hints that you can pursue with Python.
I did not set a dt value. For that reason I am assuming I am using fixed time step integration.
I don't see the connection between the first and second statements.

Unfortunately, NEURON's documentation doesn't seem to use the phrase "variable dt", and even searching for "adaptive integration" produces results that aren't as informative as they could be. Right on the front page of NEURON Python documentation at nrn.readthedocs.io click on CVode and spend a few minutes reading what turns up. Then you'll know whether or not the code you wrote uses adaptive integration.
Post Reply