## Printing xyz positions of all straight line segments

The basics of how to develop, test, and use models.
Qroid_montreal
Posts: 38
Joined: Sun Oct 16, 2011 1:58 pm

### Printing xyz positions of all straight line segments

Hello,

I have a feeling this is a pretty simple one, but I'm having trouble with it. I'm implementing the Mainen and Senowski model layer V cell http://senselab.med.yale.edu/modeldb/sh ... model=2488. What I'd like to do is calculate the electric potential V_e(x,t) around the cell. My plan is:

1. At the start of simulation, print the xyz endpoints and surface area of all straight line segments.
2. At each time point, print the membrane current density for each segment.

I'm having problems with 1. Specifically, the xyz positions for the segment nodes are all output as identical, although the area and i_membrane changes between segments. I'm guessing I'm not using x3d() etc correctly. What am I doing wrong? My simple code and example output are below.

Code: Select all

``````forall for(x) {print secname(), x3d(x), y3d(x), z3d(x), area(x), i_membrane(x)}
...
dend133.085873 2.6565194 2.1262903 0 -0.00039796857
dend133.085873 2.6565194 2.1262903 275.99687 -0.00039796857
dend133.085873 2.6565194 2.1262903 245.31708 -0.001138171
dend133.085873 2.6565194 2.1262903 201.44638 -0.0020566937
dend133.085873 2.6565194 2.1262903 153.20219 -0.0032314412
dend133.085873 2.6565194 2.1262903 116.6775 -0.0043818951
dend132.499405 2.6565194 2.1262903 0 -0.0043818951
dend133.085873 2.6565194 2.1262903 0 -0.0003648783
dend133.085873 2.6565194 2.1262903 145.06896 -0.0003648783
dend133.085873 2.6565194 2.1262903 145.86006 -0.00098885899
dend136.483166 4.0154371 2.1262903 0 -0.00098885899
...
``````

Qroid_montreal
Posts: 38
Joined: Sun Oct 16, 2011 1:58 pm

### Re: Printing xyz positions of all straight line segments

I think I see my mistake. "area" and "i_membrane" are range variables, so the input is normalised to between 0 and 1. "x3d" etc want an integer input, and don't return an error for non-integer input. So instead of

Code: Select all

``forall for(x) {print secname(), x3d(x), y3d(x), z3d(x), area(x), i_membrane(x)}``
it should be

Code: Select all

``forall for(x) {print secname(), x3d(int(x*nseg)), y3d(int(x*nseg)), z3d(int(x*nseg)), area(x), i_membrane(x)}``
.

The output from the latter looks reasonable!

ted
Posts: 5704
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: Printing xyz positions of all straight line segments

Qroid_montreal wrote:I think I see my mistake. "area" and "i_membrane" are range variables, so the input is normalised to between 0 and 1. "x3d" etc want an integer input
And that's why you got repeated printouts of the xyz coordinates of the 0 end of each section.
So instead . . . it should be

Code: Select all

``forall for(x) {print secname(), x3d(int(x*nseg)), y3d(int(x*nseg)), z3d(int(x*nseg)), area(x), i_membrane(x)}``
.
Nope.

Code: Select all

``forall for(x) {print secname(), x3d(int(x*nseg)), y3d(int(x*nseg)), z3d(int(x*nseg)), area(x), i_membrane(x)}``
reports the area and membrane current for each segment, but x*nseg is meaningless and so are the reported xyz coordinates. After all, the spatial discretization parameter nseg has nothing to do with the number of xyzdiam measurements, or the distance between any adjacent pair of measurements, that define the physical shape of a section. Suggest you get
http://www.neuron.yale.edu/ftp/ted/neur ... nd_rec.zip
and examine interpxyz.hoc

The code in extracellular_stim_and_rec.zip treats each segment in a model as a point source of current located whose coordinates are found by walking along a section until one reaches the point located at path distance L*x from the section's 0 end, where x is the "range" that corresponds to the segment. Example: a section 120 um long with nseg = 3 will have internal nodes at x = 1/6, 1/2, and 5/6. The nodes are 20, 60, and 100 um from the 0 end. The xyz coordinate of any node is found by treating the x3d, y3d, and z3d data as piecewise linear functions of anatomical distance from the 0 end, and noting the xyz values that correspond to L*range, i.e. L/6, L/2, and 5*L/6 in this case.