forked from IPKM/nmreval
add warning for non-working interpolations; fixes #159
This commit is contained in:
parent
bb5c6a5491
commit
e662dcf03c
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user