1
0
forked from IPKM/nmreval
Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de>
Reviewed-on: IPKM/nmreval#283
This commit is contained in:
2024-07-16 17:01:20 +00:00
parent 5823ddd18c
commit e1b76e837d
5 changed files with 33 additions and 13 deletions

View File

@ -991,15 +991,19 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
self.editor.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
self.editor.show()
@QtCore.pyqtSlot(list)
def extend_fit(self, sets: list):
@QtCore.pyqtSlot(list, bool)
def extend_fit(self, sets: list, only_subplots: bool):
if only_subplots:
self.management.extend_fits(sets, None, True)
return
w = FitExtension(self)
res = w.exec()
if res:
p = w.values
spacefunc = geomspace if p[3] else linspace
x = spacefunc(p[0], p[1], num=p[2])
self.management.extend_fits(sets, x)
self.management.extend_fits(sets, x, False)
@QtCore.pyqtSlot(name='on_action_create_fit_function_triggered')
def open_fitmodel_wizard(self):

View File

@ -711,17 +711,21 @@ class UpperManagement(QtCore.QObject):
self.newData.emit(f_id_list, gid)
def extend_fits(self, set_id: list, x_range: np.ndarray):
def extend_fits(self, set_id: list, x_range: np.ndarray | None, only_subplots: bool):
graphs = {}
for sid in set_id:
data = self[sid]
fit = data.copy(full=True, keep_color=True)
fit.data = fit.data.with_new_x(x_range)
data = fit = self[sid]
graph_id = data.graph
if graph_id not in graphs:
graphs[graph_id] = []
graphs[graph_id].append(self.add(fit))
if not only_subplots:
fit = data.copy(full=True, keep_color=True)
if x_range is not None:
fit.data = fit.data.with_new_x(x_range)
graphs[graph_id].append(self.add(fit))
color_scheme = available_cycles['colorblind']
for subfunc, col in zip(fit.data.sub(fit.x), cycle(color_scheme)):