From bf8604d5a220d452c635b13936fb1624b96f99dc Mon Sep 17 00:00:00 2001 From: leufen1 <l.leufen@fz-juelich.de> Date: Wed, 7 Sep 2022 19:09:57 +0200 Subject: [PATCH] finetune on plot shape, need to be tested with more competing models but is done for now --- mlair/plotting/postprocessing_plotting.py | 5 +++-- mlair/plotting/tracker_plot.py | 4 ++++ mlair/run_modules/run_environment.py | 9 +++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py index afbd00d0..5bd4ab1b 100644 --- a/mlair/plotting/postprocessing_plotting.py +++ b/mlair/plotting/postprocessing_plotting.py @@ -1192,8 +1192,9 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): # pragma: no cover else: xy = (self.model_type_dim, 0) if orientation == "v" else (0, self.model_type_dim) col_or_row = {"col": self.ahead_dim} if orientation == "v" else {"row": self.ahead_dim} - aspect = 0.4 if orientation == "v" else 5./3. - ax = sns.FacetGrid(data_table.stack(self.model_type_dim).reset_index(), **col_or_row, aspect=aspect, height=5) + aspect = figsize[0] / figsize[1] + height = figsize[1] * 0.8 + ax = sns.FacetGrid(data_table.stack(self.model_type_dim).reset_index(), **col_or_row, aspect=aspect, height=height) ax.map(sns.boxplot, *xy, whis=1.5, color="white", showmeans=True, order=data_table.mean().index.to_list(), meanprops={"markersize": 6, "markeredgecolor": "k"}, flierprops={"marker": "o", "markerfacecolor": "black", "markeredgecolor": "none", "markersize": 3}, diff --git a/mlair/plotting/tracker_plot.py b/mlair/plotting/tracker_plot.py index 53ec7496..5c5887a6 100644 --- a/mlair/plotting/tracker_plot.py +++ b/mlair/plotting/tracker_plot.py @@ -319,8 +319,12 @@ class TrackPlot: x_max = None if chain.successor is not None: + stage_count = 0 for e in chain.successor: if e.stage == stage: + stage_count += 1 + if stage_count > 50: + continue shift = self.width + self.space_intern_x if chain.stage == e.stage else 0 x_tmp = self.plot_track_chain(e, y_pos, x_pos + shift, prev=(x, y), stage=stage, sparse_conn_mode=sparse_conn_mode) diff --git a/mlair/run_modules/run_environment.py b/mlair/run_modules/run_environment.py index 2bc81750..9edb0aa2 100644 --- a/mlair/run_modules/run_environment.py +++ b/mlair/run_modules/run_environment.py @@ -8,6 +8,7 @@ import logging import os import shutil import time +import sys from mlair.helpers.datastore import DataStoreByScope as DataStoreObject from mlair.helpers.datastore import NameNotFoundInDataStore @@ -160,8 +161,12 @@ class RunEnvironment(object): json.dump(tracker, f) def __plot_tracking(self): - plot_folder, plot_name = os.path.split(self.__find_file_pattern("tracking_%03i.pdf")) - TrackPlot(self.tracker_list, sparse_conn_mode=True, plot_folder=plot_folder, plot_name=plot_name) + try: + plot_folder, plot_name = os.path.split(self.__find_file_pattern("tracking_%03i.pdf")) + TrackPlot(self.tracker_list, sparse_conn_mode=True, plot_folder=plot_folder, plot_name=plot_name) + except Exception as e: + logging.info(f"Could not plot tracking plot due to:\n{sys.exc_info()[0]}\n" + f"{sys.exc_info()[1]}\n{sys.exc_info()[2]}") def __find_file_pattern(self, name): counter = 0 -- GitLab