How to set initial voltage of simulation

Moderator: tom_morse

Post Reply
bwjmbb17
Posts: 16
Joined: Mon Apr 10, 2017 10:09 am

How to set initial voltage of simulation

Post by bwjmbb17 » Mon Jun 19, 2017 2:43 pm

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

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

Re: How to set initial voltage of simulation

Post by ted » Tue Jun 20, 2017 10:55 am

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?

bwjmbb17
Posts: 16
Joined: Mon Apr 10, 2017 10:09 am

Re: How to set initial voltage of simulation

Post by bwjmbb17 » Tue Jun 20, 2017 1:47 pm

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.

theiera
Posts: 8
Joined: Mon Feb 26, 2007 5:37 am

Re: How to set initial voltage of simulation

Post by theiera » Thu Nov 23, 2017 5:04 am

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

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

Re: How to set initial voltage of simulation

Post by ted » Thu Nov 23, 2017 4:50 pm

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

salvadord
Posts: 57
Joined: Tue Aug 18, 2015 3:49 pm

Re: How to set initial voltage of simulation

Post by salvadord » Sun Nov 26, 2017 7:38 pm

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

theiera
Posts: 8
Joined: Mon Feb 26, 2007 5:37 am

Re: How to set initial voltage of simulation

Post by theiera » Mon Nov 27, 2017 9:36 am

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

Post Reply