add warning for non-working interpolations; fixes #159

This commit is contained in:
Dominik Demuth 2023-11-29 19:16:58 +01:00
parent bb5c6a5491
commit e662dcf03c

View File

@ -829,9 +829,23 @@ class UpperManagement(QtCore.QObject):
new_x = self.data[new_axis[0]].x
new_key = []
missed = []
for ids in data_ids:
k = self.add(interpolate(self.data[ids], new_x, xlog=xlog, ylog=ylog, kind=mode, extrapolate=True))
new_key.append(k)
try:
k = self.add(interpolate(self.data[ids], new_x, xlog=xlog, ylog=ylog, kind=mode, extrapolate=True))
new_key.append(k)
except ValueError:
missed.append(self.data[ids].name)
if missed:
missed_str = '\n'.join(missed)
_ = QtWidgets.QMessageBox.warning(
QtWidgets.QWidget(),
'Interpolation failed',
f'Interpolation failed for the following sets:\n\n'
f'{missed_str}\n\n'
f'(Probably because of duplicate x values)'
)
self.newData.emit(new_key, dest_graph)