From 6845626fe974a271294428462ada0b07c05ddc28 Mon Sep 17 00:00:00 2001 From: marques Date: Wed, 17 Dec 2025 15:00:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=81=8F=E7=A7=BB=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E5=87=BD=E6=95=B0=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?BCG=E6=8F=90=E5=89=8D=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9A=84X?= =?UTF-8?q?=E8=BD=B4=E5=88=BB=E5=BA=A6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- func/Module_precisely_align.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/func/Module_precisely_align.py b/func/Module_precisely_align.py index 674123a..3ce01d5 100644 --- a/func/Module_precisely_align.py +++ b/func/Module_precisely_align.py @@ -9,6 +9,7 @@ from PySide6.QtWidgets import QMessageBox, QMainWindow, QApplication, QButtonGro from matplotlib import gridspec, patches from matplotlib.backends.backend_qt import NavigationToolbar2QT from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg +from matplotlib.ticker import FuncFormatter from numpy import (diff, where, correlate, corrcoef, searchsorted, sum as np_sum, max as np_max, min as np_min, arange, array, append, delete, abs as np_abs, argmin as np_argmin, argmax as np_argmax, asarray) @@ -470,6 +471,12 @@ class MainWindow_precisely_align(QMainWindow): sender = self.sender() + def offset_formatter(x, pos): + if self.data.BCG_early: + return f"{int(x + self.data.approximately_align_pos)}" + else: + return f"{int(x - self.data.approximately_align_pos)}" + if sender == self.ui.pushButton_input: self.gs = gridspec.GridSpec(2, 1, height_ratios=[1, 1]) self.fig.subplots_adjust(top=0.95, bottom=0.05, right=0.98, left=0.05, hspace=0.15, wspace=0) @@ -528,6 +535,8 @@ class MainWindow_precisely_align(QMainWindow): self.ax0.stem(Jpeak, plot_element["JJIVs"], markerfmt="C0.", linefmt=Constants.PLOT_COLOR_GREEN, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV) + self.ax0.xaxis.set_major_formatter(FuncFormatter(offset_formatter)) + self.ax1.stem(Rpeak, plot_element["RRIVs"], markerfmt="C0.", linefmt=Constants.PLOT_COLOR_ORANGE, label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RRIV)