def perturbations(rep,res, sizes):

    threads=20

    l=[]
    
#     l.append(op.get()[0])
#     l.append(op.get()[4::3])
    l=op.get()
    
    ll=[]
    
    

    for size in sizes:
        for i, _l in enumerate(l):
            _lt=deepcopy(_l)
            per=pl({'netw':{'size':size, 
                            'sub_sampling':{'M1':1,
                                            'M2':1},}},
                      '=', 
                      **{'name':''})
            _lt+=per
    
            _lt+=pl({'simu':{'threads':threads}},'=')
            ll.append(_lt)

    return ll, threads
def get():

    l = []
    solution, s_mul, s_equal = get_solution_slow_GP_striatum_2()

    for y in numpy.arange(1.0, -0.1, -0.25):
        for z in numpy.arange(1.0, -0.1, -0.25):
            x = 2.5
            d = {}
            for keys in s_mul:
                update(solution, d, keys)

            misc.dict_update(d, {'nest': {'GI_GA_gaba': {'weight': y}}})
            misc.dict_update(d, {'nest': {'ST_GA_ampa': {'weight': z}}})

            l += [pl(d, '*', **{'name': ''})]

            d = {}
            for keys in s_equal:
                update(solution, d, keys)

            l[-1] += pl(d, '=',
                        **{'name': 'GIGA_' + str(y) + '_STGA_' + str(z)})

    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    
    x=2.5-1.25
    d={}
    for keys in s_mul: update(solution, d, keys)  
    l+=[pl(d, '*', **{'name':''})]
      
    d={}
    for keys in s_equal: update(solution, d, keys) 
    
    misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
    misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
    d['node']['EA']['rate']*=0.7
    
    misc.dict_update(d,{'node':{'CS':{'rate': 830.}}})
    misc.dict_update(d,{'nest':{'GI_ST_gaba':{'weight':0.35 }}})
    
    l[-1]+=pl(d, '=', **{'name':'mod_ST_beta_'+str(x)})    
            
    
    
    
    
    return l
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    v0 = numpy.arange(1.25, 3.75, 0.5)
    v1 = numpy.arange(2.5, 5., 0.5)
    v = [[x, y] for x in v0 for y in v1]
    for x, y in v:

        d = {}
        for keys in s_mul:
            update(solution, d, keys)
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)

        misc.dict_update(d, {'nest': {'ST': {'beta_I_GABAA_1': f_beta_rm(x)}}})
        misc.dict_update(d, {'nest': {'ST': {'beta_I_AMPA_1': f_beta_rm(y)}}})
        misc.dict_update(d, {'nest': {'ST': {'beta_I_NMDA_1': f_beta_rm(y)}}})

        d['node']['EA']['rate'] *= 0.7
        l[-1] += pl(d, '=',
                    **{'name': ('mod_ST_beta_' + str(x) + '_' + str(y))})

    return l
def get():
    
    l=[];
    p={'equal':{},
          'mul':{}}#

    
    for w1, w2 in [
                    [1., .0],      
                    [.8, .2], 
                    [.6, .4],    
                    [.5, .5],    
                    [.4, .6],       
                    [.2, .8],      
                    [.0, 1.],
                   ]:
                     
        d={}
        
        d=misc.dict_update(p['mul'], d) 
        
        l+=[pl(d, '*', **{'name':''})]
        
        d={'nest':{
                   'GA_FS_gaba':{'weight':w1},
                   'GF_FS_gaba':{'weight':w2}
                  }}

        d=misc.dict_update(p['equal'], d) 

        s='GA_{0}_GF_{1}'.format( w1, w2 )
        
        l[-1]+=pl(d, '=', **{'name':s})     
    
    return l
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    x = 2.5 - 1.25
    d = {}
    for keys in s_mul:
        update(solution, d, keys)
    l += [pl(d, '*', **{'name': ''})]

    d = {}
    for keys in s_equal:
        update(solution, d, keys)

    misc.dict_update(d, {'nest': {'ST': {'beta_I_AMPA_1': f_beta_rm(x)}}})
    misc.dict_update(d, {'nest': {'ST': {'beta_I_NMDA_1': f_beta_rm(x)}}})
    d['node']['EA']['rate'] *= 0.7

    misc.dict_update(d, {'node': {'CS': {'rate': 830.}}})
    misc.dict_update(d, {'nest': {'GI_ST_gaba': {'weight': 0.35}}})

    l[-1] += pl(d, '=', **{'name': 'mod_ST_beta_' + str(x)})

    return l
def get():

    l = []
    solution = get_solution_slow_GP_striatum_2()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    for a, b in zip([200., 300., 300., 400., 500.],
                    [a * 0.25 for a in [0.75, 0.75, 0.5, 0.5, 0.5]]):

        z = 1.2
        y = 0.75
        d = {}
        misc.dict_update(d, solution['mul'])

        misc.dict_update(d, {'node': {'CS': {'rate': y}}})
        misc.dict_update(d, {'node': {'CF': {'rate': z}}})

        misc.dict_update(d, {'nest': {'ST_GA_ampa': {'weight': b}}})

        l += [pl(d, '*', **{'name': ''})]

        d = {}
        misc.dict_update(d, solution['equal'])

        d['node']['EI']['rate'] *= y
        d['node']['EA']['rate'] = a

        misc.dict_update(d, {'nest': {'GI': {'beta_I_GABAA_1': f_beta_rm(2)}}})

        l[-1] += pl(d, '=',
                    **{'name': 'all_EIEACS_' + str(a) + '_STGAw_' + str(b)})

    return l
Пример #8
0
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    d = {}
    for x in numpy.arange(3.4, 6, 0.4):
        #         x=3.4
        y = 2.25

        for keys in s_mul:
            update(solution, d, keys)
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)
        print f_beta_rm(x)
        misc.dict_update(d, {'nest': {'ST': {'beta_I_AMPA_1': f_beta_rm(x)}}})
        misc.dict_update(d, {'nest': {'ST': {'beta_I_NMDA_1': f_beta_rm(x)}}})
        misc.dict_update(d, {'nest': {'ST': {'beta_I_GABAA_1': f_beta_rm(y)}}})

        #         d['node']['EA']['rate']*=0.7

        l[-1] += pl(
            d, '=',
            **{'name': 'mod_CS_STbeta_' + str(x) + '_GA_STbeta_' + str(y)})

    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution_slow_GP_striatum()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
   
    d={}
    for x in numpy.arange(3.4, 6, 0.4):
#         x=3.4
        y=2.25
            
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys) 
        
        misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
        misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
        misc.dict_update(d,{'nest':{'ST':{'beta_I_GABAA_1': f_beta_rm(y)}}})
        
        d['node']['EA']['rate']*=0.7    
        
        l[-1]+=pl(d, '=', **{'name':'mod_CS_STbeta_'+str(x)+'_GA_STbeta_'+str(y)})    

    
    return l
Пример #10
0
def get():

    l = []
    solution, s_mul, s_equal = get_solution_slow_GP_striatum()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    for y in numpy.arange(0.9, 0.0, -0.2):
        x = 2.5
        d = {}
        for keys in s_mul:
            update(solution, d, keys)

        misc.dict_update(d, {'conn': {'nest': {'GI_GA_gaba': {'weight': y}}}})
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)

        misc.dict_update(d, {'nest': {'ST': {'beta_I_AMPA_1': f_beta_rm(x)}}})
        misc.dict_update(d, {'nest': {'ST': {'beta_I_NMDA_1': f_beta_rm(x)}}})
        d['node']['EA']['rate'] *= 0.7

        l[-1] += pl(d, '=', **{'name': 'mod_ST_beta_' + str(x)})

    return l
def get():
        
    l=[]
    solution, s_mul, s_equal=get_solution()
    
    # Decrease/increase C1,C2,CF,CS, EI and EA. Test idea that at
    # slow wave cortical and thalamic input is decreased. 
    mod=numpy.arange(0.5, 1.5, 0.05)
    for x in mod:

        
        d={}
        for keys in s_mul: update(solution, d, keys) 
        misc.dict_update(d, {'node':{'CF':{'rate':x}}} )
        misc.dict_update(d, {'node':{'CS':{'rate':x}}} )

        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys)

        d['node']['C1']['rate']*=x
        d['node']['C2']['rate']*=x        
        d['node']['EI']['rate']*=x
        d['node']['EA']['rate']*=x
        l[-1]+=pl(d, '=', **{'name':'mod_C1_C2_CF_CS_EI_EA_'+str(x)}) 
              

    return l
