From f034929bffd078ddfb1448640ee92a0b2f52d425 Mon Sep 17 00:00:00 2001 From: Adrian Peter Krone Date: Fri, 13 Dec 2024 20:26:25 +0100 Subject: [PATCH] Added fmin display to qtwidget --- src/iminuit/qtwidget.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/iminuit/qtwidget.py b/src/iminuit/qtwidget.py index 6732e959..d4ae682c 100644 --- a/src/iminuit/qtwidget.py +++ b/src/iminuit/qtwidget.py @@ -256,7 +256,7 @@ def __init__(self): scroll_area_contents = QtWidgets.QWidget() parameter_layout = QtWidgets.QVBoxLayout(scroll_area_contents) par_scroll_area.setWidget(scroll_area_contents) - interactive_layout.addWidget(par_scroll_area, 1, 1, 1, 1) + interactive_layout.addWidget(par_scroll_area, 1, 1, 2, 1) self.parameters = [] for par in minuit.parameters: parameter = Parameter(minuit, par, self.on_parameter_change) @@ -264,6 +264,12 @@ def __init__(self): parameter_layout.addWidget(parameter) parameter_layout.addStretch() + self.results_text = QtWidgets.QTextEdit(parent=self) + self.results_text.setReadOnly(True) + self.results_text.setSizePolicy(size_policy) + self.results_text.setMaximumHeight(144) + interactive_layout.addWidget(self.results_text, 2, 0, 1, 1) + self.plot_with_frame(from_fit=False, report_success=False) def plot_with_frame(self, from_fit, report_success): @@ -330,6 +336,12 @@ def on_parameter_change(self, from_fit=False, report_success=False): report_success = self.do_fit(plot=False) minuit.fixed = saved + if from_fit: + self.results_text.clear() + self.results_text.setHtml(f"
{minuit.fmin._repr_html_()}
") + else: + self.results_text.clear() + plt.clf() self.plot_with_frame(from_fit, report_success) self.canvas.draw_idle()