Commit 8a24d4b4 authored by Martin Beseda's avatar Martin Beseda

ENH: Added check of number of filename parameters in every filename.

parent 7d15859f
......@@ -1031,6 +1031,7 @@ class FilenameArgsContainer:
# Inicializuji promenne
self.__params_values_dic = args_lst.copy()
self.__params_values_dic_len = len(self.__params_values_dic)
# Kontroluji slovnik
for e in self.get_lst_of_position_names():
......@@ -1126,6 +1127,9 @@ class FilenameArgsContainer:
def get_func_label_val_from_dic(self, dic):
return dic[self.get_func_label()]
def get_num_of_params(self):
return self.__params_values_dic_len
class OptimalAndDefaultValsContainer:
def __init__(self,
......@@ -1543,6 +1547,7 @@ class DataContainer:
single_prog_start_data_tmp = list()
for iter_ind in range(len(singleProgramStart)):
print(prog_start_ind, iter_ind)
# Vyberu data pro vychozi label
def_label = default_label_val
try:
......@@ -1553,6 +1558,11 @@ class DataContainer:
for i in range(self.get_evaluated_vars_num())]
def_label = [global_default_label]*self.get_evaluated_vars_num()
print('asdf3')
a=1
# CHYBI DATA PRO 2. BEH v 24_21_18.csv!
# Vyberu data pro vychozi x value pro kazdou iteraci
#
# Pokud neni iterace pro optimum z nadrazeneho regionu, vezme se globalni optimum
......@@ -1561,12 +1571,14 @@ class DataContainer:
for i in range(self.get_evaluated_vars_num())]
def_x_val_tup = []
print('asdf2')
for i in range(self.get_evaluated_vars_num()):
item_added = False
for tup in def_x_val_tmp[i]:
if tup[0] == default_x_val[i]:
def_x_val_tup.append(tup)
item_added = True
print('asdf')
# Kontrola, jestli byly nalezene hodnoty pro vsechny vyhodnocovane promenne
if not item_added:
......@@ -2145,6 +2157,12 @@ class DataReader:
# Ziskam nazvy parametru z nazvu souboru
args = filename[0:filename.rfind('.')].split('_')
# Kontrola specifikace parametru
if len(args) != filename_args.get_num_of_params():
utils.print_err('Number of specified filename parameters ({}) does not '
'correspond to the filename {}!'.format(filename_args.get_num_of_params(),
filename))
# Priradim konkretni hodnoty z nazvu CSV souboru
# k zadanym parametrum filename_args
d = {key: (args[i] if i < len(args) else '') for i, key in enumerate(key_lst)}
......@@ -2426,8 +2444,8 @@ class DataReader:
try:
return utils.get_round_num_str(float(current_func_label_value) * float(func_label_multiplier), 1)
except ValueError:
utils.print_err('Function label {} or its multiplier is not a number and so it can not be '
'multiplied by {}!'.format(current_func_label_value, func_label_multiplier))
utils.print_err('Function label {} or its multiplier {} is not a number!'
.format(current_func_label_value, func_label_multiplier))
class Evaluator:
......
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