Exemplo n.º 1
0
    def save_dic(self, d, **k):
        print 'Saving ' + self.file_name
        for keys, data in misc.dict_iter(d):

            if not misc.dict_haskey(self.dic, keys):
                self.add_storage(keys)

            s = misc.dict_recursive_get(self.dic, keys)
            s.save_data('-'.join(keys), data, **k)

        self.save()
Exemplo n.º 2
0
 def save_dic(self, d, **k):
     print 'Saving '+self.file_name
     for keys, data in misc.dict_iter(d):
         
         if not misc.dict_haskey(self.dic, keys):
             self.add_storage(keys)
     
         s=misc.dict_recursive_get(self.dic, keys)
         s.save_data('-'.join(keys), data, **k)
     
     self.save()
Exemplo n.º 3
0
def postprocess(d):
    out = {}
    ylabels0 = sorted(d.keys())

    xlabels = sorted(d[ylabels0[0]]['Net_0'].keys())
    i, j = 0, 0
    for tp in ['beta', 'sw']:
        ylabels = []
        for key in ylabels0:
            if key[0] != tp[0] or len(d[key].keys()) < 2:
                continue
            ylabels.append(key)
            j += 1
            #             if j==396:
            #                 pass

            for net in d[key].keys():
                mrs = []
                for model in xlabels:
                    obj = d[key][net][model]['spike_statistic']
                    mrs.append(obj.rates['mean'])

                keys = [tp, net, 'mean_rates']
                if not misc.dict_haskey(out, keys):
                    misc.dict_recursive_add(out, keys, [mrs])
                    if net == 'Net_0': i += 1
                else:
                    out[tp][net]['mean_rates'].append(mrs)
                    if net == 'Net_0': i += 1
            if not i == j:
                print d[key].keys(), i, j
                raise


#             print j,i
        for net in d[key].keys():
            keys = [tp, net, 'xlabels']
            misc.dict_recursive_add(out, keys, xlabels)
            keys = [tp, net, 'ylabels']
            misc.dict_recursive_add(out, keys, ylabels)

    pp(out)
    for tp in out.keys():
        for net in out[tp].keys():
            out[tp][net]['mean_rates'] = numpy.array(
                out[tp][net]['mean_rates'])

    return out
Exemplo n.º 4
0
def postprocess(d):
    out={}
    ylabels0=sorted(d.keys())

    xlabels=sorted(d[ylabels0[0]]['Net_0'].keys())
    i,j=0,0
    for tp in ['beta','sw']:
        ylabels=[]
        for key in ylabels0:
            if key[0]!=tp[0] or len(d[key].keys())<2:
                continue
            ylabels.append(key)
            j+=1
#             if j==396:
#                 pass
            
            for net in d[key].keys():
                mrs=[]
                for model in xlabels:
                    obj=d[key][net][model]['spike_statistic']
                    mrs.append(obj.rates['mean'])
                
                keys=[tp, net, 'mean_rates']    
                if not misc.dict_haskey(out, keys):
                    misc.dict_recursive_add(out, keys, [mrs])
                    if net=='Net_0': i+=1
                else:
                    out[tp][net]['mean_rates'].append(mrs)
                    if net=='Net_0':i+=1
            if not i==j:
                print d[key].keys(), i,j
                raise
#             print j,i
        for net in d[key].keys(): 
            keys=[tp, net, 'xlabels']    
            misc.dict_recursive_add(out, keys, xlabels)
            keys=[tp, net, 'ylabels']  
            misc.dict_recursive_add(out, keys, ylabels)
        
    pp(out)
    for tp in out.keys():
        for net in out[tp].keys():
            out[tp][net]['mean_rates']=numpy.array(out[tp][net]['mean_rates'])
    
    return out
Exemplo n.º 5
0
def process_exp(exp, tr):
    out = {}

    put_at = {'STN': 3, 'TA': 0, 'TI': 1, 'all': 2}
    for keys, val in misc.dict_iter(exp):
        if keys[-1] == 'CV':
            continue
        keys2 = [tr[keys[1]], tr[keys[2]], 'mean_rates']

        if not misc.dict_haskey(out, keys2):
            a = numpy.zeros(4)
            a[put_at[keys[0]]] = val
            misc.dict_recursive_add(out, keys2, a)
        else:
            out[tr[keys[1]]][tr[keys[2]]]['mean_rates'][put_at[keys[0]]] = val

    pp(out)
    return out
Exemplo n.º 6
0
def process_exp(exp, tr):
    out={}
    
    put_at={'STN':3,
            'TA':0,
            'TI':1,
            'all':2}
    for keys, val in misc.dict_iter(exp):
        if keys[-1]=='CV':
            continue
        keys2=[tr[keys[1]],tr[keys[2]], 'mean_rates']
        
        if not misc.dict_haskey(out, keys2):
            a=numpy.zeros(4)
            a[put_at[keys[0]]]=val
            misc.dict_recursive_add(out, keys2,a )
        else:
            out[tr[keys[1]]] [tr[keys[2]]] ['mean_rates'][put_at[keys[0]]]=val

    pp(out)
    return out