Page 1 of 1

### spatial discretization, and saving results

Posted: Tue Sep 29, 2020 10:11 am
1) I noticed in the gui a user can specify d_X in the geometry --> is there an equivalent way to do this when working in python? In python I am able to access sec.L and sec.nseg (as a work around I tried computing L/d_X and take the floor (or ceiling?) of the value and this would be nseg)

2) In yale neuron gui, is there a way to export the voltage for all the segments (i.e. the entire cell) at every time step? Meaning at t = 0 there is an output file with all the voltages in one file, then at t=0.01 there is another file with all the voltage, and .... (I was going to look in the hoc library to see if there is a way to do this)

### Re: spatial discretization, and saving results

Posted: Tue Sep 29, 2020 11:05 am
1) I noticed in the gui a user can specify d_X in the geometry --> is there an equivalent way to do this when working in python?
The d_X rule for spatial discretization is

set nseg to the smallest odd number such that L/nseg <= d_X

Code to do this is built into the CellBuilder. If you want to do it yourself, you'll have to write your own procedure. I should mention that the d_X rule doesn't have any particular advantage over any other strategy for deciding what nseg should be. Unlike the d_lambda rule, using the d_X rule doesn't mean that the number of compartments in a model is "optimal" in terms of reducing computational burden or improving accuracy of simulation results. Nor does it force segment centers to be equidistant from each other throughout a model that has more than one section, or guarantee that segment centers of an anatomically complex model are aligned with a spatial grid.
. . . is there a way to export the voltage for all the segments (i.e. the entire cell) at every time step? Meaning at t = 0 there is an output file with all the voltages in one file, then at t=0.01 there is another file with all the voltage . . .
Not built into hoc or python or the GUI. A more practical approach would be to use Vector.record to capture the time course of time and every other variable of interest, and then write results to one or more files after the simulation ends.