Пример #12
0
def perturbations(rep, res):

    threads = 2

    l = []

    #     l.append(op.get()[0])
    l.append(op3.get()[3])

    ll = []

    p_sizes = [0.1989460102, 0.1608005821, 0.122655154, 0.0845097259]
    p_sizes = [p / p_sizes[0] for p in p_sizes]
    max_size = 4000
    for ss, p_size in zip([6.25, 8.3, 12.5, 25], p_sizes):

        for i, _l in enumerate(l):
            _l = deepcopy(_l)
            per = pl(
                {
                    'netw': {
                        'size': int(p_size * max_size),
                        'sub_sampling': {
                            'M1': ss,
                            'M2': ss
                        },
                    }
                }, '=', **{'name': 'ss-' + str(ss)})
            _l += per

            _l += pl({'simu': {'threads': threads}}, '=')
            ll.append(_l)

    return ll, threads
def get():

    l = []
    solution = get_solution()

    d = {}
    misc.dict_update(d, solution['mul'])
    l += [pl(d, '*', **{'name': ''})]

    d = {}
    misc.dict_update(d, solution['equal'])
    dd = {
        'conn': {
            'GAp_GA_gaba': {
                'fan_in': 5
            },
            'GIp_GA_gaba': {
                'fan_in': 25
            }
        },
        'nest': {
            'ST_GA_ampa': {
                'weight': 0.259
            }
        }
    }  #estimate from beta opt
    misc.dict_update(d, dd)
    l[-1] += pl(d, '=', **{'name': 'control_sim'})

    return l
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    # Decrease/increase C1,C2,CF,CS, EI and EA. Test idea that at
    # slow wave cortical and thalamic input is decreased.
    mod = numpy.arange(0.5, 1.5, 0.05)
    for x in mod:

        d = {}
        for keys in s_mul:
            update(solution, d, keys)
        misc.dict_update(d, {'node': {'CF': {'rate': x}}})
        misc.dict_update(d, {'node': {'CS': {'rate': x}}})

        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)

        d['node']['C1']['rate'] *= x
        d['node']['C2']['rate'] *= x
        d['node']['EI']['rate'] *= x
        d['node']['EA']['rate'] *= x
        l[-1] += pl(d, '=', **{'name': 'mod_C1_C2_CF_CS_EI_EA_' + str(x)})

    return l
Пример #15
0
def get():

    l = []
    solution, s_mul, s_equal = get_solution_slow_GP_striatum()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    v = STN_ampa_gaba_input_magnitude()

    for _, x, y in v:
        #     x=2.5-1
        d = {}
        for keys in s_mul:
            update(solution, d, keys)
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)

        #     misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
        #     misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
        #     d['node']['EA']['rate']*=0.7

        misc.dict_update(d, {'node': {'CS': {'rate': x}}})
        misc.dict_update(d, {'nest': {'GI_ST_gaba': {'weight': y}}})

        l[-1] += pl(d, '=', **{'name': 'mod_ST_inp_' + str(x) + '_' + str(y)})

    return l
Пример #16
0
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    y = 2.5

    v = numpy.arange(0.1, 1.2, 0.1)
    for x in v:
        d = {}
        for keys in s_mul:
            update(solution, d, keys)
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)
        misc.dict_update(d, {'nest': {'ST': {'beta_I_AMPA_1': f_beta_rm(y)}}})
        misc.dict_update(d, {'nest': {'ST': {'beta_I_NMDA_1': f_beta_rm(y)}}})

        misc.dict_update(d, {'nest': {'GA_M1_gaba': {'weight': x}}})
        misc.dict_update(d, {'nest': {'GA_M2_gaba': {'weight': x}}})
        misc.dict_update(d, {'nest': {'GA_FS_gaba': {'weight': x}}})

        d['node']['EA']['rate'] *= 0.7
        l[-1] += pl(d, '=', **{'name': ('mod_GA_striatum_1' + str(x))})

    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    

    v0=numpy.arange(1.25,3.75,0.5)
    v1=numpy.arange(2.5, 5.,0.5)
    v=[[x,y] for x in v0 for y in v1]
    for x, y in v:
         
        d={}
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
           
        d={}
        for keys in s_equal: update(solution, d, keys) 
 
        misc.dict_update(d,{'nest':{'ST':{'beta_I_GABAA_1': f_beta_rm(x)}}})        
        misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(y)}}})
        misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(y)}}})
         
        d['node']['EA']['rate']*=0.7
        l[-1]+=pl(d, '=', **{'name':('mod_ST_beta_'
                                     +str(x)+'_'+str(y))
                             })    

    
    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    
    
    for nodes in [['M1', 'M2'],
                  ['M1', 'M2', 'FS'],
                  ['M1', 'M2', 'FS','ST', 'GA', 'GI','SN']]:
        x=2.5
        d={}
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys) 
        
        misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
        misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
        d['node']['EA']['rate']*=0.7
        
        for node in nodes:
            misc.dict_update(d,{'node':{node:{'edge_wrap':False}}})
            
        
        l[-1]+=pl(d, '=', **{'name':'mod_ST_beta_'+str(x)})    
            
    
    return l
def get():

    l = []
    solution = get_solution()

    d = {}
    misc.dict_update(d, solution['mul'])
    l += [pl(d, '*', **{'name': ''})]

    d = {}
    misc.dict_update(d, solution['equal'])
    dd = {
        'conn': {
            'GAp_GA_gaba': {
                'fan_in': 5
            },
            'GIp_GA_gaba': {
                'fan_in': 25
            }
        }
    }
    misc.dict_update(d, dd)
    l[-1] += pl(d, '=', **{'name': 'control_sim'})

    return l
Пример #20
0
def perturbations(rep, res):

    threads = 2

    l = []

    l.append(op.get()[0])
    l.append(op3.get()[3])

    ll = []
    for ss in [25, 50, 75]:

        for i, _l in enumerate(l):
            _l = deepcopy(_l)
            per = pl({'netw': {
                'sub_sampling': {
                    'M1': ss,
                    'M2': ss
                },
            }}, '=', **{'name': 'ss-' + str(ss)})
            _l += per

            _l += pl({'simu': {'threads': threads}}, '=')
            ll.append(_l)

    return ll, threads
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    #     d0=0.8
    #     f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))

    #     x=2.5
    for x in numpy.arange(0.7, 1.5, 0.2):

        d = {}
        for keys in s_mul:
            update(solution, d, keys)
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)

        #     misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
        #     misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
        d['node']['EA']['rate'] *= x

        l[-1] += pl(d, '=', **{'name': 'mod_EA_' + str(x)})

    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution()
    
#     d0=0.8
#     f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    
#     x=2.5
    for x in numpy.arange(0.7, 1.5 ,0.2):
    
        d={}
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys) 
        
    #     misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
    #     misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
        d['node']['EA']['rate']*=x
        
        l[-1]+=pl(d, '=', **{'name':'mod_EA_'+str(x)})    
            
    
    return l
def get():
     
     
    l=[]
    solution, s_mul, s_equal=get_solution()
     
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
     
    y=2.5
    
        
    v=numpy.arange(0.1,1.2,0.1)
    for x in v:      
        d={}
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
             
        d={}
        for keys in s_equal: update(solution, d, keys)  
        misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(y)}}})
        misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(y)}}})
                
        misc.dict_update(d,{'nest':{'GA_M1_gaba':{'weight': x}}})
        misc.dict_update(d,{'nest':{'GA_M2_gaba':{'weight': x}}})
        misc.dict_update(d,{'nest':{'GA_FS_gaba':{'weight': x}}})
        
        d['node']['EA']['rate']*=0.7
        l[-1]+=pl(d, '=', **{'name':('mod_GA_striatum_1' + str(x))
                         })   
     
    return l
def get():

    l = []
    solution = get_solution()

    for r in numpy.arange(0, 1200, 200):
        r = numpy.float(r)
        d = {}
        misc.dict_update(d, solution['mul'])
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        misc.dict_update(d, solution['equal'])
        dd = {
            'conn': {
                'GAp_GA_gaba': {
                    'fan_in': 5
                },
                'GIp_GA_gaba': {
                    'fan_in': 25
                }
            },
            'node': {
                'EAp': {
                    'rate': r
                }
            }
        }
        misc.dict_update(d, dd)
        l[-1] += pl(d, '=', **{'name': 'GAr_{0}'.format(r)})

    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution_slow_GP_striatum()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    v=STN_ampa_gaba_input_magnitude()
    
    for _, x, y in v:
#     x=2.5-1
        d={}
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys) 
        
    #     misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
    #     misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
    #     d['node']['EA']['rate']*=0.7
        
        misc.dict_update(d,{'node':{'CS':{'rate': x}}})
        misc.dict_update(d,{'nest':{'GI_ST_gaba':{'weight':y }}})
        
        l[-1]+=pl(d, '=', **{'name':'mod_ST_inp_'+str(x)+'_'+str(y)})    
    
    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution_slow_GP_striatum()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    
    x=2.5
    d={}
    for keys in s_mul: update(solution, d, keys)  
    l+=[pl(d, '*', **{'name':''})]
      
    d={}
    for keys in s_equal: update(solution, d, keys) 
    
    misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
    misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
    d['node']['EA']['rate']*=0.7
    
    l[-1]+=pl(d, '=', **{'name':'mod_ST_beta_'+str(x)})    
            
    
    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution_slow_GP_striatum()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    
    x=2.5
    d={}
    for keys in s_mul: update(solution, d, keys)  
    l+=[pl(d, '*', **{'name':''})]
      
    d={}
    for keys in s_equal: update(solution, d, keys) 
    
    
    misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2.)}}})
    misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
    misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
    
    d['node']['EA']['rate']*=0.7
    
    l[-1]+=pl(d, '=', **{'name':'mod_ST_beta_'+str(x)})    
            
    
    return l
