forked from IPKM/nmreval
set order is now respected for fits; fixes #161
This commit is contained in:
parent
d146f4fe7e
commit
12726e6f56
@ -211,8 +211,6 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.fit_plot.setLogMode(x=res.islog)
|
||||
self.resid_plot.setLogMode(x=res.islog)
|
||||
|
||||
print(self.graph_opts)
|
||||
|
||||
if idx in self.graph_opts:
|
||||
view_range, logx, logy = self.graph_opts[idx]
|
||||
self.fit_plot.setLogMode(x=logx, y=logy)
|
||||
|
@ -302,7 +302,6 @@ class UpperManagement(QtCore.QObject):
|
||||
@QtCore.pyqtSlot()
|
||||
def delete_sets(self, rm_sets: list = None):
|
||||
rm_graphs = []
|
||||
print(rm_sets)
|
||||
|
||||
if rm_sets is None:
|
||||
rm_sets = self.graphs[self.current_graph].sets + [self.current_graph]
|
||||
@ -330,12 +329,10 @@ class UpperManagement(QtCore.QObject):
|
||||
logger.warning(f'delete_sets: {k} is not in data or graph found')
|
||||
|
||||
for gid, sid_list in rm_set_by_graph.items():
|
||||
print('delete set')
|
||||
cmd = DeleteCommand(self.data, list(sid_list), self.graphs, gid, self.newData, self.deleteData)
|
||||
self.undostack.push(cmd)
|
||||
|
||||
for k in rm_graphs:
|
||||
print('delete graphs')
|
||||
cmd = DeleteGraphCommand(self.graphs, k, self.restoreGraph, self.deleteGraph)
|
||||
self.undostack.push(cmd)
|
||||
|
||||
@ -456,6 +453,11 @@ class UpperManagement(QtCore.QObject):
|
||||
|
||||
self.fitter.fitmethod = fit_mode
|
||||
|
||||
# sets are not in active order but in order they first appeared in fit dialog
|
||||
# iterate over order of set id in active order and access parameter inside loop
|
||||
# instead of directly looping
|
||||
list_ids = list(self.active_id)
|
||||
|
||||
# all-encompassing error catch
|
||||
try:
|
||||
for model_id, model_p in parameter.items():
|
||||
@ -464,18 +466,7 @@ class UpperManagement(QtCore.QObject):
|
||||
|
||||
m_complex = model_p['complex']
|
||||
|
||||
# sets are not in active order but in order they first appeared in fit dialog
|
||||
# iterate over order of set id in active order and access parameter inside loop
|
||||
# instead of directly looping
|
||||
try:
|
||||
list_ids = list(self.active_id)
|
||||
set_order = [self.active_id.index(i) for i in model_p['data_parameter'].keys()]
|
||||
except ValueError as e:
|
||||
raise Exception('Getting order failed') from e
|
||||
|
||||
for pos in set_order:
|
||||
set_id = list_ids[pos]
|
||||
|
||||
for set_id in list_ids:
|
||||
try:
|
||||
data_i = self.data[set_id]
|
||||
except KeyError as e:
|
||||
|
@ -102,12 +102,10 @@ class Parameters(dict):
|
||||
p._expr = expression
|
||||
|
||||
def prepare_bounds(self):
|
||||
print('prepare_bounds')
|
||||
original_values = list(self.values())
|
||||
for param in original_values:
|
||||
already_with_expression = False
|
||||
for mode, value in (('lower', param.lb), ('upper', param.ub)):
|
||||
print(mode, value)
|
||||
if already_with_expression:
|
||||
raise ValueError('Only one boundary can be an expression')
|
||||
already_with_expression = self.parse(param, value, bnd=mode)
|
||||
|
Loading…
Reference in New Issue
Block a user