Does anyone have a good idea about how to record into a matrix?
I have a variable number of vectors that I'd like to record into and then reference simply by a second dimension rather than naming them V1, V2, V3 etc.

My idea was to use a single vector and record into different parts of it simultaneously by passing the record function pointers to different parts of the vector (essentially pointers to each row of the matrix that is being represented by the vector) For example if I had N vectors of length L, I could just resize a single vector to the size = N*L and then record into it at N different locations (0, L, 2*L,...(N-1)*L). This is better than having to figure out what N is and then on the fly resize N temp vectors to size L and record into each of them (i'm not even sure how i'd do this...).

It seems like I need to write my own record function essentially, but I'm not sure I could figure that out on my own. Any tips or workarounds from you guys would be great! Thanks, -Andrew

Example 1: calcium accumulation in a model with several sections, each of which has nseg = 1.
Step 1 (left as an exercise to the reader): Create a SectionList, and to it append all sections whose cai you want to record. For the sake of this example, suppose the SectionList is called casecs.
Step 2: Set up Vector recording of cai in each section in casecs by doing the following:

Example 2: calcium accumulation in a model with several sections, each of which may have any number of segments.
Step 1 (left as an exercise to the reader): Create a SectionList, and to it append all sections whose cai you want to record. For the sake of this example, suppose the SectionList is called casecs.
Step 2: Set up Vector recording of cai in each segment of each section in casecs by doing the following:

For each section in SectionList casecs, there is a corresponding List in listofveclists; each such List is a set of Vectors--one Vector for each internal node of that section--which will contain the time course of cai at the middle of each internal node of that section.

Example 3: radial diffusion in a model with several sections, each of which has nseg = 1. Radial diffusion is implemented with mechanism cadifus, which uses Nannuli compartments. The concentration of ca in the jth compartment at range x is known to hoc as ca_cadifus[j](x).
Step 1 (left as an exercise to the reader): Create a SectionList, and to it append all sections whose ca you want to record. For the sake of this example, suppose the SectionList is called casecs.
Step 2: Set up Vector recording of ca in each annulus of each section in casecs by doing the following:

Example 4: radial diffusion in a model with several sections, each of which may have any number of segments. Radial diffusion is implemented with mechanism cadifus, which uses Nannuli compartments. The concentration of ca in the jth compartment at range x is known to hoc as ca_cadifus[j](x).
Step 1 (left as an exercise to the reader): Create a SectionList, and to it append all sections whose cai you want to record. For the sake of this example, suppose the SectionList is called casecs.
Step 2: Set up Vector recording of ca in each annulus of each segment of each section in casecs by doing the following:

It would be advisable to implement incrementally, testing on small models and proceeding from simple to more complex (a few sections without annuli and containing one segment each, next a few sections without annuli but having different values of nseg, then a few sections with several annuli and nseg = 1, and finally a few sections with several annuli and several different values of nseg).

Thanks for the tips and the walkthrough. It all makes good sense to me now. I believe I'm having trouble with some of the syntax that you've demonstrated because I'm trying to implement it in python. Feel free to move this into the NEURON + Python folder if you'd like. Let me know if its something I'm doing wrong. Thanks!

You are on the right track here (til the proper _ref_ extension is implemented)
since hoc knows how to interpret &caShells_cad[2](0.5). Just
make soma the currently accessed section with
soma.push()
...
h.pop_section()
and leave it out of the statement you are constructing.
I'm assuming that the soma was created as an anonymous Python Section instead of with
h(' create soma'). Otherwise, putting in the 'soma' literal should work. The method you use to 'insert'
does not matter to the issue.

I've built a pretty cool GUI and analysis python program around the NEURON python module!

Sounds interesting. I'm making the InterViews gui items which are used by hoc programs also conveniently
available from Python. But maybe it is time to think about settling on a standard python gui toolkit.
The only problem is to have it with no extra installation difficulty on mac, mswin, or linux.

Thanks. I'll check on how I am 'creating' the soma and get something to work!

My two cents on a python GUI toolkit is that Tkinter is the way to go:

1) Its built into the standard python distribution
2) It works well on ubuntu, WinXP and Mac OSX (yes i have the distinct displeasure of working with all three operating systems on a daily basis...)
3) I have found it very easy to learn and use to implement simple GUIs with buttons, entry boxes, labels, lists etc.
4) It is easy to stick matplotlib figures and axes into Canvas widgets in Tkinter windows

Apparently this is a very open debate though because you will find dozens of people out there describing pros and cons of many GUI implementations. The other one I was considering learning was wxWidgets. It also has good support for all three operating systems. The main advantage is that, from what people say, it looks like a professionally developed program because in each operating system it makes use of the operating system's calls to create windows, buttons etc. I think this fact gives you greater control over the look of the GUI in general. Personally this didn't matter to me, and I didn't want to go through the hassle of installing wxWidgets (not trivial...)

Yes, I would like to see an example. Please send, as a zip file, to michael.hines@yale.edu.
What I want to determine is how easy it would be to develop a tool with the complexity of the
Cellbuilder or LinearCircuitBuilder.

cool. i'm trying out the new syntax now. i receive an error now but i'm not sure why. how should i confirm that i am using the version of neuron that you've updated? i deleted the neuron/nrn directory, cloned a new nrn directory using mercurial and then rebuilt the whole thing...i think. would love to know how to check this though and make sure i'm importing the new neuron module when i'm in python.

As I had suspected I had not properly rebuilt neuron, but I wrote down the steps this time so I won't ever have to wrestle with it again! The new syntax does work now. I am still not sure how to get a reference to the IClamp.amp variable so that I can "play" a hoc vector into it, but I've managed to use the push, pop strategy as you suggested last time and it does the trick. Thanks.