Пример #28
0
def perturbations(rep, res):

    threads = 4

    l = []

    #     l.append(op.get()[0])
    #     l.append(op3.get()[3])
    l = op.get()[4::3]
    ll = []

    p_sizes = [
        0.1989460102,
        #      0.1608005821,
        #      0.122655154,
        #              0.0845097259
    ]
    p_sizes = [p / p_sizes[0] for p in p_sizes]
    max_size = 4000
    for ss, p_size in zip(
        [
            6.25,
            #8.3 ,
            #12.5,
            #                            25
        ],
            p_sizes):

        for i, _l in enumerate(l):
            _l = deepcopy(_l)
            per = pl(
                {
                    'netw': {
                        'size': int(p_size * max_size),
                        'sub_sampling': {
                            'M1': ss,
                            'M2': ss
                        },
                    }
                }, '=', **{'name': 'ss-' + str(ss)})
            _l += per

            _l += pl({'simu': {'threads': threads}}, '=')
            ll.append(_l)

    for _l in ll:
        _l += pl(
            {
                'conn': {
                    'FS_M1_gaba': {
                        'rule': 'set-not_set'
                    },
                    'FS_M2_gaba': {
                        'rule': 'set-not_set'
                    }
                }
            }, '=')

    return ll, threads
def get():
    def get_perturbation_dics(c, w_rel):
        d = {}
        for key in c.keys():
            for conn in c[key]:
                u = {key: {'nest': {conn: {'weight': w_rel}}}}
                d = misc.dict_update(d, u)
        return d

    c = {
        'FS_FS': ['FS_FS_gaba'],
        'FS_MS': ['FS_M1_gaba', 'FS_M2_gaba'],
        'FS_M1': ['FS_M1_gaba'],
        'FS_M2': ['FS_M2_gaba'],
        'GA_FS': ['GA_FS_gaba'],
        'GA_GA': ['GA_GA_gaba'],
        'GA_GI': ['GA_GI_gaba'],
        'GA_M1': ['GA_M1_gaba'],
        'GA_M2': ['GA_M2_gaba'],
        'GI_GA': ['GI_GA_gaba'],
        'GI_GI': ['GI_GI_gaba'],
        'GI_SN': ['GI_SN_gaba'],
        'GI_ST': ['GI_ST_gaba'],
        'M1_SN': ['M1_SN_gaba'],
        'M2_GI': ['M2_GI_gaba'],
        'MS_MS': ['M1_M1_gaba', 'M1_M2_gaba', 'M2_M1_gaba', 'M2_M2_gaba'],
        'M1_M1': ['M1_M1_gaba'],
        'M1_M2': ['M1_M2_gaba'],
        'M2_M1': ['M2_M1_gaba'],
        'M2_M2': ['M2_M2_gaba'],
        'ST_GA': ['ST_GA_ampa'],
        'ST_GI': ['ST_GI_ampa'],
        'ST_SN': ['ST_SN_ampa'],
    }
    mod = [
        0.06125,
        0.125,
        0.25,
        0.5,
        0.75,  # 0.75, 
        1.33,
        2,
        4,
        8,
        16
    ]
    l = []

    l += [pl(**{'name': 'no_pert'})]

    for key, val in c.items():
        for w_rel in mod:
            d = get_perturbation_dics({key: val}, w_rel)

            l.append(
                pl(d.values()[0], '*',
                   **{'name': d.keys()[0] + '_pert_' + str(w_rel)}))

    return l
Пример #30
0
def pert_add_go_nogo_ss(**kwargs):

    l = kwargs.get('perturbation_list')

    do_not_record = kwargs.get('do_not_record', [])
    local_num_threads = kwargs.get('local_num_threads')
    max_size = kwargs.get('max_size')
    p_sizes = kwargs.get('p_sizes')
    p_subsamp = kwargs.get('p_subsamp')
    to_memory = kwargs.get('to_memory', False)
    to_file = kwargs.get('to_file', True)

    ll = []

    p_sizes = [p / max(p_sizes) for p in p_sizes]
    for ss, p_size in zip(p_subsamp, p_sizes):
        for i, _l in enumerate(l):
            _l = deepcopy(_l)
            per = pl(
                {
                    'netw': {
                        'size': int(p_size * max_size),
                        'sub_sampling': {
                            'M1': ss,
                            'M2': ss
                        },
                    }
                }, '=', **{'name': 'ss-' + str(ss)})
            _l += per

            _l += pl(
                {
                    'simu': {
                        'local_num_threads': local_num_threads,
                        'do_reset': True,
                        'sd_params': {
                            'to_file': to_file,
                            'to_memory': to_memory
                        }
                    }
                }, '=')

            if do_not_record:
                for model in do_not_record:
                    _l += pl(
                        {'node': {
                            model: {
                                'sd': {
                                    'active': False
                                }
                            }
                        }},
                        '=',
                        #                            **{'name':'exclude-'+'_'.join(do_not_record)}
                    )
            ll.append(_l)

    return ll
Пример #31
0
def perturbations(rep, res):

    threads = 20

    l = []

    #     l.append(op.get()[0])
    #     l.append(op.get()[4::3])
    l.append(op.get()[4 + 3])

    ll = []
    #     w=0.4
    p_sizes = [0.1989460102, 0.1608005821, 0.122655154, 0.0845097259]
    p_sizes = [p / p_sizes[0] for p in p_sizes]
    max_size = 4000
    for ss, p_size in zip([6.25, 8.3, 12.5, 25], p_sizes):

        for i, _l in enumerate(l):
            _l = deepcopy(_l)
            per = pl(
                {
                    'netw': {
                        'size': int(p_size * max_size),
                        'sub_sampling': {
                            'M1': ss,
                            'M2': ss
                        },
                    }
                }, '=', **{'name': 'ss-' + str(ss)})
            _l += per

            _l += pl({'simu': {'threads': threads}}, '=')
            ll.append(_l)


#     for _l in deepcopy([ll[0]]):
#         _lr=deepcopy(_l)
#         _lr.update_list(
#             pl({'nest':{'GA_M1_gaba':{'weight':5*2.*w},
# #                         'GA_FS_gaba':{'weight':0.1}
#                         }},'*', **{'name':'GA-XX-equal'}))
#         ll.append(_lr)
#
#         _lr=deepcopy(_l)
#         _lr.update_list(
#             pl({'nest':{'GA_M1_gaba':{'weight':5*4.*w},
# #                         'GA_FS_gaba':{'weight':0.1}
#                         }},'*', **{'name':'GA-XX-equal'}))
#         ll.append(_lr)
#
#         _lr=deepcopy(_l)
#         _lr.update_list(
#             pl({'nest':{'GA_M1_gaba':{'weight':5*0.5*w},
# #                         'GA_FS_gaba':{'weight':0.1}
#                         }},'*', **{'name':'GA-XX-equal'}))
#         ll.append(_lr)

    return ll, threads
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    #     v=STN_ampa_gaba_input_magnitude()[0:5]

    for _, u, w in v:

        v0 = numpy.arange(1.25, 3.75, 1.)
        v1 = numpy.arange(1.5, 4, 1.)
        v = [[x, y] for x in v0 for y in v1]
        for x, y in v:

            d = {}
            for keys in s_mul:
                update(solution, d, keys)
            l += [pl(d, '*', **{'name': ''})]

            d = {}
            for keys in s_equal:
                update(solution, d, keys)

            misc.dict_update(
                d, {'nest': {
                    'ST': {
                        'beta_I_GABAA_1': f_beta_rm(x)
                    }
                }})
            misc.dict_update(d,
                             {'nest': {
                                 'ST': {
                                     'beta_I_AMPA_1': f_beta_rm(y)
                                 }
                             }})
            misc.dict_update(d,
                             {'nest': {
                                 'ST': {
                                     'beta_I_NMDA_1': f_beta_rm(y)
                                 }
                             }})
            misc.dict_update(d, {'node': {'CS': {'rate': u}}})
            misc.dict_update(d, {'nest': {'GI_ST_gaba': {'weight': w}}})
            d['node']['EA']['rate'] *= 0.7
            l[-1] += pl(
                d, '=', **{
                    'name': ('mod_ST_beta_' + str(u) + '_' + str(w) + '_' +
                             str(x) + '_' + str(y))
                })

    return l
