Using FInitializeHandler to set initial voltages for a subset of cells

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
pascal
Posts: 73
Joined: Thu Apr 26, 2012 11:51 am

Using FInitializeHandler to set initial voltages for a subset of cells

Post by pascal » Thu Jul 11, 2019 7:24 pm

I am running a simulation in which I want all cells to be initialized to -68 mV, except for a subset of cells (RE cells), which I want to start at -61 mV.

I've tried this code (where 'pc' is a ParallelContext object):

Code: Select all

def set_RE_voltages():
    for re_gid in net.re_gidList:
        pc.gid2cell(re_gid).v=-61 
    if(h.cvode.active()):
        h.cvode.re_init()
    else:
        h.fcurrent()
    h.frecord_init() 
    
fih = h.FInitializeHandler(1, set_RE_voltages)
h.finitialize(-68) 
When I run the simulation (using psolve), I find that the RE cell starts at -68 mV. I've tried using types 0, 1, 2, and 3 as the first argument to FInitializeHandler, all to no avail.

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

Re: Using FInitializeHandler to set initial voltages for a subset of cells

Post by ted » Fri Jul 12, 2019 10:05 am

First figure out how to initialize just one cell to -61 mV.

pascal
Posts: 73
Joined: Thu Apr 26, 2012 11:51 am

Re: Using FInitializeHandler to set initial voltages for a subset of cells

Post by pascal » Fri Jul 12, 2019 12:23 pm

Oh silly me, I need to use

pc.gid2cell(re_gid).soma.v=-61

Thanks Ted!

Post Reply