Dear friends,
in the space plot we see how membrane potential changes in the space
1- i read toturial to use space plot i did every thing that they said, but i see just 2 curves and nothings more, what should i do if i like to have for example 10-20 curve ?
2-is it possible to write a code in "hoc" to save v(x,t) to a *.dat file?
thank's
space plot!
-
- Site Admin
- Posts: 6299
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: space plot!
There are lots of tutorials. Which one do you mean?1- i read toturial to use space plot i did every thing that they said, but i see just 2 curves and nothings more, what should i do if i like to have for example 10-20 curve ?
Yes. Here's the outline for how you would proceed:2-is it possible to write a code in "hoc" to save v(x,t) to a *.dat file?
1. Identify all sections on the path and append them to a SectionList.
2. For each section in the SectionList, iterate over all internal nodes, creating a Vector
for each node and setting up vector record.
1 is easy. Use hoc code or the GUI to set up your shape plot, and run a simulation to
make sure that what you're seeing is what you want to record.
Then type
allobjects()
at the oc> prompt, and look for a mention of RangeVarPlot. You should see
RangeVarPlot[0] with 1 refs
Then use the RangeVarPlot class's list() method to append all of its sections to a
SectionList, like this:
Code: Select all
objref sl
sl = new SectionList()
RangeVarPlot[0].list(sl)
forsec sl print secname()
at the oc> prompt.
2 is also easy.
Code: Select all
objref veclist, tempvec
veclist = new List()
forsec sl {
for (x,0) {
tempvec = new Vector()
tempvec.record(&v(x))
veclist.append(tempvec)
}
}
objref tempvec // so we can't mess up the last element in veclist
there is a corresponding element in veclist that is a Vector which will record the time
course of membrane potential at that point. Now, every time you run a simulation,
these Vectors will automatically capture the time course of membrane potential along
the path(s) you specified.
That will be a lot of data. What you do with it is up to you.
--Ted
syntax for printf?
Hmmm... I'm getting rusty.
1. Started up neurondemo, chose pyramidal as example
2. Create SectionList
3. Use Ted's code for creating a vector for one node of every section in the model.
4. Click the "Init & Run" button on the RunControl window
5. Typed at the oc> prompt and saw that there were a bunch of vectors, last one being Vector[81] with 1 refs. Since there are only 79 sections ... Ummm...what section(node=0.5) does Vector[x] refer to?
6. Typed at the oc> prompt. Since the default Tstop (ms) = 5 and the dt (ms) = 0.025, the number of elements in the vector, 201, is right.
7. Now to dump it in ascii to a file
, where the i=3 index was picked by peaking. But this doesn't work and I get booted out with
Questions:
Q1. I have a gut feeling I should be referencing the vectors differently, but I'm drawing a blank. I thought it should be something like soma.Vector[0] - I'm wrong. How should I reference these new vectors from hoc for the purpose of dumping?
Q2. Why does the File class not work the same way it used to (whine)? For example,
Q3. Does this syntax still work?
Thanks,
Kelvin
1. Started up neurondemo, chose pyramidal as example
2. Create SectionList
Code: Select all
objref pyrseclst
pyrseclst = new SectionList()
forall pyrseclst.append()
Code: Select all
objref veclist, tempvec
veclist = new List()
x = 0.5
forsec pyrseclst {
tempvec = new Vector()
tempvec.record(&v(x))
veclist.append(tempvec)
}
objref tempvec
5. Typed
Code: Select all
allobjects()
6. Typed
Code: Select all
Vector[81].printf("%4.1f\n")
7. Now to dump it in ascii to a file
Code: Select all
wopen("dump.dat")
for i = 3, 81 {
Vector[i].fprint("%4.1f")
fprint("\n")
}
wopen()
Code: Select all
initcode failed with 1 left
Q1. I have a gut feeling I should be referencing the vectors differently, but I'm drawing a blank. I thought it should be something like soma.Vector[0] - I'm wrong. How should I reference these new vectors from hoc for the purpose of dumping?
Q2. Why does the File class not work the same way it used to (whine)? For example,
Code: Select all
f = new File()
f.wopen("dump.dat")
Code: Select all
printf(fileobj, format_string)
Kelvin
-
- Site Admin
- Posts: 6299
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: syntax for printf?
Yo, Kelvin, thanks for sending us that bit of arctic blast last weekend. We needed that.
You might also want to try
print veclist.count()
to see how many elements are in veclist.
name of the one in the x position.
and then use the Vector class's printf().
For example, typing
veclist.object(3)
at the oc> prompt will tell you that the 4th element in veclist is a Vector. So you can type
veclist.object(3).printf()
to dump the contents of that Vector. If you want to dump the contents of every Vector
in the List, iterate over the List:
not working.
In isolation, printf(fileobj, format_string) just generates an error msg.
Did you check to see how many Vectors existed before you created your own?5. Typedat the oc> prompt and saw that there were a bunch of vectors, last one being Vector[81] with 1 refs. Since there are only 79 sections ...Code: Select all
allobjects()
You might also want to try
print veclist.count()
to see how many elements are in veclist.
You can discover that by iterating over the contents of pyrseclst and printing theUmmm...what section(node=0.5) does Vector[x] refer to?
name of the one in the x position.
Code: Select all
proc printsecname() { local ii
ii = 0
forsec $o2 {
if (ii == $1) print secname()
}
ii += 1
}
printsecname(9, pyrseclst) // prints name of the 10th section in pyrseclist
The Vector class doesn't have an fprint() method. Create the file with the File class7. Now to dump it in ascii to a fileCode: Select all
wopen("dump.dat") for i = 3, 81 { Vector[i].fprint("%4.1f") fprint("\n") } wopen()
and then use the Vector class's printf().
The List class's object() method lets you address any element in the List.Q1. I have a gut feeling I should be referencing the vectors differently, but I'm drawing a blank. I thought it should be something like soma.Vector[0] - I'm wrong. How should I reference these new vectors from hoc for the purpose of dumping?
For example, typing
veclist.object(3)
at the oc> prompt will tell you that the 4th element in veclist is a Vector. So you can type
veclist.object(3).printf()
to dump the contents of that Vector. If you want to dump the contents of every Vector
in the List, iterate over the List:
Code: Select all
for ii = 0, veclist.count()-1 {
veclist.object(ii).printf() // veclist.object(ii) is a Vector
}
This does work, as long as f is an objref. But it isn't the code you cited above asQ2. Why does the File class not work the same way it used to (whine)? For example,Code: Select all
f = new File() f.wopen("dump.dat")
not working.
If you mean vecname.printf(fileobj, format_string), the answer is yes.Q3. Does this syntax still work?Code: Select all
printf(fileobj, format_string)
In isolation, printf(fileobj, format_string) just generates an error msg.
syntax solved
Thanks Ted, and your welcome for the blast of arctic from up North.
I have been trying to use the GUI as much as possible and forgot my hoc syntax. I learned something else from your original reply to the first post that I would like to explore more. It has to do with exploring from the command prompt what is plotted in a particular graph. But I think I will go and start a new thread in a different area other than "Getting started".
Cheers,
Kelvin
I have been trying to use the GUI as much as possible and forgot my hoc syntax. I learned something else from your original reply to the first post that I would like to explore more. It has to do with exploring from the command prompt what is plotted in a particular graph. But I think I will go and start a new thread in a different area other than "Getting started".
Cheers,
Kelvin