Пример #33
0
def get():

    l = []
    solution = get_solution_slow_GP_striatum_2()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    for y, x in zip(numpy.arange(5., 29., 5.), [1., 1.1, 1.15, 1.2, 1.25]):
        z = 1.25

        d = {}
        misc.dict_update(d, solution['mul'])
        misc.dict_update(d, {'node': {'CS': {'rate': z}}})
        misc.dict_update(d, {'node': {'CF': {'rate': x}}})
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        misc.dict_update(d, solution['equal'])

        dd = {
            'conn': {
                'GA_GA_gaba': {
                    'fan_in0': y,
                    'rule': 'all-all'
                },
                'GA_GI_gaba': {
                    'fan_in0': 2,
                    'rule': 'all-all'
                },
                'GI_GA_gaba': {
                    'fan_in0': 30 - y,
                    'rule': 'all-all'
                },
                'GI_GI_gaba': {
                    'fan_in0': 28,
                    'rule': 'all-all'
                }
            }
        }

        misc.dict_update(d, dd)

        d['node']['EI']['rate'] *= z
        d['node']['EA']['rate'] = 200.0

        misc.dict_update(d, {'nest': {'GI': {'beta_I_GABAA_1': f_beta_rm(2)}}})

        l[-1] += pl(d, '=',
                    **{'name': 'GAGA_' + str(y) + '_GIGA_' + str(30 - y)})

    return l
Пример #34
0
def perturbations():
    sim_time = 10000.0
    size = 20000.0
    threads = 1

    freqs = [1., 2.0]

    path = ('/home/mikael/results/papers/inhibition' +
            '/network/simulate_inhibition_ZZZ4/')
    l = op.get()[-3:]

    for i in range(len(l)):
        l[i] += pl(
            {
                'simu': {
                    'sim_time': sim_time,
                    'sim_stop': sim_time,
                    'threads': threads
                },
                'netw': {
                    'size': size
                }
            }, '=')

    damp = process(path, freqs)
    for key in sorted(damp.keys()):
        val = damp[key]
        print numpy.round(val, 2), key

    ll = []
    for i, _l in enumerate(l):
        for j, _ in enumerate(freqs):

            amp = [numpy.round(damp[_l.name][j], 2), 1]
            d = {
                'type': 'oscillation2',
                'params': {
                    'p_amplitude_mod': amp[0],
                    'p_amplitude0': amp[1],
                    'freq': 20.
                }
            }
            _ll = deepcopy(_l)
            dd = {}
            for key in ['C1', 'C2', 'CF', 'CS']:
                dd = misc.dict_update(dd, {'netw': {'input': {key: d}}})

            _ll += pl(dd, '=', **{'name': 'amp_{0}-{1}'.format(*amp)})

            ll.append(_ll)

    return ll, threads
Пример #35
0
def get():

    l = []
    solution = get_solution()

    rEI = 1700.0
    rEA = 200.0
    rCS = 250.0
    rES = 1800.0
    rM2 = 740.0

    d = {}
    misc.dict_update(d, solution['mul'])
    l += [pl(d, '*', **{'name': ''})]

    d = {}
    misc.dict_update(d, solution['equal'])
    d['node']['EI']['rate'] = rEI
    d['node']['EA']['rate'] = rEA
    d['node']['C2']['rate'] = rM2

    misc.dict_update(d, {'node': {'CS': {'rate': rCS}}})
    misc.dict_update(d, {'node': {'ES': {'rate': rES}}})
    s = 'rEI_{0}_rEA_{1}_rCS_{2}_rES_{3}_rM2_{4}'.format(
        rEI, rEA, rCS, rES, rM2)

    l[-1] += pl(d, '=', **{'name': s})

    rEI = 800.0
    rEA = 100.0
    rCS = 170.0
    rES = 1800.0
    rM2 = 740.0

    d = {}
    misc.dict_update(d, solution['mul'])
    l += [pl(d, '*', **{'name': ''})]

    d = {}
    misc.dict_update(d, solution['equal'])
    d['node']['EI']['rate'] = rEI
    d['node']['EA']['rate'] = rEA
    d['node']['C2']['rate'] = rM2

    misc.dict_update(d, {'node': {'CS': {'rate': rCS}}})
    misc.dict_update(d, {'node': {'ES': {'rate': rES}}})
    s = 'rEI_{0}_rEA_{1}_rCS_{2}_rES_{3}_rM2_{4}'.format(
        rEI, rEA, rCS, rES, rM2)
    l[-1] += pl(d, '=', **{'name': s})

    return l
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    # betas MS-MS
    v = [0.1, 0.25, 0.5, 0.75]
    for x, y in [[v1, v2] for v1 in v for v2 in v]:

        d = {}
        for keys in s_mul:
            update(solution, d, keys)
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)

        misc.dict_update(d,
                         {'nest': {
                             'ST': {
                                 'beta_I_AMPA_1': f_beta_rm(2.5)
                             }
                         }})
        misc.dict_update(d,
                         {'nest': {
                             'ST': {
                                 'beta_I_NMDA_1': f_beta_rm(2.5)
                             }
                         }})
        d['node']['EA']['rate'] *= 0.7

        misc.dict_update(d, {'nest': {'MS': {'beta_I_GABAA_2': f_beta_rm(x)}}})
        for conn in ['M1_M1_gaba', 'M1_M2_gaba', 'M2_M1_gaba', 'M2_M2_gaba']:
            misc.dict_update(d,
                             {'conn': {
                                 conn: {
                                     'beta_fan_in': f_beta_rm(y)
                                 }
                             }})

        l[-1] += pl(d, '=', **{'name': 'mod_MSg_' + str(x) + '_MSc_' + str(y)})

    #beta CTX-STN

    return l
def get():
    
    
    l=[]
    solution=get_solution_slow_GP_striatum_2()

    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    for y in [1.1, 1.2, 1.3]:   
    
        d={}
        misc.dict_update(d, solution['mul'])
        
        misc.dict_update(d,{'node':{'CS':{'rate': y}}}) 
        
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal']) 

        d['node']['EI']['rate']*=y*0.9
        d['node']['EA']['rate']*=y
        
        misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2)}}})
          
        l[-1]+=pl(d, '=', **{'name':'all_CSEIEA_'+str(y)})  

  

    y=1.2
    d={}
    misc.dict_update(d, solution['mul'])
    
    misc.dict_update(d,{'node':{'CS':{'rate': y}}}) 
    
    l+=[pl(d, '*', **{'name':''})]
      
    d={}
    misc.dict_update(d, solution['equal']) 

    d['node']['EI']['rate']*=y*0.9
    d['node']['EA']['rate']*=0.0
    
    misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2)}}})
      
    l[-1]+=pl(d, '=', **{'name':'all_CSEIEA_'+str(y)})  


    return l
Пример #38
0
    def setUp(self):
        from core.network.default_params import Perturbation_list as pl
        from_disk=2
        
        import oscillation_perturbations4 as op
        
        rep=2
        
        sim_time=rep*1000.0
      
        local_num_threads=20
        
        l=op.get()
        
        p=pl({'simu':{'sim_time':sim_time,
                      'sim_stop':sim_time,
                      'local_num_threads':local_num_threads}},
                  '=')
        p+=l[7]
        self.setup=Setup(**{'local_num_threads':local_num_threads,
                        'repetition':rep})
        v=simulate(builder=Builder,
                            from_disk=from_disk,
                            perturbation_list=p,
                            script_name=(__file__.split('/')[-1][0:-3]
                                         +'/data'),
                            setup=self.setup)
        
        file_name, file_name_figs, from_disks, d, models= v
        

        self.file_name_figs=file_name_figs
        self.from_disks=from_disks
        self.d=d
        self.models=models
Пример #39
0
    def test_do(self):
        
        d={'simu':{'sim_stop':20000.0,
                   'sim_time':20000.0,
                   'stop_rec':20000.0,
                   'start_rec':1000.0}}
        per=pl(d, '=')
        per+=op.get()[0]
        kw_setup={'nets_to_run':['Net_1'],
#                   'single_unit':'GA',
#                   'opt':{'Net_1':{'f':['GA'],
#                                   'x':['nest.ST_GA_ampa.weight'],
#                                   'x0':[0.45]}},
                  'single_unit':'GI',
                  'opt':{'Net_1':{'f':['GI'],
                                  'x':['node.EIp.rate'],
                                  'x0':[1000.0]}},
                  'tp_name':'beta'}
        kwargs={'builder':builder,
                'perturbation_list':per,
                'script_name':__file__.split('/')[-1][0:-3],
                'setup':Setup(**kw_setup)
                }
        obj=Main(**kwargs)
        obj.do()
