Page 1 of 1

Using FInitializeHandler to set initial voltages for a subset of cells

Posted: Thu Jul 11, 2019 7:24 pm
by pascal
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.

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

Posted: Fri Jul 12, 2019 10:05 am
by ted
First figure out how to initialize just one cell to -61 mV.

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

Posted: Fri Jul 12, 2019 12:23 pm
by pascal
Oh silly me, I need to use

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

Thanks Ted!