Skip to content

Commit c6e87d7

Browse files
committed
Replaced print statement with logger.exception. Long term, might be nice to include it in the applications logger
1 parent 7dee759 commit c6e87d7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/petab_gui/views/simple_plot_view.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
from collections import defaultdict
23

34
import petab.v1.C as PETAB_C
@@ -19,6 +20,8 @@
1920

2021
from .utils import proxy_to_dataframe
2122

23+
logger = logging.getLogger(__name__)
24+
2225

2326
class PlotWorkerSignals(QObject):
2427
finished = Signal(object) # Emits final Figure
@@ -196,8 +199,8 @@ def _render_on_main_thread(self, payload):
196199
fig = plt.gcf()
197200
self._update_tabs(fig)
198201
return
199-
except Exception as e:
200-
print(f"Invalid Visualisation DF: {e}")
202+
except Exception:
203+
logger.exception("Invalid Visualisation DF")
201204
# fallback to observable grouping
202205
plt.close("all")
203206
petab_vis.plot_without_vis_spec(
@@ -412,8 +415,8 @@ def plot_residuals(self):
412415
axes=axes,
413416
)
414417
create_plot_tab(fig_res, self, "Residuals vs Simulation")
415-
except ValueError as e:
416-
print(f"Error plotting residuals: {e}")
418+
except ValueError:
419+
logger.exception("Error plotting residuals")
417420
fig_fit, axes_fit = plt.subplots(constrained_layout=False)
418421
fig_fit.subplots_adjust(left=0.05, right=0.98, bottom=0.05, top=0.98)
419422
plot_goodness_of_fit(

0 commit comments

Comments
 (0)