Пример #40
0
def pert_add_single(**kwargs):

    do_reset = kwargs.get('do_reset', True)
    local_num_threads = kwargs.get('local_num_threads')
    perturbation_list = kwargs.get('perturbation_list')
    sim_time = kwargs.get('sim_time')
    size = kwargs.get('size')
    l = perturbation_list
    for i in range(len(l)):
        l[i] += pl(
            {
                'simu': {
                    'do_reset': do_reset,
                    'sd_params': {
                        'to_file': True,
                        'to_memory': False
                    },
                    'sim_time': sim_time,
                    'sim_stop': sim_time,
                    'stop_rec': sim_time,
                    'local_num_threads': local_num_threads
                },
                'netw': {
                    'size': size
                }
            }, '=')

    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution_slow_GP_striatum()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    x=2.5
    d={}
    for y in [12]+ list(numpy.arange(5,55,5)):
#         x=3.4
#         y=2.25
            
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys) 
        
        ratio=12./y
        
        dd={'nest':{'GA_M1_gaba':{'weight':0.8*ratio}, 
                   'GA_M2_gaba':{'weight':0.8*ratio}}}
        misc.dict_update(d,dd)            
         
        # Decreasing from 2 leads to ...
        # Increasing from 2 leads to ... 
        dd={'nest':{'GA_FS_gaba':{'weight':2.*ratio}}}
        misc.dict_update(d,dd)           
        
        # Just assumed to be 12 ms    
        dd={'nest':{'M1_low':{'GABAA_3_Tau_decay':12./ratio},  
                   'M2_low':{'GABAA_3_Tau_decay':12./ratio},
                   'FS_low':{'GABAA_2_Tau_decay':12./ratio},     
                   }}
        misc.dict_update(d,dd)  
        
        misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
        misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
        d['node']['EA']['rate']*=0.7
        
        l[-1]+=pl(d, '=', **{'name':'mod_GAtau_'+str(y)})    

    
    return l
Пример #42
0
def get():
    
    l=[]
    
    d={}
    for name in ['M1', 'CTX_M1', 'CTX_M2', 'MS_MS', 'FS_FS', 
                 'GP_FS', 'FS_M2', 'M2_GI', 'FS', 
                 'GA_MS', 'GA_FS', 'GI_FS']:

        d=misc.dict_update(d, get_change_to(name))
        
    l+=[pl(d,'*', **{'name':'no_ch_dop-striatum'})]
    

    d={}
    for name in ['CTX_ST', 'GP_ST', 'GP', 'ST_GP', 'GP_GP', 'SN', 'M1_SN']:
        d=misc.dict_update(d, get_change_to(name))
        
    l+=[pl(d,'*', **{'name':'no_ch_dop-GP_ST_SN'})]
    
    
    d={}
    for name in ['M1', 'CTX_M1', 'CTX_M2', 'MS_MS', 'FS_FS', 
                 'GP_FS', 'FS_M2', 'CTX_ST', 'GP_ST', 'GP',
                 'ST_GP', 'GP_GP', 'SN', 'M1_SN',
                     'M2_GI', 'FS', 
                 'GA_MS', 'GA_FS', 'GI_FS']:
        d=misc.dict_update(d, get_change_to(name))
        pp(d)
        
    l+=[pl(d,'*', **{'name':'no_ch_dop-all'})]

    for s in [ 'CTX_M1', 'CTX_M2', 'MS_MS', 'FS_FS', 
              'GP_FS', 'FS_M2', 'CTX_ST', 'GP_ST', 'GP',
              'ST_GP', 'GP_GP', 'SN', 'M1_SN', 'M2_GI',
              'FS','M1', 
              'GA_MS', 'GA_FS', 'GI_FS']:
        d={}
        for name in [s]:
            d=misc.dict_update(d, get_change_to(name))
            
        l+=[pl(d,'*', **{'name':'no_ch-'+s})]    
    
    d={}
    l+=[pl(d,'*', **{'name':'-Normal'})]   
        
    return l
def get():

    l = []
    solution, s_mul, s_equal = get_solution()

    d0 = 0.8
    f_beta_rm = lambda f: (1 - f) / (d0 + f * (1 - d0))

    y = 2.5

    w = numpy.arange(0.5, 1.2, 0.1)
    v = [0.1, 0.25, 0.5]
    ll = [[v1, v2] for v1 in v for v2 in w]
    pp(l)
    for x, z in ll:
        print x, z

        d = {}
        for keys in s_mul:
            update(solution, d, keys)
        l += [pl(d, '*', **{'name': ''})]

        d = {}
        for keys in s_equal:
            update(solution, d, keys)
        misc.dict_update(d, {'nest': {'ST': {'beta_I_AMPA_1': f_beta_rm(y)}}})
        misc.dict_update(d, {'nest': {'ST': {'beta_I_NMDA_1': f_beta_rm(y)}}})

        misc.dict_update(d, {'nest': {'MS': {'beta_I_GABAA_2': f_beta_rm(x)}}})
        for conn in ['M1_M1_gaba', 'M1_M2_gaba', 'M2_M1_gaba', 'M2_M2_gaba']:
            misc.dict_update(d,
                             {'conn': {
                                 conn: {
                                     'beta_fan_in': f_beta_rm(x)
                                 }
                             }})

        misc.dict_update(d, {'nest': {'GA_M1_gaba': {'weight': z}}})
        misc.dict_update(d, {'nest': {'GA_M2_gaba': {'weight': z}}})
        misc.dict_update(d, {'nest': {'GA_FS_gaba': {'weight': z}}})

        d['node']['EA']['rate'] *= 0.7
        l[-1] += pl(d, '=',
                    **{'name': ('mod_GA_str_' + str(z) + '_MS_' + str(x))})

    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution_slow_GP_striatum_2()
    
    d={}
    for keys in s_mul: update(solution, d, keys)  
    l+=[pl(d, '*', **{'name':''})]
      
    d={}
    for keys in s_equal: update(solution, d, keys) 
    
    l[-1]+=pl(d, '=', **{'name':''})    
            
    
    return l
def get():
    
    
    l=[]
    solution=get_solution_slow_GP_striatum_2()

    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))

    for z in [1.05,1.1]:
        for a,b in zip([900., 1200.0 ],
                        [a*0.25 for a in [0.75, 0.5]]):
    
            for y in numpy.arange(5.,29.,5.):       
#         z=0.8
                d={}
                misc.dict_update(d, solution['mul'])  
                misc.dict_update(d,{'node':{'CS':{'rate': z}}}) 
                misc.dict_update(d,{'nest':{'ST_GA_ampa':{'weight':b}}})  
                
                l+=[pl(d, '*', **{'name':''})]
                  
                d={}
                misc.dict_update(d, solution['equal']) 
                
                dd={'conn': {'GA_GA_gaba':{'fan_in0': y,'rule':'all-all' }, 
                             'GA_GI_gaba':{'fan_in0': 2,'rule':'all-all' },
                             'GI_GA_gaba':{'fan_in0': 30-y,'rule':'all-all' },
                             'GI_GI_gaba':{'fan_in0': 28,'rule':'all-all' }}}
                
                misc.dict_update(d, dd)
                 
                 
                d['node']['EI']['rate']*=z
                d['node']['EA']['rate']=a
        
                misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2)}}})
             
                l[-1]+=pl(d, '=', **{'name':'exc'+str(z)
                                     +'_EIEACS_'+str(a)
                                     +'_STGAw_'+str(b)
                                     +'_GAGA_'+str(y)
                                     +'_GIGA_'+str(30-y)}) 
        
    return l
def get():
     
     
    l=[]
    solution, s_mul, s_equal=get_solution()
     
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
     
    y=2.5
    
        
    w=numpy.arange(0.5, 1.2, 0.1)
    v=[0.1,0.25, 0.5]
    ll=[[v1,v2] for v1 in v for v2 in w]
    pp(l)
    for x, z in ll:
        print x,z
                  
        d={}
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
             
        d={}
        for keys in s_equal: update(solution, d, keys)  
        misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(y)}}})
        misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(y)}}})
                
                
        misc.dict_update(d,{'nest':{'MS':{'beta_I_GABAA_2': f_beta_rm(x)}}})
        for conn in ['M1_M1_gaba', 'M1_M2_gaba','M2_M1_gaba','M2_M2_gaba']:
            misc.dict_update(d,{'conn':{conn:{'beta_fan_in': f_beta_rm(x)}}}) 
                
        misc.dict_update(d,{'nest':{'GA_M1_gaba':{'weight': z}}})
        misc.dict_update(d,{'nest':{'GA_M2_gaba':{'weight': z}}})
        misc.dict_update(d,{'nest':{'GA_FS_gaba':{'weight': z}}})
        
        d['node']['EA']['rate']*=0.7
        l[-1]+=pl(d, '=', **{'name':('mod_GA_str_' + str(z)+'_MS_'+str(x))
                         })   
     
    return l
