diff --git a/iss/tools/config.py b/iss/tools/config.py index c2d9635..4df03ac 100644 --- a/iss/tools/config.py +++ b/iss/tools/config.py @@ -19,7 +19,6 @@ class Config: yaml.add_implicit_resolver('!path', self.path_matcher, None, yaml.SafeLoader) yaml.add_constructor('!path', self.path_constructor, yaml.SafeLoader) - print("ok") with open(os.path.join(self.project_dir, 'config', 'config_%s.yaml' % (self.mode)), 'r') as ymlfile: self.config = yaml.safe_load(ymlfile) diff --git a/iss/tools/tools.py b/iss/tools/tools.py new file mode 100644 index 0000000..27a76ea --- /dev/null +++ b/iss/tools/tools.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +import PIL +import os + +class Tools: + + @staticmethod + def display_one_picture(array): + array = array.astype('uint8') + return PIL.Image.fromarray(array, 'RGB') + + @staticmethod + def display_one_picture_scaled(array): + array = array * 255 + return Tools.display_one_picture(array) + + @staticmethod + def display_index_picture_scaled(array, index = 0): + return Tools.display_one_picture_scaled(array[index]) + + @staticmethod + def display_index_picture(array, index = 0): + return Tools.display_one_picture(array[index]) + + @staticmethod + def create_dir_if_not_exists(path): + if not os.path.exists(path): + os.makedirs(path) + return path + +