Page 1 of 1

How to set initial voltage of simulation

Posted: Mon Jun 19, 2017 2:43 pm
by bwjmbb17
Hey all,

I was trying to figure out how to set the initial voltage of a simulation. I believe this is the h.v_init variable in python. I tried using the simConfig.hParams command to change this but the initial voltage stayed at -65 mV. I tried these to lines of code:

Code: Select all

simConfig.hParams = {'v_init': -65}
simConfig.hParams = {'celsius': 6.3, 'clamp_resist': 0.001,'v_init': -65}
Neither one worked so I was curious if this was the correct way to change the initial voltage? Any help would be appreciated.

Thanks,
Brenyn

Re: How to set initial voltage of simulation

Posted: Tue Jun 20, 2017 10:55 am
by ted
NEURON itself allows considerable user-specified control over initialization, which can be easily implemented with the FInitializeClass. I imagine it would be relatively straightforward to offer users a declarative way to customize initialization. Are you sure there isn't something about initialization in NetPyNE's documentation?

Re: How to set initial voltage of simulation

Posted: Tue Jun 20, 2017 1:47 pm
by bwjmbb17
After searching the documentation I did actually find where to set the initial voltage of individual cells. I was trying to set it in the wrong location. Thank you for your help.

Re: How to set initial voltage of simulation

Posted: Thu Nov 23, 2017 5:04 am
by theiera
Hi all,
I find it difficult to find how to set the initial voltage for all sections in one cell.
In the documentation is explained how to do it for a single section.
"e.g. cellRule['secs']['soma']['vinit'] = -72"

I could successfully do it this way:

Code: Select all

goc_cellRule['secLists'] = {'all':[
    'elec',
    'soma',
    'axon',
    'seal',
    'dend_0',
    'dend_1',
    'dend_2']}
for s in goc_cellRule['secLists']['all']:
    goc_cellRule['secs'][s]['vinit'] = -60
Is there a way to set a parameter for all secs?

Any help would be appreciated.

Thanks
Sergio

Re: How to set initial voltage of simulation

Posted: Thu Nov 23, 2017 4:50 pm
by ted
A common theme is emerging in these posts: many things that are easy to do with plain vanilla NEURON are either no longer available or require specialized syntax if one uses NetPyNE. For example, in the case of a model specified with hoc (or Python), assigning a value to v_init (h.v_init for Python) would take care of the initial membrane potential question.

Is it not possible to simply assign a value to v_init? Or does using NetPyNE have the effect of hiding

Re: How to set initial voltage of simulation

Posted: Sun Nov 26, 2017 7:38 pm
by salvadord
NetPyNE is intended as a declarative language where all specifications can potentially be stored in json format, that's why it uses a different syntax from the procedural NEURON language. In many cases, especially for complex network models, the amount of code required will be less in NetPyNE.

For example, when you set the 'vinit' property of a section, NetPyNE takes care of calling h.FInitializeHandler() to set that voltage. There is no explicit method to set the v_init voltages of all sections in a cell (either in NetPyNE or NEURON), but you can simplify your code as follows:

Code: Select all

for s in goc_cellRule['secs'].values(): s['vinit'] = -60
Also, you can set v_init globally via:

Code: Select all

simConfig['hParams']['v_init'] = -60

Re: How to set initial voltage of simulation

Posted: Mon Nov 27, 2017 9:36 am
by theiera
Dear Ted and Salvador,

thanks for the quick and clear response.
I realise now that my question was addressing a more general issue than simply setting the v_init of a section.
As a consequence of this I realise only now that I should have opened a new post rather than posting my question as a follow up of this post on v_init.

The point I intended to address is:
How do we change a parameter in all sections of an imported cell template?

Salvador replay was explanatory in this sense:

Code: Select all

for s in goc_cellRule['secs'].values(): s['vinit'] = -60
as it explains how to loop through the sections of an imported cell.

Thanks to both of you!

Sergio