def get():
    
    
    l=[]
    solution=get_solution_slow_GP_striatum_2()

    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
 
        
    for a,b in zip([200., 300., 300., 400., 500.],
                    [a*0.25 for a in [0.75, 0.75, 0.5, 0.5, 0.5]]):

        z=1.2
        y=0.75
        d={}
        misc.dict_update(d, solution['mul'])
        
        misc.dict_update(d,{'node':{'CS':{'rate': y}}}) 
        misc.dict_update(d,{'node':{'CF':{'rate': z}}}) 
                
        misc.dict_update(d,{'nest':{'ST_GA_ampa':{'weight':b}}})        
        
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal'])   
          
         
        
        d['node']['EI']['rate']*=y
        d['node']['EA']['rate']=a

        
        misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2)}}})
          
        l[-1]+=pl(d, '=', **{'name':'all_EIEACS_'+str(a)+'_STGAw_'+str(b)})  
   


    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    
#     v=STN_ampa_gaba_input_magnitude()[0:5]
    
    for _, u, w in v:

        v0=numpy.arange(1.25, 3.75, 1.)
        v1=numpy.arange(1.5, 4, 1.)
        v=[[x,y] for x in v0 for y in v1]
        for x, y in v:
            
            d={}
            for keys in s_mul: update(solution, d, keys)  
            l+=[pl(d, '*', **{'name':''})]
              
            d={}
            for keys in s_equal: update(solution, d, keys) 
    
            misc.dict_update(d,{'nest':{'ST':{'beta_I_GABAA_1': f_beta_rm(x)}}})        
            misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(y)}}})
            misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(y)}}})
            misc.dict_update(d,{'node':{'CS':{'rate': u}}})
            misc.dict_update(d,{'nest':{'GI_ST_gaba':{'weight':w }}})             
            d['node']['EA']['rate']*=0.7
            l[-1]+=pl(d, '=', **{'name':('mod_ST_beta_'
                                         +str(u)+'_'+str(w)+'_'
                                         +str(x)+'_'+str(y))
                                 })    

               
    
    return l
def get():
    

    
    l=[]
    solution, s_mul, s_equal=get_solution()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    
    # betas MS-MS
    v=numpy.arange(1.5,3,0.25)
    for x in v:
        
        d={}
        for keys in s_mul: update(solution, d, keys)  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys) 
        
        misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
        misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})

        l[-1]+=pl(d, '=', **{'name':'mod_ST_beta_'+str(x)})    
            
    v1=numpy.arange(0.1, 1, 0.2)
    for x in v1:
        
        
        d={}
        for keys in s_mul: update(solution, d, keys) 

        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys)
        
        d['node']['EA']['rate']*=x
        l[-1]+=pl(d, '=', **{'name':'mod_EA_'+str(x)})   
    
    v2=numpy.arange(1.1, 2, 0.2)
    for x in v2:
        
        
        d={}
        for keys in s_mul: update(solution, d, keys) 

        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        for keys in s_equal: update(solution, d, keys)
        
        d['node']['EI']['rate']*=x
        l[-1]+=pl(d, '=', **{'name':'mod_EI_'+str(x)})  
    
    return l
def get():
    
    
    l=[]
    solution=get_solution_slow_GP_striatum_2()

    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))

    for y,x in zip(numpy.arange(5.,29.,5.), [1., 1.1, 1.15, 1.2, 1.25]):       
        z=0.8
        
        d={}
        misc.dict_update(d, solution['mul'])  
        misc.dict_update(d,{'node':{'CS':{'rate': z}}})
        misc.dict_update(d,{'node':{'CF':{'rate': x}}})  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal']) 
        
        dd={'conn': {'GA_GA_gaba':{'fan_in0': y,'rule':'all-all' }, 
                     'GA_GI_gaba':{'fan_in0': 2,'rule':'all-all' },
                     'GI_GA_gaba':{'fan_in0': 30-y,'rule':'all-all' },
                     'GI_GI_gaba':{'fan_in0': 28,'rule':'all-all' }}}
        
        misc.dict_update(d, dd)
         
         
        d['node']['EI']['rate']*=z
        d['node']['EA']['rate']=200.0

        misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2)}}})
   
       
        l[-1]+=pl(d, '=', **{'name':'GAGA_'+str(y)+'_GIGA_'+str(30-y)}) 
        
    return l
Пример #51
0
def get():
    
    l=[]

    
    for y in [0.8, 1.2]:
        w=0.75
        l+=[pl({'nest':{'GA_M1_gaba':{'weight':y},
                        'GA_M2_gaba':{'weight':y},
                        'M1_M1_gaba':{'weight':0.25},
                        'M1_M2_gaba':{'weight':0.25},
                        'M2_M1_gaba':{'weight':0.25},
                        'M2_M2_gaba':{'weight':0.25},
                        'ST_GA_ampa':{'weight':0.25},
                        'GA_GA_gaba':{'weight':0.25},
                        'GI_GA_gaba':{'weight':0.25},
                        'GI_ST_gaba':{'weight':w},
                        'ST_GI_ampa':{'weight':w}
                        }},
               '*',
                **{'name':'MsGa-MS-weight0.25_ST-GI-'+str(w)
                   + '-GaMs-'+str(y)})] 
        l[-1]+=pl({
                  'node':{'C1':{'rate':560.0},
                          'C2':{'rate':700.},
                          'EI':{'rate':1060.0},
                          'EA':{'rate':330.0}}},
               '=',
                **{'name':'down-C2-EiEa-mod'})  
    
    
    for y in [0.8, 1.2]:
        x=5.
        w=0.75
        l+=[pl({'nest':{'M1_M1_gaba':{'weight':0.25},
                        'M1_M2_gaba':{'weight':0.25},
                        'M2_M1_gaba':{'weight':0.25},
                        'M2_M2_gaba':{'weight':0.25},
                        'ST_GA_ampa':{'weight':0.25},
                        'GA_GA_gaba':{'weight':0.25},
                        'GI_GA_gaba':{'weight':0.25},
                        'GI_ST_gaba':{'weight':w},
                        'ST_GI_ampa':{'weight':w}
                        }},
               '*',
                **{'name':'MsGa-MS-weight0.25_ST-GI-'+str(w)
                   + '-GaMs-'+str(y)})]  
        l[-1]+=pl({
                  'node':{'C1':{'rate':560.0},
                          'C2':{'rate':700.},
                          'EI':{'rate':1060.0},
                          'EA':{'rate':330.0}}},
               '=',
                **{'name':'down-C2-EiEa-mod'}) 
        
        l[-1]+=pl({'nest':{'GA_M1_gaba':{'weight':y*x}, 
                           'GA_M2_gaba':{'weight':y*x},
                           'GA_FS_gaba':{'weight':x},
                           'M1_low':{'GABAA_3_Tau_decay':1./5},  
                           'M2_low':{'GABAA_3_Tau_decay':1./5},
                           'FS_low':{'GABAA_2_Tau_decay':1./5},
                   
                   }},
          '*',
           **{'name':'fast-'+str(x)})   

    for y in [0.4, 0.5, 0.6]:
        w=0.75
        l+=[pl({'nest':{'GA_M1_gaba':{'weight':y},
                        'GA_M2_gaba':{'weight':y},
                        'M1_M1_gaba':{'weight':0.25},
                        'M1_M2_gaba':{'weight':0.25},
                        'M2_M1_gaba':{'weight':0.25},
                        'M2_M2_gaba':{'weight':0.25},
                        'ST_GA_ampa':{'weight':0.25},
                        'GA_GA_gaba':{'weight':0.25},
                        'GI_GA_gaba':{'weight':0.25},
                        'GI_ST_gaba':{'weight':w},
                        'ST_GI_ampa':{'weight':w}
                        }},
               '*',
                **{'name':'MsGa-MS-weight0.25_ST-GI-'+str(w)
                   + '-GaMs-'+str(y)})] 
        l[-1]+=pl({
                  'node':{'C1':{'rate':560.0},
                          'C2':{'rate':700.},
                          'EI':{'rate':1060.0},
                          'EA':{'rate':330.0}}},
               '=',
                **{'name':'down-C2-EiEa-mod'})  
    
    
    for y in [0.4, 0.5, 0.6]:
        x=5.
        w=0.75
        l+=[pl({'nest':{'M1_M1_gaba':{'weight':0.25},
                        'M1_M2_gaba':{'weight':0.25},
                        'M2_M1_gaba':{'weight':0.25},
                        'M2_M2_gaba':{'weight':0.25},
                        'ST_GA_ampa':{'weight':0.25},
                        'GA_GA_gaba':{'weight':0.25},
                        'GI_GA_gaba':{'weight':0.25},
                        'GI_ST_gaba':{'weight':w},
                        'ST_GI_ampa':{'weight':w}
                        }},
               '*',
                **{'name':'MsGa-MS-weight0.25_ST-GI-'+str(w)
                   + '-GaMs-'+str(y)})]  
        l[-1]+=pl({
                  'node':{'C1':{'rate':560.0},
                          'C2':{'rate':700.},
                          'EI':{'rate':1060.0},
                          'EA':{'rate':330.0}}},
               '=',
                **{'name':'down-C2-EiEa-mod'}) 
        
        l[-1]+=pl({'nest':{'GA_M1_gaba':{'weight':y*x}, 
                           'GA_M2_gaba':{'weight':y*x},
                           'GA_FS_gaba':{'weight':x},
                           'M1_low':{'GABAA_3_Tau_decay':1./5},  
                           'M2_low':{'GABAA_3_Tau_decay':1./5},
                           'FS_low':{'GABAA_2_Tau_decay':1./5},
                   
                   }},
          '*',
           **{'name':'fast-'+str(x)})    
        
    return l
