def mouseReleaseEvent(self, event):
        """Create a new event or marker, or show the previous power spectrum
        """
        if not self.scene:
            return

        if self.event_sel:
            return

        if self.deselect:
            self.deselect = False
            return

        if not self.ready:
            return

        chk_marker = self.parent.notes.action['new_bookmark'].isChecked()
        chk_event = self.parent.notes.action['new_event'].isChecked()
        y_distance = self.parent.value('y_distance')

        if chk_marker or chk_event:

            x_in_scene = self.mapToScene(event.pos()).x()
            y_in_scene = self.mapToScene(event.pos()).y()

            # it can happen that selection is empty (f.e. double-click)
            if self.sel_xy[0] is not None:
                # max resolution = sampling frequency
                # in case there is no data
                s_freq = self.parent.info.dataset.header['s_freq']
                at_s_freq = lambda x: round(x * s_freq) / s_freq
                start = at_s_freq(self.sel_xy[0])
                end = at_s_freq(x_in_scene)

                if abs(end - start) < self.parent.value('min_marker_dur'):
                    end = start

                if start <= end:
                    time = (start, end)
                else:
                    time = (end, start)

                if chk_marker:
                    self.parent.notes.add_bookmark(time)

                elif chk_event and start != end:
                    eventtype = self.parent.notes.idx_eventtype.currentText()
                    
                    # if dragged across > 1.5 chan, event is marked on all chan
                    if abs(y_in_scene - self.sel_xy[1]) > 1.5 * y_distance:
                        chan = ''
                    else:
                        chan_idx = int(floor(self.sel_xy[1] / y_distance))
                        chan = self.chan[chan_idx]
                        
                    self.parent.notes.add_event(eventtype, time, chan)

        else:  # normal selection

            if self.idx_info in self.scene.items():
                self.scene.removeItem(self.idx_info)
            self.idx_info = None

            # restore spectrum
            self.parent.spectrum.update()
            self.parent.spectrum.display_window()

        # general garbage collection
        self.sel_chan = None
        self.sel_xy = (None, None)

        if self.idx_sel in self.scene.items():
            self.scene.removeItem(self.idx_sel)
            self.idx_sel = None
Create a new event or marker, or show the previous power spectrum