def convert(filename1, filename2): old_gid_mgrs_begin = params.gid_granule_begin + params.Ngranule if old_gid_mgrs_begin % 2 != 0: old_gid_mgrs_begin += 1 gid_dict = {} bindict.load(filename1) for gid, ci in bindict.gid_dict.items(): gid_dict[gid + params.gid_mgrs_begin - old_gid_mgrs_begin] = ci bindict.gid_dict = gid_dict bindict.save(filename2)
def get_and_make_subset_connections(): #get the needed info global connection_file import bindict bindict.load(connection_file) subset = chk_consist(bindict.gid_dict, bindict.mgid_dict, bindict.ggid_dict) #make them import mgrs for mdgid in subset: c = bindict.gid_dict[mdgid] slot = mgrs.gid2mg(mdgid)[3] rs = mgrs.mk_mgrs(c[0], c[1], c[2], c[3], 0, c[4], slot) model.mgrss.update({rs.md_gid : rs}) print "%d mgrs created"%len(model.mgrss)
import fileinput wexc_mc = [] wexc_mt = [] winh_mc = [] winh_mt = [] for l in fileinput.input('../weightse1.25i0.4i0.4kdrmt0.3ks0.005.txt'): tk = l.split() wexc_mc += [float(tk[1])] winh_mc += [float(tk[2])] wexc_mt += [float(tk[3])] winh_mt += [float(tk[4])] for perc in [0, 50, 100]: bindict.load('fullbulb%d-v4.dic' % perc) for w_base in [0]: for glomid in [ 2, 10, 17, 33, 126, 99, 113, 5, 77, 105, 47, 98, 16, 8, 27 ]: filename = 'w%dcontrol%dp%de1.25i0.04i0.04' % (w_base, glomid, perc) gloms = set([37, glomid]) def issynapse(gid): return not (gidfunc.ismitral(gid) or gidfunc.ismtufted(gid) or gidfunc.isgranule(gid))
import binspikes sr = binspikes.SpikesReader('../../bulbvis/fullbulb-oldtraining-nomt.spk2') fo = open('../../bulbvis/fullbulb-oldtraining-nomt.weight.dat', 'w') import bindict bindict.load('../../bulbvis/fullbulb-oldtraining-nomt.dic') tcut = None import mgrs mgid = range(37 * 5, 37 * 5 + 5) for g, info in bindict.gid_dict.items(): if info[0] not in mgid: continue try: w = sr.step(g)[-1][-1] except KeyError: w = 0 fo.write('%d %d %g\n' % (g, w, 0)) g -= 1 try: if not tcut: w = sr.step(g)[-1][-1] else: _t, _w = sr.step(g) w = 0 for i in range(len(_t)): if _t[i] >= tcut and i > 0: w = _w[i - 1] break except KeyError: w = 0
# options gpalette = 'jet' # or 'winter' gthreshold = None gweights = True tube_active = True scale_mode = 'none' minfreq_shown = 4.0 maxfreq_shown = 30.0 import custom_params custom_params.filename = 'fig7' import params import bindict bindict.load('c10.dic') import granules syn_gid_begin = params.Nmitral+granules.Ngranule from colors import palette from math import sqrt import binspikes gthreshold = None tube_flag = False flag_dict = True interpolate_flag = False from sys import argv def granule_info(ggid): conns = bindict.ggid_dict[ggid] print '\n' print 'granule %d is connected with %d mitrals' % (ggid, len(conns)) for gid in conns:
import spikesreader as binspikes sr=binspikes.SpikesReader('../bulbvis3/training.spk2') fo=open('w0.weight.dat','w') import bindict bindict.load('fullbulb0-v4.dic') tcut=8000 import mgrs mgid = range(32*5,32*5+5)+range(32*10,32*10+10+635) for g, info in bindict.gid_dict.items(): if info[0] not in mgid: continue try: w=sr.step(g)[-1][-1] except KeyError: w=0 fo.write('%d %d %g\n' % (g,w,0)) g-=1 try: if not tcut: w=sr.step(g)[-1][-1] else: _t,_w=sr.step(g) w=0 for i in range(len(_t)): if _t[i] >= tcut and i > 0: w=_w[i-1] break except KeyError:
for gid in weights.keys(): if gid % 2 == 1 and gid >= params.gid_granule_begin + granules.ngranule: ggid = gd.gid_dict[gid + 1][3] w_new = weights[gid] if gcol.has_key(ggid): w_old = gcol[ggid] if w_old < w_new: gcol[ggid] = w_new else: gcol.update({ ggid:w_new }) return gcol import bindict as gd gd.load(filedict) from mayavi.mlab import figure, text fig = figure(bgcolor=(0, 0, 0)) from mayavi import mlab points3d=mlab.points3d import params import granules class GranulesManager: def __init__(self): self.gran = set() self.actor1 = None self.gran_color = (0., 157 / 255., 157 / 255.) self.mitrals = None
import custom_params as cp cp.filename = 'glomcfg27' import bindict bindict.load('miscd27c10.dic') import granules fo = open('gconnstats.txt', 'w') g = {} for ggid, conn in bindict.ggid_dict.items(): fo.write('%g\n' % len(conn)) fo.close()
for gid in weights.keys(): if gid % 2 == 1 and gid >= params.gid_granule_begin + granules.ngranule: ggid = gd.gid_dict[gid + 1][3] w_new = weights[gid] if gcol.has_key(ggid): w_old = gcol[ggid] if w_old < w_new: gcol[ggid] = w_new else: gcol.update({ggid: w_new}) return gcol import bindict as gd gd.load(filedict) from mayavi.mlab import figure, text fig = figure(bgcolor=(0, 0, 0)) from mayavi import mlab points3d = mlab.points3d import params import granules class GranulesManager: def __init__(self): self.gran = set() self.actor1 = None