import sys
import os
import pickle

#drawfig_venn: unique([strs_all[i] for i in range(0,len(inperouts_vec)) if inperouts_vec[i][0] >= 1 and inperouts_vec[i][1] >= 1 and inperouts_vec[i][2] >= 1 and inperouts_vec[i][3] >= 1 and NoutputInsides_vec[i][0] >= 32 and NoutputInsides_vec[i][1] >= 32 and NoutputInsides_vec[i][2] >= 32 and NoutputInsides_vec[i][3] >= 32 ])[::-1] gives this:
goodOnes = ['python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 35.0 35.0 1000 0.0 0.95 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 35.0 35.0 1000 0.0 0.9 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 30.0 30.0 1000 0.0 0.95 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 30.0 30.0 1000 0.0 0.9 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 25.0 25.0 1000 0.0 0.95 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 25.0 25.0 1000 0.0 0.9 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 20.0 20.0 1000 0.0 0.9 10.0 10.0 10.0 250.0 ',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 15.0 15.0 1000 0.0 0.95 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 150 130 17.5 30.0 80.0 5.827500000000001 9.99 26.64 15.0 15.0 1000 0.0 0.9 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 140 120 17.5 30.0 80.0 5.827500000000001 9.99 26.64 35.0 35.0 1000 0.0 0.9 10.0 10.0 10.0 250.0 ',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 140 120 17.5 30.0 80.0 5.827500000000001 9.99 26.64 30.0 30.0 1000 0.0 0.9 10.0 10.0 10.0 250.0 ',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 140 120 17.5 30.0 80.0 5.827500000000001 9.99 26.64 10.0 10.0 1000 0.0 0.9 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 125 105 17.5 40.0 140.0 5.827500000000001 13.32 46.620000000000005 25.0 25.0 1000 0.0 0.9 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 125 105 17.5 40.0 140.0 5.827500000000001 13.32 46.620000000000005 10.0 10.0 1000 0.0 0.9 10.0 10.0 10.0 250.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 125 105 17.5 40.0 100.0 5.827500000000001 13.32 33.300000000000004 25.0 25.0 1000 0.0 0.9 10.0 10.0 10.0 200.0',
            'python3 sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3 125 105 17.5 40.0 100.0 5.827500000000001 13.32 33.300000000000004 10.0 10.0 1000 0.0 0.9 10.0 10.0 10.0 200.0'] 

myseed = 1
Nperpop = 40
paramSD = 0.3
if len(sys.argv) > 1:
  myseed = int(sys.argv[1])
if len(sys.argv) > 2:
  Nperpop = int(sys.argv[2])
if len(sys.argv) > 3:
  paramSD = float(sys.argv[3])
  
myseedAdd = '' if myseed == 1 else '_seed'+str(myseed)

goodOnes_new = []
for igoodOne in range(0,len(goodOnes)):
  splitted = goodOnes[igoodOne].replace('sim_mmns_2pm_sep_noISDIDD_savespikesonly_limtau.py 40 0.3','sim_mmns_2pm_sep_noISDIDD_withnoisyfittedcortical_savespikesonly_limtau.py '+str(Nperpop)+' '+str(paramSD)).split(' ')
  NMDA_AMPAratio = float(splitted[9])/float(splitted[6])
  splitted.insert(9,'3000.0')
  splitted.insert(13,str(3000.0*NMDA_AMPAratio))
  splitted.insert(23,'580.0')
  splitted.insert(24,'1750.0')
  goodOnes_new.append(' '.join(splitted))
goodOnes = goodOnes_new[:]

areas = ['CTRL']
for iarea in [0]:
  area = areas[iarea]
  
  for imodel in range(0,len(goodOnes)):
    attrs = goodOnes[imodel].split(' ')

    mychange = [[[9,13],0.81]] #19% change in the EO -> CO synaptic strength

    these_attrs = attrs[:]
    for ichange in range(0,len(mychange)):
      if type(mychange[ichange][0]) is list:
        for imany in range(0,len(mychange[ichange][0])):
          these_attrs[mychange[ichange][0][imany]] = str(float(these_attrs[mychange[ichange][0][imany]])*mychange[ichange][1])
      else:
        these_attrs[mychange[ichange][0]] = str(float(these_attrs[mychange[ichange][0]])*mychange[ichange][1])
    this_str = ' '.join(these_attrs)
    print(this_str+' '+str(myseed))
    os.system(this_str+' '+str(myseed))

    print('mv MMNs_2pm_sep_noISDIDD_limtau_Nperpop'+these_attrs[2]+'_paramSD'+these_attrs[3]+'_stimA'+these_attrs[4]+'_'+these_attrs[5]+'_gAMPA'+these_attrs[6]+'_'+these_attrs[7]+'_'+these_attrs[8]+'_'+these_attrs[9]+'_gNMDA'+these_attrs[10]+'_'+these_attrs[11]+'_'+these_attrs[12]+'_'+these_attrs[13]+'_gGABA'+these_attrs[14]+'_'+these_attrs[15]+'_dep'+these_attrs[16]+'_'+these_attrs[17]+'_'+these_attrs[18]+'_tau'+these_attrs[19]+'_'+these_attrs[20]+'_'+these_attrs[21]+'_'+these_attrs[22]+'_'+these_attrs[23]+'_noise'+these_attrs[24]+myseedAdd+'.mat MMNs_2pm_sep_noISDIDD_limtau_withnoisyfittedcortical_19percentMorePruned_Nperpop'+str(Nperpop)+'_SD'+str(paramSD)+'_model'+str(imodel)+'_'+area+'pop_seed'+str(myseed)+'.mat')
    os.system('mv MMNs_2pm_sep_noISDIDD_limtau_Nperpop'+these_attrs[2]+'_paramSD'+these_attrs[3]+'_stimA'+these_attrs[4]+'_'+these_attrs[5]+'_gAMPA'+these_attrs[6]+'_'+these_attrs[7]+'_'+these_attrs[8]+'_'+these_attrs[9]+'_gNMDA'+these_attrs[10]+'_'+these_attrs[11]+'_'+these_attrs[12]+'_'+these_attrs[13]+'_gGABA'+these_attrs[14]+'_'+these_attrs[15]+'_dep'+these_attrs[16]+'_'+these_attrs[17]+'_'+these_attrs[18]+'_tau'+these_attrs[19]+'_'+these_attrs[20]+'_'+these_attrs[21]+'_'+these_attrs[22]+'_'+these_attrs[23]+'_noise'+these_attrs[24]+myseedAdd+'.mat MMNs_2pm_sep_noISDIDD_limtau_withnoisyfittedcortical_19percentMorePruned_Nperpop'+str(Nperpop)+'_SD'+str(paramSD)+'_model'+str(imodel)+'_'+area+'pop_seed'+str(myseed)+'.mat')