Commit 59c6a610 authored by Ivo Peterek's avatar Ivo Peterek

ENH: loading configure multiple values of configure parameter + loading data...

ENH: loading configure multiple values of configure parameter + loading data without threads(key) parameter #13
parent 1ae5e4bd
......@@ -41,7 +41,7 @@ class DataLoad:
categories = []
funcLabel_pos = -1
xLabel_pos = -1
key_pos = -1
key_pos = None
for key, value in self.y_label.items():
for val in value:
......@@ -56,9 +56,21 @@ class DataLoad:
if item[0] == 'key':
key_pos = i
try:
key_unit = self.config_dic['keys_units'][0]
except IndexError:
opt_key_unit = ''
for region in self.regions:
csv_paths = glob.glob(glob.escape(self.data_path) + '/' + glob.escape(region) + '/*.csv')
# KEY = NUM_THREADS only TODO: different keys in future
try:
opt_key = self.meric_config_energy_data[region]['NUM_THREADS']
except KeyError:
opt_key = ''
data_region = []
for key, vals in self.y_label.items():
for i, val in enumerate(vals):
......@@ -71,7 +83,7 @@ class DataLoad:
'func_label_unit': self.config_dic['func_label_unit'],
'heat_data': [],
# list of lists one of lists contains tuples -> (xLabel, value_in_heatmap)
'key': (self.meric_config_energy_data[region]['NUM_THREADS']+';'+self.config_dic['keys_units'][0],), # optimal key from mericConfig
'key': (opt_key+';'+opt_key_unit,), # optimal key from mericConfig
'lines': [], # funcLabel values
'optim_func_label_value': self.meric_config_energy_data[region]['FREQUENCY'], # optim vals
'optim_x_val': self.meric_config_energy_data[region]['UNCORE_FREQUENCY'],
......@@ -89,7 +101,10 @@ class DataLoad:
csv_name = csv_name.split('_')
xlabel_val = csv_name[xLabel_pos]
funclabel_val = csv_name[funcLabel_pos]
key_val = csv_name[key_pos]
if key_pos:
key_val = csv_name[key_pos]
else:
key_val = ''
dict_plot_data_ylabel = {}
for key, vals in self.y_label.items():
......@@ -97,7 +112,7 @@ class DataLoad:
new_dict_key = key + " " + val[0]
dict_plot_data_ylabel[new_dict_key] = 0
if key_val == self.meric_config_energy_data[region]['NUM_THREADS']:
if key_val == opt_key:
with open(csv_path) as csv_file:
reader = csv.reader(csv_file, delimiter=',')
for line in reader:
......@@ -125,8 +140,23 @@ class DataLoad:
if len(data[1]['heat_data'])-1 < index_of_line:
data[1]['heat_data'].append([])
data[1]['heat_data'][index_of_line].append((round(float(xlabel_val)*self.xLabel_multiplier, 2)
, value))
#check if xlabel is existing in heat_data
new_xLabel_val = round(float(xlabel_val) * self.xLabel_multiplier, 2)
if len(data[1]['heat_data'][index_of_line]) > 0:
exists =False
for num, xLabel_val_tup in enumerate(data[1]['heat_data'][index_of_line]):
if xLabel_val_tup[0] == new_xLabel_val:
exists = True
new_xLabel_val_tup = (new_xLabel_val, (xLabel_val_tup[1] + value)/2)
data[1]['heat_data'][index_of_line][num] = new_xLabel_val_tup
print()
if not exists:
data[1]['heat_data'][index_of_line].append(
(new_xLabel_val, value))
else:
data[1]['heat_data'][index_of_line].append(
(new_xLabel_val, value))
if value < data[1]['optim_y_val']: #optimal value is just minimum
data[1]['optim_y_val'] = value
else:
......
......@@ -61,6 +61,8 @@ class MainMenu(QtWidgets.QFrame, design_main_menu.Ui_MainMenu):
print("loading data directly from csv failed!!! using old radar get_data_for_gui.py !!!")
traceback.print_exc()
self.data_no_radar = None
else:
print("Heatmap data loaded directly from csv files.")
self.config_path = config_path
self.config = run_path(config_path)
self.dictForTex = {'tree': None, 'plots': [], 'heatmaps': [], 'overall': False, 'regions': [], 'nested': []}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment