'do_runs': range(18),  #A run for each perturbation
    'do_obj': False,
    'file_name': FILE_NAME,
    'freqs': [1.5],
    'freq_oscillation': 20.,
    'from_disk_0': FROM_DISK_0,
    'i0': FROM_DISK_0,
    'job_name': 'beta_dop_pert',
    'l_hours': ['00', '00', '00'],
    'l_minutes': ['15', '10', '5'],
    'l_seconds': ['00', '00', '00'],
    'local_threads_milner': 20,
    'local_threads_superm': 5,
    'module': module,
    'nets': ['Net_0', 'Net_1'],  #The nets for each run
    'op_pert_add': op_dop.get(),
    'path_code': default_params.HOME_CODE,
    'path_rate_runs': get_path_rate_runs('simulate_inhibition_ZZZ4/'),
    'path_results': get_path_logs(LOAD_MILNER_ON_SUPERMICRO, FILE_NAME),
    'perturbation_list': [op.get()[7]],
    'sim_time': 10000.0,
    'size': 20000.0,
}

d_process_and_thread = par_process_and_thread(**kwargs)
pp(d_process_and_thread)
kwargs.update(d_process_and_thread)

p_list = pert_add_oscillations(**kwargs)
p_list = pert_set_data_path_to_milner_on_supermicro(p_list,
                                                    LOAD_MILNER_ON_SUPERMICRO)
oscillation_returbations_index = 5
# op_pert_add=[op_dop.get()[5]]
# l_op_conn=[36, 66, 97, 114, 121, 127, 138]
# l_op_nuc=[33, 49, 57]
# l_op_dop=[5,6]
l_op_conn = []  #12, 97, 108, 109, 127, 132 ]
l_op_nuc = []  #16, 33, 49, 57, 64]
l_op_dop = [-1]  #,6,6]

opc = op_conn.get()
op_pert_add = [opc[i] for i in l_op_conn]

opn = op_nuc.get()
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]

for i, o in enumerate(op_pert_add):
    print i, o

FILE_NAME = __file__.split('/')[-1][0:-3]
FROM_DISK_0 = int(sys.argv[1]) if len(sys.argv) > 1 else 0
LOAD_MILNER_ON_SUPERMICRO = False
NUM_NETS = len(l_op_conn) + len(l_op_nuc) + len(l_op_dop)

amp_base = 1.1
freqs = 0.6
STN_amp_mod = 3.
kwargs = {
    'amp_base': amp_base,
# op_pert_add=[op_dop.get()[5]]
# l_op_conn=[36, 66, 97, 114, 121, 127, 138]    
# l_op_nuc=[33, 49, 57]
# l_op_dop=[5,6]
l_op_conn=[12, 97, 108, 109, 127, 132 ]    
l_op_nuc=[16, 33, 49, 57, 64]
l_op_dop=[5,6]

opc=op_conn.get()
op_pert_add=[opc[i] for i in l_op_conn]

opn=op_nuc.get()
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]


for i, o in enumerate(op_pert_add):
    print i, o

FILE_NAME=__file__.split('/')[-1][0:-3]
FROM_DISK_0=int(sys.argv[1]) if len(sys.argv)>1 else 0
LOAD_MILNER_ON_SUPERMICRO=False
NUM_NETS=len(l_op_conn)+len(l_op_nuc)+len(l_op_dop)
kwargs={
         'ax_4x1':True,
        'add_midpoint':False,
        
        'Builder':Builder,
                                              get_args_list_Go_NoGo_compete,
                                              get_kwargs_list_indv_nets)
from core.network import default_params
from core.network.manager import Builder_Go_NoGo_with_nodop_FS as Builder
from core.parallel_excecution import get_loop_index, loop

import scripts_inhibition.base_Go_NoGo_compete as module

# from scripts inhibition import scripts_inhibition.base_Go_NoGo_compete as module
import oscillation_perturbations4 as op
import oscillation_perturbations_dop as op_dop
import pprint

pp = pprint.pprint

for p in [op_dop.get()[5]]:
    print p

FILE_NAME = __file__.split('/')[-1][0:-3]
FROM_DISK_0 = 0
LOAD_MILNER_ON_SUPERMICRO = False

kwargs = {
    'Builder': Builder,
    'cores_milner': 40 * 8,
    'cores_superm': 12,
    'debug': False,
    'do_runs': [0],
    'do_obj': False,
    'duration': [900., 100.0],
    'file_name': FILE_NAME,
def perturbations():
    sim_time = 40000.0
    size = 20000.0
    threads = 16

    freqs = [0.75]

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

    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': 1.
                }
            }
            _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)

    out = []
    l_dop = op_dop.get()
    for _l in l_dop:
        _l_copy = deepcopy(_l)

        for _ll in ll:
            _ll_copy = deepcopy(_ll)
            _ll_copy += _l_copy
            out.append(_ll_copy)

    return out, threads