def get():
    
    
    l=[]
    solution, s_mul, s_equal=get_solution_slow_GP_striatum()
    
    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    
    for y in numpy.arange(1.0,-0.1,-0.5):
        for z in numpy.arange(1.0,-0.1,-0.5):
            x=2.5
            d={}
            for keys in s_mul: update(solution, d, keys)  
    
            misc.dict_update(d,{'nest':{'GI_GA_gaba':{'weight':y}}})
            misc.dict_update(d,{'nest':{'ST_GA_ampa':{'weight':z}}})
            l+=[pl(d, '*', **{'name':''})]
        
    
              
            d={}
            for keys in s_equal: update(solution, d, keys) 
            
            misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
            misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
            d['node']['EA']['rate']*=0.7
            
        
            l[-1]+=pl(d, '=', **{'name':'GIGA_'+str(y)+'_STGA_'+str(z)})    
    
    for y in numpy.arange(1.,6.):
        for z in numpy.arange(1.,6.):
            x=2.5
            d={}
            for keys in s_mul: update(solution, d, keys)  
            
            l+=[pl(d, '*', **{'name':''})]
        
    
              
            d={}
            for keys in s_equal: update(solution, d, keys) 
            misc.dict_update(d,{'nest':{'ST_GA_ampa':{'delay':y}}})
            misc.dict_update(d,{'nest':{'ST_GI_ampa':{'delay':y}}})
            misc.dict_update(d,{'nest':{'GI_ST_gaba':{'delay':z}}})
            
            misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
            misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
            d['node']['EA']['rate']*=0.7
            
        
            l[-1]+=pl(d, '=', **{'name':'STGPdelay_'+str(y)+'_GPSTdelay_'+str(z)})         
    
    for y in numpy.arange(2.5, 21., 2.5):
            x=2.5
            d={}
            for keys in s_mul: update(solution, d, keys)  

            
            l+=[pl(d, '*', **{'name':''})]
        
    
              
            d={}
            for keys in s_equal: update(solution, d, keys) 
            misc.dict_update(d,{'nest':{'CS_ST_ampa':{'delay':y}}})
            misc.dict_update(d,{'nest':{'CS_ST_nmda':{'delay':y}}})            
            misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
            misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
            d['node']['EA']['rate']*=0.7
            
        
            l[-1]+=pl(d, '=', **{'name':'CSSTdelay_'+str(y)})  

    for y in numpy.arange(2.5, 21., 2.5):
            x=2.5
            d={}
            for keys in s_mul: update(solution, d, keys)  

            
            l+=[pl(d, '*', **{'name':''})]
        
    
              
            d={}
            for keys in s_equal: update(solution, d, keys) 
            misc.dict_update(d,{'nest':{'C1_M1_ampa':{'delay':y}}})
            misc.dict_update(d,{'nest':{'C1_M1_nmda':{'delay':y}}})            
            misc.dict_update(d,{'nest':{'C2_M2_ampa':{'delay':y}}})
            misc.dict_update(d,{'nest':{'C2_M2_nmda':{'delay':y}}})            
            misc.dict_update(d,{'nest':{'CF_FS_ampa':{'delay':y}}})
            misc.dict_update(d,{'nest':{'ST':{'beta_I_AMPA_1': f_beta_rm(x)}}})
            misc.dict_update(d,{'nest':{'ST':{'beta_I_NMDA_1': f_beta_rm(x)}}})
            d['node']['EA']['rate']*=0.7
            
        
            l[-1]+=pl(d, '=', **{'name':'CSTRdelay_'+str(y)})  
         


    for y in numpy.arange(1, 8., 1.):
            x=2.5
            d={}
            for keys in s_mul: update(solution, d, keys)  

            
            l+=[pl(d, '*', **{'name':''})]
        
    
              
            d={}
            for keys in s_equal: update(solution, d, keys) 
            misc.dict_update(d,{'nest':{'GA_M1_gaba':{'delay':y}}})
            misc.dict_update(d,{'nest':{'GA_M2_gaba':{'delay':y}}})            
            misc.dict_update(d,{'nest':{'GA_FS_gaba':{'delay':y}}})
            d['node']['EA']['rate']*=0.7
            
        
            l[-1]+=pl(d, '=', **{'name':'GASTRdelay_'+str(y)})  

            
         
    return l
