def export(self, new_format, filename=None, chan=None, begtime=None,
               endtime=None):
        """Export current dataset to wonambi format (.won).

        Parameters
        ----------
        new_format : str
            Format for exported record: 'edf' or 'wonambi'
        filename : str or PosixPath
            filename to export to
        chan : list of str, opt
            list of original channel names to export. if None, all channels are
            exported
        begtime : int or datedelta or datetime
            start of the data to read;
            if it's int or float, it's assumed it's s;
            if it's timedelta, it's assumed from the start of the recording;
            if it's datetime, it's assumed it's absolute time.
        endtime : int or datedelta or datetime
            end of the data to read;
            if it's int or float, it's assumed it's s;
            if it's timedelta, it's assumed from the start of the recording;
            if it's datetime, it's assumed it's absolute time.
        """
        dataset = self.dataset
        subj_id = dataset.header['subj_id']
        if filename is None:
            filename = dataset.filename

        data = dataset.read_data(chan=chan, begtime=begtime, endtime=endtime)

        if 'wonambi' == new_format:
            write_wonambi(data, filename, subj_id=subj_id)

        elif 'edf' == new_format:
            write_edf(data, filename, subj_id=subj_id)

        else:
            self.parent.statusBar().showMessage('Format unrecognized.')
Export current dataset to wonambi format (.won).

        Parameters
        ----------
        new_format : str
            Format for exported record: 'edf' or 'wonambi'
        filename : str or PosixPath
            filename to export to
        chan : list of str, opt
            list of original channel names to export. if None, all channels are
            exported
        begtime : int or datedelta or datetime
            start of the data to read;
            if it's int or float, it's assumed it's s;
            if it's timedelta, it's assumed from the start of the recording;
            if it's datetime, it's assumed it's absolute time.
        endtime : int or datedelta or datetime
            end of the data to read;
            if it's int or float, it's assumed it's s;
            if it's timedelta, it's assumed from the start of the recording;
            if it's datetime, it's assumed it's absolute time.