Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tmax = dialog.tmax.value()
if dialog.baseline.isChecked():
baseline = dialog.a.value(), dialog.b.value()
else:
baseline = None
duplicated = self.auto_duplicate()
try:
self.model.epoch_data(events, tmin, tmax, baseline)
except ValueError as e:
if duplicated: # undo
self.model.remove_data()
self.model.index -= 1
self.data_changed()
msgbox = ErrorMessageBox(self, "Could not create epochs",
str(e), traceback.format_exc())
msgbox.show()
def interpolate_bads(self):
"""Interpolate bad channels"""
dialog = InterpolateBadsDialog(self)
if dialog.exec_():
duplicated = self.auto_duplicate()
try:
self.model.interpolate_bads(dialog.reset_bads, dialog.mode,
dialog.origin)
except ValueError as e:
if duplicated: # undo
self.model.remove_data()
self.model.index -= 1
self.data_changed()
msgbox = ErrorMessageBox(self,
"Could not interpolate bad channels",
str(e), traceback.format_exc())
msgbox.show()