1
+ import re
1
2
from os import getcwd , chdir , makedirs , listdir , remove
2
3
from os .path import join , exists
3
4
from numpy import random as rd , empty , format_float_scientific as f_f , zeros , nonzero , divide , sqrt , seterr
@@ -1246,6 +1247,7 @@ def morris_stats(file_list, inputdir, sample_set, delta, num_EN_val, num_params)
1246
1247
mean = {}
1247
1248
std = {}
1248
1249
energy = zeros (num_EN_val )
1250
+ flag = False
1249
1251
1250
1252
# Interating through each created directory in Input Files
1251
1253
for keys , num in zip (file_list , sample_set ):
@@ -1275,6 +1277,16 @@ def morris_stats(file_list, inputdir, sample_set, delta, num_EN_val, num_params)
1275
1277
file_1 = open (filename_1 , 'r' , encoding = 'utf8' ).read ().splitlines ()
1276
1278
file_2 = open (filename_2 , 'r' , encoding = 'utf8' ).read ().splitlines ()
1277
1279
1280
+ for line in file_1 :
1281
+ if re .search ("Error code" , line ):
1282
+ logging .debug ('Error code in ' + filename_1 + ", unable to calculate stats." )
1283
+ flag = True
1284
+ for line in file_2 :
1285
+ if re .search ("Error code" , line ):
1286
+ logging .debug ('Error code in ' + filename_2 + ", unable to calculate stats." )
1287
+ flag = True
1288
+ if flag :
1289
+ continue
1278
1290
# Searching the first file for the location of mobility data
1279
1291
# This is only done once as each file is of the exact same format
1280
1292
if mob_start == 0 :
@@ -1295,14 +1307,15 @@ def morris_stats(file_list, inputdir, sample_set, delta, num_EN_val, num_params)
1295
1307
continue
1296
1308
1297
1309
for stat , stat_name in zip ([mob_start , diff_start , ion_start , excite_rate , ion_rate ], ['mob' , 'dif' , 'ion' , 'excite_rate' , 'ion_rate' ]):
1298
-
1310
+ print ("File1=" , filename_1 )
1311
+ print ("File2=" , filename_2 )
1299
1312
if isinstance (stat , list ):
1300
1313
stat_list = stat
1301
1314
stat_list_name = stat_name
1302
1315
for i in range (len (stat_list )):
1303
1316
stat_name = stat_list_name + "_{}" .format (i )
1304
1317
stat = stat_list [i ]
1305
-
1318
+ print ( "Line=" , stat )
1306
1319
# Iterating through each line of mobility data
1307
1320
for k in range (num_EN_val ):
1308
1321
@@ -1372,7 +1385,7 @@ def morris_stats(file_list, inputdir, sample_set, delta, num_EN_val, num_params)
1372
1385
else :
1373
1386
# Iterating through each line of mobility data
1374
1387
for k in range (num_EN_val ):
1375
-
1388
+ print ( "Line=" , stat )
1376
1389
# extracting energy and mobility values
1377
1390
E , stat_1 = file_1 [stat + k + 1 ].split ('\t ' )
1378
1391
E , stat_2 = file_2 [stat + k + 1 ].split ('\t ' )
0 commit comments