Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def epoch_data(self):
"""Epoch raw data."""
dialog = EpochDialog(self, self.model.current["events"])
if dialog.exec_():
events = [int(item.text()) for item
in dialog.events.selectedItems()]
tmin = dialog.tmin.value()
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