look for fits without parent during save; fixes T258

This commit is contained in:
Dominik Demuth 2023-02-02 17:09:04 +01:00
parent 0eb0a4be77
commit fec4103608

View File

@ -9,6 +9,7 @@ from nmreval.fit.model import Model
from nmreval.fit.result import FitResult from nmreval.fit.result import FitResult
from nmreval.fit.minimizer import FitRoutine from nmreval.fit.minimizer import FitRoutine
from nmreval.lib.colors import available_cycles from nmreval.lib.colors import available_cycles
from nmreval.lib.logger import logger
from nmreval.math.interpol import interpolate from nmreval.math.interpol import interpolate
from nmreval.math.logfourier import logft from nmreval.math.logfourier import logft
from nmreval.math.smooth import smooth from nmreval.math.smooth import smooth
@ -322,8 +323,8 @@ class UpperManagement(QtCore.QObject):
value_set.add(data_i.value) value_set.add(data_i.value)
if joined is not None: if joined is not None:
joined.group = '/'.join(group_set) joined.group = '+'.join(group_set)
joined.name = '/'.join(name_set) joined.name = '+'.join(name_set)
if len(value_set) == 1: if len(value_set) == 1:
joined.value = value_set.pop() joined.value = value_set.pop()
@ -1103,7 +1104,12 @@ class UpperManagement(QtCore.QObject):
data_i = self.data[set_id] data_i = self.data[set_id]
if isinstance(data_i, FitContainer): if isinstance(data_i, FitContainer):
try:
full_name += ' fit(' + self.data[data_i.parent_set].name + ')' full_name += ' fit(' + self.data[data_i.parent_set].name + ')'
except KeyError:
# TODO fits should have a parent set
logger.warning(f'Fit {data_i} without valid parent : key is [{data_i.parent_set}')
full_name += ' fit'
if strip_spaces: if strip_spaces:
full_name = full_name.replace(' ', '_') full_name = full_name.replace(' ', '_')