...
 
Commits (8)
This diff is collapsed.
......@@ -2,7 +2,7 @@
import argparse
import importlib
import glob
from mericVisualizer import *
from collections import OrderedDict as ordDict
import six
......@@ -48,9 +48,8 @@ if __name__ == '__main__':
root_folder_lst = [e[0] for e in config['root_folder']]
for root_folder_ind, root_folder in enumerate(root_folder_lst):
# Kontrola a pripadna expanze relativni cesty
if root_folder.startswith('./'):
root_folder = root_folder.replace('./', args.configFile[:args.configFile.rfind('/')] + '/', 1)
# Expanze cesty ke slozce s daty
root_folder = os.path.abspath(root_folder)
# Tvorba TexFile a SlideshowCreator objektu
utils.print_info('Creating fileObject ({})...'.format(root_folder))
......@@ -239,7 +238,8 @@ if __name__ == '__main__':
def_label_val,
def_keys,
def_x_val,
optim_func=min)
optim_func=min,
filename_args=file_name_args)
loaded_data_nested = {}
loaded_data_avg_nested = {}
......@@ -304,7 +304,8 @@ if __name__ == '__main__':
default_keys=def_keys,
global_default_label=def_label_val,
global_default_x_val=def_x_val,
optim_func=min)
optim_func=min,
filename_args=file_name_args)
if detailed_info:
default_optimal_vals_full_nested[func] = loaded_data_tmp.get_optimal_and_default_vals('full',
......@@ -313,7 +314,8 @@ if __name__ == '__main__':
default_keys=def_keys,
global_default_label=def_label_val,
global_default_x_val=def_x_val,
optim_func=min)
optim_func=min,
filename_args=file_name_args)
else:
default_optimal_vals_avg_nested[func] = loaded_data_tmp.get_optimal_and_default_vals('avg',
......@@ -321,7 +323,8 @@ if __name__ == '__main__':
default_x_val=None,
global_default_label=def_label_val,
global_default_x_val=def_x_val,
optim_func=min)
optim_func=min,
filename_args=file_name_args)
if detailed_info:
default_optimal_vals_full_nested[func] = loaded_data_tmp.get_optimal_and_default_vals('full',
......@@ -329,7 +332,8 @@ if __name__ == '__main__':
default_x_val=None,
global_default_label=def_label_val,
global_default_x_val=def_x_val,
optim_func=min)
optim_func=min,
filename_args=file_name_args)
utils.print_info('Data succesfully loaded.')
......
......@@ -191,6 +191,18 @@ def remove_outliers(data, m=1.5):
return [e for e in data if (abs(e - mean) < m * std)] if std else data
def find_str_in_files(filename_pattern_path, string, contains_str=True):
files = glob.glob(filename_pattern_path)
for f in files:
with open(f, 'rb', 0) as file,\
mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as s:
found_tmp = s.find(string)
if (found_tmp == -1 and contains_str) or (found_tmp != -1 and contains_str is False):
files.remove(f)
return files
def replace_nth(string, old, new, n=1, option='only nth'):
"""
This function replaces occurrences of string 'old' with string 'new'.
......@@ -222,4 +234,4 @@ def replace_every_nth(string, sub, wanted, n):
after = string[where:]
after = after.replace(sub, wanted)
new_string = before + after
return new_string
\ No newline at end of file
return new_string