12
12
"popSize" : 96 ,
13
13
"duration" : 24 ,
14
14
"nervousSystemFileName" : 'main_sim' ,
15
+ "doNML" : 0
15
16
}
16
17
17
18
DEFAULTS = {
21
22
"outputFolderName" : None ,
22
23
"doEvol" : False ,
23
24
"overwrite" : False ,
24
- "doNML" : False ,
25
+ "doNML" : None ,
25
26
"crandSeed" : None ,
26
27
"inputFolderName" : None ,
27
28
"nervousSystemFileName" : 'main_sim' ,
@@ -233,7 +234,7 @@ def run(a=None, **kwargs):
233
234
sys .exit (1 )
234
235
235
236
if a .outputFolderName is None :
236
- print ("You need to supply an output folder name! " )
237
+ print ("No output folder name. You need to supply an output folder name, and an optional input folder name. " )
237
238
sys .exit (1 )
238
239
239
240
if not do_evol and not os .path .isdir (a .outputFolderName ):
@@ -247,10 +248,10 @@ def run(a=None, **kwargs):
247
248
248
249
if not make_directory (a .outputFolderName , a .overwrite , str1 ):
249
250
print (f"Please change output directory name, or set overwrite to True\n "
250
- "and doEvol to True to overwrite the evolution results,\n "
251
+ "and doEvol to True to overwrite the evolution and simulation results,\n "
251
252
"or set overwrite to True and doEvol to False (the default) if you want\n "
252
- "to just overwrite the simulation results. Alternatively supply this directory"
253
- "as the `inputFolderName' parameter (which will not be"
253
+ "to just overwrite the simulation results. Alternatively supply this directory\n "
254
+ "as the `inputFolderName' parameter (which will not be\n "
254
255
"modified), and provide a different novel name for the output directory."
255
256
)
256
257
sys .exit (1 )
@@ -279,7 +280,7 @@ def run(a=None, **kwargs):
279
280
evol_data = {}
280
281
evol_pars = ['Duration' , 'pop_size' , 'randomseed' ]
281
282
evol_args = [a .duration , a .popSize , a .RandSeed ]
282
- evol_defaults = [24 , 96 , random_seed ]
283
+ evol_defaults = [defaults_base [ 'duration' ], defaults_base [ 'popSize' ] , random_seed ]
283
284
284
285
evol_par_file = a .outputFolderName + '/worm_data.json'
285
286
if os .path .isfile (evol_par_file ):
@@ -291,13 +292,7 @@ def run(a=None, **kwargs):
291
292
else :
292
293
print ('Parameter not found in worm_data.json' )
293
294
294
-
295
- if a .doNML :
296
- do_nml = 1
297
- else :
298
- do_nml = 0
299
-
300
-
295
+
301
296
same_vals = True
302
297
if do_evol :
303
298
for (par , arg , default ) in zip (evol_pars ,evol_args ,evol_defaults ):
@@ -306,17 +301,24 @@ def run(a=None, **kwargs):
306
301
print ('Evolution not needed as evolution parameters are the same as the existing ones.' )
307
302
do_evol = False
308
303
304
+ if a .doNML is not None :
305
+ if a .doNML :
306
+ do_nml = 1
307
+ else :
308
+ do_nml = 0
309
309
310
310
same_vals = True
311
311
sim_pars = ['doNML' , 'seed' , 'Duration' ]
312
312
sim_args = [do_nml , a .RandSeed , a .duration ]
313
- sim_defaults = [0 , random_seed , 24 ]
313
+ sim_defaults = [defaults_base [ 'doNML' ] , random_seed , defaults_base [ 'duration' ] ]
314
314
for (par , arg , default ) in zip (sim_pars ,sim_args ,sim_defaults ):
315
315
if not setDict (sim_data , par , arg , default ): same_vals = False
316
316
317
317
318
318
if not do_evol and same_vals :
319
- print ('Simulation not needed as simulation parameters are the same as the existing ones.' )
319
+ print ('Simulation not needed as simulation parameters are the same as the existing ones.\n '
320
+ 'Please supply new command line arguments.'
321
+ )
320
322
sys .exit (1 )
321
323
322
324
with open (sim_par_file , 'w' , encoding = 'utf-8' ) as f :
@@ -336,7 +338,7 @@ def run(a=None, **kwargs):
336
338
cmd += ["-sd" , str (sim_data ['Duration' ])]
337
339
cmd += ["--doevol" , str (do_evol )]
338
340
339
- cmd += ["--donml" , str (do_nml )]
341
+ cmd += ["--donml" , str (sim_data [ 'doNML' ] )]
340
342
cmd += ["--folder" , str (a .outputFolderName )]
341
343
342
344
0 commit comments