From f5e2d926360ae4ee9449a3f3247e243d49cb3ddc Mon Sep 17 00:00:00 2001 From: Andrei Savici Date: Thu, 30 Nov 2023 10:36:53 -0500 Subject: [PATCH] Use the correct Mantid algorithm. Note that matplotlib.pyplot.tight_layout() will only adjust the subplot params when it is called. In order to perform this adjustment each time the figure is redrawn, you can call fig.set_tight_layout(True) --- src/shiver/models/refine_ub.py | 4 ++-- src/shiver/views/refine_ub.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shiver/models/refine_ub.py b/src/shiver/models/refine_ub.py index fd10961..9c8149c 100644 --- a/src/shiver/models/refine_ub.py +++ b/src/shiver/models/refine_ub.py @@ -12,7 +12,7 @@ mtd, CalculateUMatrix, FindUBUsingIndexedPeaks, - SelectCellOfType, + OptimizeLatticeForCellType, SetUB, SliceMDHisto, IndexPeaks, @@ -125,7 +125,7 @@ def refine(self, rows, lattice_type): try: FindUBUsingIndexedPeaks(subset) if lattice_type: - SelectCellOfType(subset, CellType=lattice_type, Apply=True) + OptimizeLatticeForCellType(subset, CellType=lattice_type, Apply=True) except (RuntimeError, ValueError) as err: logger.error(str(err)) if self.error_callback: diff --git a/src/shiver/views/refine_ub.py b/src/shiver/views/refine_ub.py index ac0cb52..80fcad9 100644 --- a/src/shiver/views/refine_ub.py +++ b/src/shiver/views/refine_ub.py @@ -165,6 +165,7 @@ def _setup_ui(self): plot_layout = QHBoxLayout() self.figure, self.axes = plt.subplots(1, 3, subplot_kw={"projection": "mantid"}, figsize=(8, 2)) self.figure.tight_layout(w_pad=4) + self.figure.set_tight_layout(True) self.canvas = FigureCanvas(self.figure) plot_layout.addWidget(self.canvas) vlayout.addLayout(plot_layout)