Dear Ted and Costas,
with the help of your discussion, I managed to build a model where a single axon is excited by some extracellular potential and play around with it.
I tried to complicate it while using the geomatry of the model given earlier in this topic (the McIntyre one, with nodes, MYSA, FLUT and STIN sections), and I'm facing several difficulties:
-while using the forall command to set the e_extracellular(x), the extracellular potential is set up according the declaration order (first to all the nodes, then to all what is called MYSA in McIntyre model and so on...). Is there a way to set them according to the spatial order rather than the declaration order?
-while doing that the extracellular potentials would be set to each section, but as these section have different length, the spatial position of the fixed extracellular potentials will not be regular. Is there a way to specify the extracellular potentials at some points (at the nodes for example) and then to ask Neuron to extrapolate linearly the value between these points?
Thanks a lot for your answers
Greg
Extracellular stimulation
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
You could create a new SectionList, to which you append sections in whatever order yougwalckie wrote:-while using the forall command to set the e_extracellular(x), the extracellular potential is set up according the declaration order (first to all the nodes, then to all what is called MYSA in McIntyre model and so on...). Is there a way to set them according to the spatial order rather than the declaration order?
like. Then
forsec seclistname print secname()
to verify that you got the sequence you wanted, and if you did, assign the field like so
forsec for (x,0) seclistname { statement that assigns extracellular potential }
Why waste time interpolating the field at the correct locations at every time step? Why-while doing that the extracellular potentials would be set to each section, but as these section have different length, the spatial position of the fixed extracellular potentials will not be regular. Is there a way to specify the extracellular potentials at some points (at the nodes for example) and then to ask Neuron to extrapolate linearly the value between these points?
not calculate the field at the correct locations in the first place?
Last edited by ted on Thu Jan 24, 2008 9:40 am, edited 1 time in total.
Well
I am new to this but I can tell you what I did to resolve the situation you describe in your first question:
Basically I set a procedure that starts at x=0 and incrementally progresses to x->1 in single segment steps. At each of these segments you can define the value of e_extracellular(x). This way the value e_extracellular(x) is set for increasing x.
The code for this would be:
What this procedure does is: for a specific section xyz it applies the values of a predefined matrix eex to e_extracellular(x) for increasing x. In the same manner you could use the vector_play feature to define the values of e_extracellular(x).
Regarding your second question I came across the same issue. The way I do it is feed the morphology in Matlab and find out the position of each node in space. Then I construct externally a distance_vector which is a matrix with the distance between each node of the neuron and the stimulating electrode. I am pretty sure that this is not the most efficient way but it worked for me.
Costas
I am new to this but I can tell you what I did to resolve the situation you describe in your first question:
Basically I set a
Code: Select all
forsec xyz (x>0)
The code for this would be:
Code: Select all
forsec xyz {
for (x, 0) {
for nn = 0, nseg-1 {
min1 = nn/nseg
max1 = (nn+1)/nseg
if (x > min1 && x < max1) {ii = nn}
e_extracellular(x) = eex.x[ii][0]
}
}
}
Regarding your second question I came across the same issue. The way I do it is feed the morphology in Matlab and find out the position of each node in space. Then I construct externally a distance_vector which is a matrix with the distance between each node of the neuron and the stimulating electrode. I am pretty sure that this is not the most efficient way but it worked for me.
Costas
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Are you sure about this?
For a one-dimensional eex, it does work but it risks error, and efficiency could be
improved. To see why, consider this test:
Here's what happens when test() is called with arguments 1, 3, and 5:
So the amount of work increases as the square of the number of segments in a section,
and most of the assignments are incorrect. It works only because the incorrect
assignments fortunately don't overwrite the previously made correct assignments, and
the last assignment just happens to involve the right index into the eex Vector.
If eex has the same number of elements as the number of internal nodes in your model,
and the sections in the sectionlist are in the proper sequence, this should work:
Also, it's not clear why eex.x[ii][0] (i.e. why two indices?).costas wrote:Code: Select all
forsec xyz { for (x, 0) { for nn = 0, nseg-1 { etc.
For a one-dimensional eex, it does work but it risks error, and efficiency could be
improved. To see why, consider this test:
Code: Select all
create axon
access axon
proc test() { local count
count = 0
nseg = $1
for (x, 0) {
for nn = 0, nseg-1 {
min1 = nn/nseg
max1 = (nn+1)/nseg
if (x > min1 && x < max1) {ii = nn}
// e_extracellular(x) = eex.x[ii][0]
printf("nn = %d -- e_extracellular(%g) = eex.x[%d]\n", nn, x, ii)
count+=1
}
}
print "nseg = ", nseg, " requires ", count, " iterations"
}
Code: Select all
oc>test(1)
nn = 0 -- e_extracellular(0.5) = eex.x[0]
nseg = 1 requires 1 iterations
oc>test(3)
nn = 0 -- e_extracellular(0.166667) = eex.x[0]
nn = 1 -- e_extracellular(0.166667) = eex.x[0]
nn = 2 -- e_extracellular(0.166667) = eex.x[0]
nn = 0 -- e_extracellular(0.5) = eex.x[0]
nn = 1 -- e_extracellular(0.5) = eex.x[1]
nn = 2 -- e_extracellular(0.5) = eex.x[1]
nn = 0 -- e_extracellular(0.833333) = eex.x[1]
nn = 1 -- e_extracellular(0.833333) = eex.x[1]
nn = 2 -- e_extracellular(0.833333) = eex.x[2]
nseg = 3 requires 9 iterations
oc>test(5)
. . . many omitted lines . . .
nseg = 3 requires 25 iterations
and most of the assignments are incorrect. It works only because the incorrect
assignments fortunately don't overwrite the previously made correct assignments, and
the last assignment just happens to involve the right index into the eex Vector.
If eex has the same number of elements as the number of internal nodes in your model,
and the sections in the sectionlist are in the proper sequence, this should work:
Code: Select all
ii = 0
forsec seclist for (x,0) {
e_extracellular(x) = eex.x[ii]
ii += 1
}
Dear Ted
Thanks a lot for the indication - you are right! As mentioned in my earlier note I was sure this was not the most efficient code for the job...
I implemented the loop you indicated and I have a question: It seems to work only if I define the operation as
e_extracellular(x) = eex.x[ii][0]
or
eex.x[ii][0] = e_extracellular(x)
AND NOT when using the (certainly more straightforward) notation you suggested:
e_extracellular(x) = eex.x[ii]
or
eex.x[ii] = e_extracellular(x)
The matrix is defined as eex = new Matrix(n_tot, 1). As in this case I am using 1-dimensional matrices it is not a problem but I am not sure why I receive the following error message when using the second latter notation:
"... not right number of subscripts in ..."
All the best, Costas
Thanks a lot for the indication - you are right! As mentioned in my earlier note I was sure this was not the most efficient code for the job...
I implemented the loop you indicated and I have a question: It seems to work only if I define the operation as
e_extracellular(x) = eex.x[ii][0]
or
eex.x[ii][0] = e_extracellular(x)
AND NOT when using the (certainly more straightforward) notation you suggested:
e_extracellular(x) = eex.x[ii]
or
eex.x[ii] = e_extracellular(x)
The matrix is defined as eex = new Matrix(n_tot, 1). As in this case I am using 1-dimensional matrices it is not a problem but I am not sure why I receive the following error message when using the second latter notation:
"... not right number of subscripts in ..."
All the best, Costas
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
because you declared eex to be a Matrix, and NEURON's Matrix class is by definitionIt seems to work only if I define the operation as
e_extracellular(x) = eex.x[ii][0]
two dimensional--each element must be referenced by two indices.
So you're not using the Vector class's play() method. Does your code instead transfer a
new value from eex to e_extracellular by executing a hoc assignment statement at each
fadvance()? That would be much less efficient.