Revision e066fa74 fiddle/simulation_analysis/utility.py
fiddle/simulation_analysis/utility.py  

33  33 
return result 
34  34  
35  35  
36 
def format_output_data_out1(bc_result, hbc_result):


36 
def format_output_data(bc_result, hbc_result): 

37  37 
output_data = list() 
38  38  
39  39 
for key in bc_result.keys(): 
40 
tmp_list = [key]


40 
tmp_list = [] 

41  41  
42  42 
tmp_index = key.find('_') 
43 
typo_code = key[:tmp_index] 

44 
tmp_list.append(typo_code) 

43 
typo_code = key 

44 
if tmp_index != 1: 

45 
typo_code = key[:tmp_index] 

46  
47 
graph_type = typo_code[:2] 

48 
num_of_nodes = typo_code[2:] 

45  49  
46  50 
bc_values = bc_result[key] 
47  51 
hbc_values = hbc_result[key] 
48  52  
53 
tmp_list.append(key) 

54 
tmp_list.append(typo_code) 

55 
# print typo_code 

56 
tmp_list.append(graph_type) 

57 
tmp_list.append(num_of_nodes) 

58  
49  59 
tmp_list.append(bc_values[2]) 
50  60 
tmp_list.append(hbc_values[2]) 
51  61  
...  ...  
59  69 
def read_out2(input_filepath): 
60  70 
result = np.loadtxt(input_filepath, 
61  71 
dtype={ 
62 
'names': ('filename', 'typotype', 'avg_bc', 'avg_hbc', 'std_bc', 'std_hbc'), 

63 
'formats': ('a40', 'a6', 'f8', 'f8', 'f8', 'f8'), 

72 
'names': ('filename', 'typotype', 'graphtype', 'numofnodes', 'avg_bc', 'avg_hbc', 'std_bc', 'std_hbc'),


73 
'formats': ('a40', 'a6', 'a2', 'i4', 'f8', 'f8', 'f8', 'f8'),


64  74 
}, 
65  75 
delimiter=',', 
66  76 
) 
67 
return result 

68  
69  
70 
def format_output_data_out2(bc_result, hbc_result): 

71 
output_data = list() 

72  
73 
for key in bc_result.keys(): 

74 
tmp_list = [key] 

75  
76 
graph_type = key[0:2] 

77 
tmp_list.append(graph_type) 

78  
79 
num_of_nodes = key[2:] 

80 
tmp_list.append(num_of_nodes) 

81  
82 
bc_values = bc_result[key] 

83 
hbc_values = hbc_result[key] 

84  
85 
tmp_list.append(bc_values[2]) 

86 
tmp_list.append(hbc_values[2]) 

87  
88 
tmp_list.append(bc_values[3]) 

89 
tmp_list.append(hbc_values[3]) 

90  
91 
output_data.append(tmp_list) 

92  
93 
return output_data 

77 
return result 
Also available in: Unified diff