コード例 #1
0
def init_gap_junctions():

    # initialize source
    for mgid in range(params.Nmitral):
        mpriden = split.mpriden(mgid)
        if mpriden:
            mpriden.push()
            pc.source_var(mpriden(0.99)._ref_v, mgid)
            h.pop_section()
            
    pc.barrier()

    # initialize targets
    for mgid in range(params.Nmitral):
        mpriden = split.mpriden(mgid)
        if mpriden:
            glomid = mgid/nmxg
            for sistermgid in range(glomid * nmxg, mgid)+range(mgid+1, (glomid+1)*nmxg):
                if pc.gid_exists(sistermgid) > 0:
                    gap = h.Gap(mpriden(0.99))
                    if sistermgid != 189:
                        getmodel().gj[(mgid, sistermgid)] = gap
                        glomid = mgid / nmxg
                        pc.target_var(gap, gap._ref_vgap, sistermgid)
    util.elapsed('Gap junctions builden')
コード例 #2
0
def send_to_master(srcvec):
    global vcnts
    if vcnts is None:
        vcnts = h.Vector(nhost)
        vcnts.x[0] = len(srcvec)
    destvec = h.Vector()
    pc.alltoall(srcvec, vcnts, destvec)
    pc.barrier()
    return destvec
コード例 #3
0
ファイル: net3d.py プロジェクト: nrnhines/Heart-3D
def test1():
    pc.barrier()
    for r in range(nhost):
        if r == rank:
            for gid1 in gidinfo:
                cellinfo = gidinfo[gid1]
                for gid2, gap in cellinfo.gaps.items():
                    print("%d %d %g" % (gid1, gid2, gap.g))
        pc.barrier()
コード例 #4
0
ファイル: cellorg.py プロジェクト: nrnhines/Heart-3D
def paraboloid_to_file(par):
    if rank == 0:
        try:
            import pickle
            fname = paraboloid_filename()
            f = open(fname, "wb")
            pickle.dump(par, f)
            print("dumped paraboloid to " + fname)
        except:
            print("could not dump " + fname)
            pass
    pc.barrier()
コード例 #5
0
ファイル: cellorg.py プロジェクト: nrnhines/Heart-3D
def paraboloid_from_file():
    par = None
    if rank == 0:
        try:
            import pickle
            fname = paraboloid_filename()
            f = open(fname, "rb")
            par = pickle.load(f)
            print("paraboloid read from " + fname)
        except:
            print(fname + " does not exist. Will be created")
    par = pc.py_broadcast(par, 0)
    pc.barrier()
    return par
コード例 #6
0
ファイル: gapjunc.py プロジェクト: ModelDBRepository/240116
def init():
    data = {}
    for uid in range(nhost):
      data.update({ uid:(getmodel().mitrals.keys()) })
    data = a2a.all2all(data)
    mgids = []
    for _mgids in data.values(): mgids += _mgids
    mgids = set(mgids)

    # initialize source
    
    for mgid in getmodel().mitrals.keys():
        mpriden = split.mpriden(mgid)
        if not mpriden:
          continue
       
        rgj = params.ranstream(mgid, params.stream_gap_junction)

        
        mpriden.push()
        secref = h.SectionRef()
        h.pop_section()
        
        h.mk_gj_src(pc, mgid, secref)

        glomid = mgid2glom(mgid)
        
        sistergids = []

        # no longer all to all, only a chain
        if not (ismtufted(mgid) and (mgid - nmi) % nmt == (nmt - 1)):
            if ismitral(mgid) and mgid % nmxg == (nmxg - 1):
                sistergids += [glomid * nmt + nmi]
            else:
                sistergids += [mgid + 1]
            
        if not (ismitral(mgid) and mgid % nmxg == 0):
            if ismtufted(mgid) and (mgid - nmi) % nmt == 0:
                sistergids += [(glomid + 1) * nmxg - 1]
            else:
                sistergids += [mgid - 1]
            
        sistergids = mgids.intersection(range(glomid * nmxg, glomid * nmxg + nmxg) + range(glomid * nmt + nmi, glomid * nmt + nmt + nmi)).difference([ mgid ])  

        for sistermgid in sistergids:
            gap = h.Gap(mpriden(0.99))

            if ismitral(mgid) and ismitral(sistermgid):
                gap.g = rgj.uniform(gj_min_g1, gj_max_g1)
            elif  ismtufted(mgid) and ismtufted(sistermgid):
                gap.g = rgj.uniform(gj_min_g3, gj_max_g3)
            else:
                gap.g = rgj.uniform(gj_min_g2, gj_max_g2)
                

            getmodel().gj[(mgid, sistermgid)] = gap
            

    pc.barrier()

    # initialize targets
    for key, gap in getmodel().gj.items():
        mgid, sistermgid = key
        pc.target_var(gap, gap._ref_vgap, sistermgid)

    util.elapsed('Gap junctions built')
コード例 #7
0
ファイル: net3d.py プロジェクト: nrnhines/Heart-3D
    pyplot.hist([c.cell.soma(.5).area() for c in gidinfo.values()])
    pyplot.show()
    pyplot.hist([c.cell.soma.L for c in gidinfo.values()])
    pyplot.show()
    pyplot.hist([
        gap.g for cellinfo in gidinfo.values()
        for gap in cellinfo.gaps.values()
    ])
    pyplot.show()


def showpurk():  # only for nhost=1
    global g
    g = h.Graph()
    g.size(0, npts[0][-1], 0, ncircle[0])
    for gid, ci in gidinfo.items():
        if ci.is_purk:
            ilayer, icircle, ipt = gid2org(gid)
            g.mark(ipt, icircle, "S", 10)


if __name__ == '__main__':
    mknet()
    #test1()
    #test2()
    #purkstim()
    circlestim()
    if pc.nhost() > 1:
        pc.barrier()
        h.quit()