Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def edit_annotations(self):
fs = self.model.current["data"].info["sfreq"]
pos = self.model.current["data"].annotations.onset
pos = (pos * fs).astype(int).tolist()
dur = self.model.current["data"].annotations.duration
dur = (dur * fs).astype(int).tolist()
desc = self.model.current["data"].annotations.description.tolist()
dialog = AnnotationsDialog(self, pos, dur, desc)
if dialog.exec_():
rows = dialog.table.rowCount()
onset, duration, description = [], [], []
for i in range(rows):
data = dialog.table.item(i, 0).data(Qt.DisplayRole)
onset.append(float(data) / fs)
data = dialog.table.item(i, 1).data(Qt.DisplayRole)
duration.append(float(data) / fs)
data = dialog.table.item(i, 2).data(Qt.DisplayRole)
description.append(data)
self.model.set_annotations(onset, duration, description)