def __init__(self, mgid, isec, xm, ggid, ipri, xg, slot): self.mgid = mgid self.ggid = ggid self.slot = slot self.xm = xm self.xg = xg self.isec = isec self.ipri = ipri self.msecden = split.msecden(mgid, isec) self.gpriden = split.gpriden(ggid, ipri) self.md_gid = mgrs_gid(mgid, ggid, slot) self.gd_gid = mgrs_gid(ggid, mgid, slot) self.md = None #ThreshDetect on mitral self.gd = None #ThreshDetect on granule self.fi = None #FastInhib on mitral self.ampanmda = None #AmpaNmda on granule self.gd2fi = None #NetCon to fi self.md2ampanmda = None #NetCon to ampanmda if pc.gid_exists(self.md_gid) > 0. or pc.gid_exists(self.gd_gid) > 0.: print "md_gid=%d and/or gd_gid already registered" % (self.md_gid, self.gd_gid) raise RuntimeError if self.msecden: self.md = h.ThreshDetect(self.msecden(xm)) self.fi = h.FastInhib(self.msecden(xm)) self.fi.gmax = params.inh_gmax self.fi.tau1 = params.fi_tau1 self.fi.tau2 = params.fi_tau2 pc.set_gid2node(self.md_gid, pc.id()) pc.cell(self.md_gid, h.NetCon(self.md, None), 1) if self.gpriden: self.spine = h.GranuleSpine() self.spine.neck.connect(self.gpriden(xg)) self.gd = h.ThreshDetect(self.spine.head(0.5)) self.ampanmda = h.AmpaNmda(self.spine.head(0.5)) self.ampanmda.gmax = params.exc_gmax pc.set_gid2node(self.gd_gid, pc.id()) pc.cell(self.gd_gid, h.NetCon(self.gd, None), 1) # Cannot be done above because output ports must exist prior to using # an output gid as an input port on the same process. if custom_params.makeSynConns: if custom_params.enableFIsyn and self.fi: self.gd2fi = pc.gid_connect(self.gd_gid, self.fi) self.gd2fi.weight[0] = 1 # normalized self.gd2fi.weight[1] = 0 self.gd2fi.delay = 1 if custom_params.enableAmpaNmdasyn and self.ampanmda: self.md2ampanmda = pc.gid_connect(self.md_gid, self.ampanmda) self.md2ampanmda.weight[0] = 1 #normalized self.md2ampanmda.weight[1] = 0 self.md2ampanmda.delay = 1
def record(gid, secid=None, arc=None): sec = None if ismitral(gid): if not secid: sec = split.msoma(gid) arc = 0.5 elif secid == -1: sec = split.mpriden(gid) else: sec = split.msecden(gid, secid) elif ismtufted(gid): if not secid: sec = split.msoma(gid) arc = 0.5 elif secid == -1: sec = split.mpriden(gid) else: sec = split.msecden(gid, secid) elif isgranule(gid): if not secid: sec = split.gsoma(gid) arc = 0.5 else: sec = split.gpriden(gid, secid) if sec: tvec.record(h._ref_t) filename = '%d' % gid if secid: filename += '-%d' % secid if arc: filename += '-%g' % arc filename += '.txt' filename = params.filename + '-' + filename vmrec = h.Vector() vmrec.record(sec(arc)._ref_v) vmrecordings.append((vmrec, filename))
def mk_mgrs(mgid, isec, xm, ggid, ipri, xg, slot): ''' Return MGRS instance if at least on half exists, otherwise None.''' if split.msecden(mgid, isec) or split.gpriden(ggid, ipri): return MGRS(mgid, isec, xm, ggid, ipri, xg, slot) return None
def __init__(self, mgid, isec, xm, ggid, ipri, xg, slot): self.mgid = mgid self.ggid = ggid self.slot = slot self.xm = xm self.xg = xg self.isec = isec self.ipri = ipri self.msecden = split.msecden(mgid, isec) self.gpriden = split.gpriden(ggid, ipri) self.md_gid = mgrs_gid(mgid, ggid) self.gd_gid = mgrs_gid(ggid, mgid) self.md = None #ThreshDetect on mitral self.gd = None #ThreshDetect on granule if params.use_fi_stdp: self.fi = None #FastInhibSTDP on mitral self.postspike2fi = None # negative weight NetCon from md to fi else: self.fi = None #FastInhib on mitral self.ampanmda = None #AmpaNmda on granule self.gd2fi = None #NetCon to fi self.md2ampanmda = None #NetCon to ampanmda if pc.gid_exists(self.md_gid) > 0. or pc.gid_exists(self.gd_gid) > 0.: print "md_gid=%d and/or gd_gid=%d already registered" % (self.md_gid, self.gd_gid) raise RuntimeError if self.msecden: self.md = h.ThreshDetect(self.msecden(xm)) if params.use_fi_stdp: self.fi = h.FastInhibSTDP(self.msecden(xm)) nc = h.NetCon(self.md, self.fi) self.postspike2fi = nc nc.weight[0] = -1 nc.delay = 1 else: self.fi = h.FastInhib(self.msecden(xm)) try: if params.training_inh: self.fi.training = 1 else: self.fi.training = 0 except: # print 'error' self.fi.training = 1 if ismitral(mgid): self.fi.gmax = params.mc_inh_gmax self.fi.tau1 = params.mc_fi_tau1 self.fi.tau2 = params.mc_fi_tau2 elif ismtufted(mgid): self.fi.gmax = params.mt_inh_gmax self.fi.tau1 = params.mt_fi_tau1 self.fi.tau2 = params.mt_fi_tau2 pc.set_gid2node(self.md_gid, pc.id()) pc.cell(self.md_gid, h.NetCon(self.md, None), 1) if self.gpriden: self.spine = h.GranuleSpine() if gcissup(self.ggid): self.spine.sup_deep_flag(1) else: self.spine.sup_deep_flag(0) self.spine.neck.connect(self.gpriden(xg)) #self.dsac = dSAC(self.ggid, self.spine) self.gd = h.ThreshDetect(self.spine.head(0.5)) self.gd.vthresh = -50 self.ampanmda = h.AmpaNmda(self.spine.head(0.5)) if ismitral(mgid): self.ampanmda.gmax = params.mc_exc_gmax elif ismtufted(mgid): self.ampanmda.gmax = params.mt_exc_gmax try: if params.training_exc: self.ampanmda.training = 1 else: self.ampanmda.training = 0 except: # print 'error' self.ampanmda.training = 1 pc.set_gid2node(self.gd_gid, pc.id()) pc.cell(self.gd_gid, h.NetCon(self.gd, None), 1) # Cannot be done above because output ports must exist prior to using # an output gid as an input port on the same process. if self.fi: self.gd2fi = pc.gid_connect(self.gd_gid, self.fi) if params.use_fi_stdp: self.gd2fi.weight[0] = 1 else: self.gd2fi.weight[0] = 1 # normalized try: init_inh_weight = params.init_inh_weight except: init_inh_weight = 0 self.gd2fi.weight[1] = init_inh_weight self.gd2fi.delay = 1 if self.ampanmda: self.md2ampanmda = pc.gid_connect(self.md_gid, self.ampanmda) self.md2ampanmda.weight[0] = 1 #normalized try: init_exc_weight = params.init_exc_weight except: init_exc_weight = 0 self.md2ampanmda.weight[1] = init_exc_weight self.md2ampanmda.delay = 1