2 (51)     GA_M2_pert_0.0    OOM
5 (137)    GA_FS_pert_5      time
7 (161)    ST_GA_pert_0.0    OOM
8 (171)    ST_GA_pert_5      time
10 (187)   GI_GA_pert_0.0    ?
11 (201)   M2_GI_pert_0.0    OOM
12 (211)   M2_GI_pert_5      OOM
15 (16)    M1_pert_mod7      OOM
18 (40)    M2_pert_mod7      Mem python
19 (49)    GI_pert_mod0      OOM
20 (56)    GI_pert_mod7      ?
21 (57)    ST_pert_mod0      OOM
22 (64)    ST_pert_mod7      ?
'''

op_pert_add=[pl(**{'name':'Control'})]

opc=op_conn.get([0,6])
op_pert_add+=[opc[i] for i in l_op_conn]


opn=op_nuc.get([0,7])
op_pert_add+=[opn[i] for i in l_op_nuc]

opn=op_dop.get()
op_pert_add+=[opn[i] for i in l_op_dop]

opc=op_conn.get([0,6])
op_pert_add+=[opc[i] for i in l_op_conn2]

Пример #54
0
def main(*args, **kwargs):
    
    setup=kwargs.get('setup')#, Setup())
    script_name=kwargs.get('script_name')#,__file__.split('/')[-1][0:-3])
    builder=kwargs.get('builder')
    
    info, nets, _ = get_networks(builder, 
                                 setup.builder(), 
                                 setup.director(),
                                 setup.engine(),
                                 setup.default_params()) 
    perturbation_list=kwargs.get('perturbation_list')
    
    perturbation_list+=pl(target_perturbations()[setup.tp_name], '=', **{'name':setup.tp_name})
    perturbation_list+=pl(setup.par(), '=', **{'name':setup.tp_name})
    add_perturbations(perturbation_list, nets)

    key=nets.keys()[0]
    file_name = get_file_name(script_name, nets[key].par)
    path_nest=get_path_nest(script_name, nets.keys(), nets[key].par)
    
    for val in nets.values():
        for key in sorted(val.par['nest'].keys()):
            val2=val.par['nest'][key]
            if 'weight' in val2.keys():
                print key, val2['weight']
        for key in sorted(val.par['node'].keys()):
            val2=val.par['node'][key]
            if 'spike_setup' in val2.keys():
                print key, val2['spike_setup']
            if 'rate' in val2.keys():
                print key, val2['rate']
                
    print setup.tp_name, nets.keys()
    pp(nets['Net_1'].par['nest']['GA_GA_gaba']['weight'])
    for net in nets.values():
        net.set_path_nest(path_nest) 
        pp(nets['Net_1'].par['nest']['GA_GA_gaba']['weight'])
        net.set_opt(setup.opt[net.name])
    pp(nets['Net_1'].par['nest']['GA_GA_gaba']['weight'])
    
    # vt=net.voltage_trace()
    # import pylab
    # ax=pylab.subplot(111)
    # vt.plot_voltage_trace(ax)
    # pylab.show()

    sd_list=get_storage_list(nets.keys(), file_name, info)
    
    for net, sd in zip(nets.values(), sd_list):    
        nl=Network_list([net])
#         pp(net.par.dic['node']['STp'])
        kwargs={'model':nl,
                'call_get_x0':'get_x0',
                'call_get_error':'sim_optimization', 
                'verbose':True,}
        
        kwargs_fmin={'maxiter':100, 
                     'maxfun':100,
                     'full_output':1,
                     'retall':1,
                     'xtol':.0001,
                     'ftol':.0001,
                     'disp':0}
        kwargs_fmin={}
        kwargs['kwargs_fmin']=kwargs_fmin
        f=Fmin('GA_opt', **kwargs)
        h=f.fmin() 
        dd={setup.tp_name.split('_')[0]:{net.name:{'opt':h}}}
        
        save(sd, dd)
def get(index=[]):
    
    def get_perturbation_dics(val, hz_mod, i):
        d = {}
#         for key in c.keys():
        for neuron, hz_pA in val:
            hz=hz_mod[neuron][i]
            u = {key:{'node':{neuron:{'I_vivo':1./hz_pA*hz}}}}
            d = misc.dict_update(d, u)
        return d
                
    c={
       'M1':[['M1',0.16]], #5/32 Hz/pA 
       'M2':[['M2',0.13]], #5/40 Hz/pA
       'FS':[['FS',0.17]], #10/60 Hz/pA
       'GP':[['GA',0.47],
             ['GI',0.47]], #0.47 Hz/pA
       'GA':[['GA',0.47]], #0.47 Hz/pA
       'GI':[['GI',0.47],
             ['GF',0.47]], #0.47 Hz/pA
       'ST':[['ST',0.54]], #0.54 Hz/pA
       'SN':[['SN',0.16]]} #0.16 Hz/pA
    
       
    #in hz
    f=2
    mod={'M1':[a*2 for a in [-8, -6,-4,-2, #  
                             2, 4, 6, 8]],
         'M2':[a*2 for a in [-8, -6,-4,-2, #  
                             2, 4, 6, 8]],
         'FS':[a*1.1 for a in [-20, -15,-10,-5, #  
                               5, 10, 15, 20 ]],
         'GA':[1.5*a for a in [-20, -15,-10,-5, #  
                               f*5, f*10, f*15, f*20 ]],
         'GI':[a*4 for a in [-60, -45,-30,-15, #  
                              f*15, f*30, f*45, f*60]],
         'GF':[a*4 for a in [-60, -45,-30,-15, #  
                              f*15, f*30, f*45, f*60]],
         'ST':[a*2 for a in [-30, -22.5,-15,-7.5, #  
                               f*7.5, f*15, f*22.5, f*30 ]],
         'SN':[a*4 for a in  [-40, -30,-20,-10, #  
                              10, 20, 30, 40]]}
         
    
    if index:
        for key, val in mod.items():
            mod[key]=[v for i,v in enumerate(val) if i in index]
    
    l=[]
    n=len(mod['M1'])
    l+=[pl(**{'name':'no_pert'})]
    
    for key, val in c.items():
        for i in range(n):
            
            d=get_perturbation_dics(val, mod, i)
            l.append(pl(d.values()[0],'+', **{'name':(key
                                          +'_pert_mod'
                                          +str(int(i)))}))
# neuron, hz_pA=val
#         for neuron, mods in mod.items():
#             for hz in mods:
#                 d=get_perturbation_dics({key:val}, mod, i)
#                 d={key:{'node':{neuron:{'I_vivo':1./hz_pA*hz}}}}
#                 
#                 l.append(pl(d.values()[0],'+', **{'name':(d.keys()[0]
#                                                           +'_pert_mod'
#                                                           +str(int(hz*hz_pA)))}))
#         
    return l 
def get():
    
    
    l=[]
    solution=get_solution_slow_GP_striatum_2()

    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    for y in [1.2, 1.3]:   
    
        d={}
        misc.dict_update(d, solution['mul'])
        
        misc.dict_update(d,{'node':{'CS':{'rate': y}}}) 
        
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal']) 
        
        dd={'conn': {'GA_GA_gaba':{'fan_in0': 20,'rule':'all-all' }, 
                     'GA_GI_gaba':{'fan_in0': 2,' rule':'all-all' },
                     'GI_GA_gaba':{'fan_in0': 10,'rule':'all-all' },
                     'GI_GI_gaba':{'fan_in0': 28,'rule':'all-all' }}}
        
        misc.dict_update(d, dd)

        misc.dict_update(d,{'conn':{'GI_FS_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_FS_gaba':{'fan_in0': 2}}})
        misc.dict_update(d,{'conn':{'GI_M1_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_M1_gaba':{'fan_in0': 2}}})
        misc.dict_update(d,{'conn':{'GI_M2_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_M2_gaba':{'fan_in0': 2}}})        


#         d['node']['EA']['rate']*=0.9
         
#         misc.dict_update(d,{'conn':{'M2_GA_gaba':{'lesion': False}}})
#         misc.dict_update(d,{'conn':{'M2_GA_gaba':{'fan_in0': 25}}})

        d['node']['EI']['rate']*=y*0.9
        d['node']['EA']['rate']*=y
#         d['node']['CS']['rate']*=y
        
#            
        
        misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2)}}})
          
        l[-1]+=pl(d, '=', **{'name':'all_EIEA_'+str(y)})  

    for a,b in zip([1.1, 1.2, 1.7, 2.3, 2.5],
                    [a*0.25 for a in [0.75, 0.5, 0.25, 0.1, 0.01]]):
        y=1.2   
    
        d={}
        misc.dict_update(d, solution['mul'])    
        misc.dict_update(d,{'node':{'CS':{'rate': y}}}) 

        misc.dict_update(d,{'nest':{'ST_GA_ampa':{'weight':b}}})        
        
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal'])   
        
        dd={'conn': {'GA_GA_gaba':{'fan_in0': 20,'rule':'all-all' }, 
                     'GA_GI_gaba':{'fan_in0': 2,' rule':'all-all' },
                     'GI_GA_gaba':{'fan_in0': 10,'rule':'all-all' },
                     'GI_GI_gaba':{'fan_in0': 28,'rule':'all-all' }}}
        
        misc.dict_update(d, dd)

        
        misc.dict_update(d,{'conn':{'GI_FS_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_FS_gaba':{'fan_in0': 2}}})
        misc.dict_update(d,{'conn':{'GI_M1_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_M1_gaba':{'fan_in0': 2}}})
        misc.dict_update(d,{'conn':{'GI_M2_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_M2_gaba':{'fan_in0': 2}}})        


#         d['node']['EA']['rate']*=0.9
         
#         misc.dict_update(d,{'conn':{'M2_GA_gaba':{'lesion': False}}})
#         misc.dict_update(d,{'conn':{'M2_GA_gaba':{'fan_in0': 25}}})

        d['node']['EI']['rate']*=y*0.9
        d['node']['EA']['rate']*=y*a
#         d['node']['CS']['rate']*=y
        
        misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2)}}})
          
        l[-1]+=pl(d, '=', **{'name':'all_EIEACS_'+str(a)+'_STGAw_'+str(b)})  

    return l
def get():
    
    
    l=[]
    solution=get_solution_slow_GP_striatum_2()
    
    for y in numpy.arange(2.,29.,4.):       
        d={}
        misc.dict_update(d, solution['mul'])  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal']) 
        
        dd={'conn': {'GA_GA_gaba':{'fan_in0': y,'rule':'all-all' }, 
                     'GA_GI_gaba':{'fan_in0': 2,'rule':'all-all' },
                     'GI_GA_gaba':{'fan_in0': 30-y,'rule':'all-all' },
                     'GI_GI_gaba':{'fan_in0': 28,'rule':'all-all' }}}
        
        misc.dict_update(d, dd)
          
        l[-1]+=pl(d, '=', **{'name':'GAGA_'+str(y)+'_GIGA_'+str(30-y)})  


    d0=0.8
    f_beta_rm=lambda f: (1-f)/(d0+f*(1-d0))
    
    for y in [1.8, 2.0]:       
        d={}
        misc.dict_update(d, solution['mul'])  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal']) 
        d['node']['EI']['rate']*=y
        d['node']['EA']['rate']*=y*0.7
        
        
        misc.dict_update(d,{'nest':{'GI':{'beta_I_GABAA_1': f_beta_rm(2)}}})
    
        
        l[-1]+=pl(d, '=', **{'name':'mod_EIEA_'+str(y)})  
    
    
    for y, EA_rate in zip(numpy.arange(25,80,25)
                          numpy.arange(0.9,1.1,0.1)):
        d={}
        
        misc.dict_update(d, solution['mul'])  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal']) 

        d['node']['EA']['rate']*=EA_rate
        
        misc.dict_update(d,{'conn':{'M2_GA_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'M2_GA_gaba':{'fan_in0': y}}})
        
        
        l[-1]+=pl(d, '=', **{'name':'M2GA_'+str(y)+'_EArate_'+str(EA_rate)})    
        d['node']['EA']['rate']*=EA_rate
        
        misc.dict_update(d,{'conn':{'M2_GA_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'M2_GA_gaba':{'fan_in0': y}}})
        
        
        l[-1]+=pl(d, '=', **{'name':'M2GA_'+str(y)+'_EArate_'+str(EA_rate)})    
            

    for y in numpy.arange(2, 5, 2):
    
        d={}
        
        misc.dict_update(d, solution['mul'])  
        l+=[pl(d, '*', **{'name':''})]
          
        d={}
        misc.dict_update(d, solution['equal']) 
            
        misc.dict_update(d,{'conn':{'GI_FS_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_FS_gaba':{'fan_in0': y}}})
        misc.dict_update(d,{'conn':{'GI_M1_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_M1_gaba':{'fan_in0': y}}})
        misc.dict_update(d,{'conn':{'GI_M2_gaba':{'lesion': False}}})
        misc.dict_update(d,{'conn':{'GI_M2_gaba':{'fan_in0': y}}})        
               
        
        l[-1]+=pl(d, '=', **{'name':'mod_GI_M2_'+str(y)})