コード例 #1
0
ファイル: visrast.py プロジェクト: neuroidss/hnn
def getdspk(fn):
    ddat = {}
    try:
        ddat['spk'] = np.loadtxt(fn)
    except:
        print('Could not load', fn)
        quit()
    dspk = {'Cell': ([], [], []), 'Input': ([], [], [])}
    dhist = {}
    for ty in dclr.keys():
        dhist[ty] = []
    haveinputs = False
    for (t, gid) in ddat['spk']:
        ty = net.gid_to_type(gid)
        if ty in dclr:
            dspk['Cell'][0].append(t)
            dspk['Cell'][1].append(gid)
            dspk['Cell'][2].append(dclr[ty])
            dhist[ty].append(t)
        else:
            dspk['Input'][0].append(t)
            dspk['Input'][1].append(adjustinputgid(extinputs, gid))
            if extinputs.is_prox_gid(gid):
                dspk['Input'][2].append('r')
            elif extinputs.is_dist_gid(gid):
                dspk['Input'][2].append('g')
            else:
                dspk['Input'][2].append('orange')
            haveinputs = True
    for ty in dhist.keys():
        dhist[ty] = np.histogram(dhist[ty],
                                 range=(0, tstop),
                                 bins=int(tstop / binsz))
        if smoothsz > 0:
            #dhist[ty] = boxfilt(dhist[ty][0],smoothsz)
            dhist[ty] = hammfilt(dhist[ty][0], smoothsz)
        else:
            dhist[ty] = dhist[ty][0]
    return dspk, haveinputs, dhist
コード例 #2
0
 def smooth (self, winsz):
   if winsz <= 1: return 
   #for key in self.dpl.keys(): self.dpl[key] = boxfilt(self.dpl[key],winsz)
   for key in self.dpl.keys(): self.dpl[key] = hammfilt(self.dpl[key],winsz)