Update event data in dataset.

def update_event_data(self, num, data):
        """Update event data in dataset."""
        if num < 0 or num >= self.params["events_num"]:
            raise IndexError("Index out of range [0:%s]" %
                             (self.params["events_num"]))

        if isinstance(data, np.ndarray):
            raise TypeError("data should be np.ndarray")

        if data.dtype != np.short:
            raise TypeError("data array dtype should be dtype('int16')")

        ch_num = self.params['channel_number']
        ev_size = self.params['b_size']

        if data.shape != (ch_num * ev_size,):
            raise Exception("data should contain same number of elements "
                            "(%s)" % (ch_num * ev_size))

        self.file.seek(7168 + num * (96 + 2 * ch_num * ev_size) + 96)
        self.file.write(data.tostring())
        self.file.flush()