Exemplo n.º 1
0
def _get_empty_raw_with_valid_annot(fname):
    raw = _RawShell()
    raw.first_samp = 0
    edf_info, orig_units = _read_edf_header(fname=fname, annot=None,
                                            annotmap=None, exclude=())

    sfreq = _compute_sfreq_from_edf_info(edf_info)
    raw.info = _empty_info(sfreq)
    raw.info['meas_date'] = edf_info['meas_date']

    def _time_as_index(times, use_rounding, origin):
        if use_rounding:
            return np.round(np.atleast_1d(times) * sfreq)
        else:
            return np.floor(np.atleast_1d(times) * sfreq)

    raw.time_as_index = _time_as_index
    return raw
Exemplo n.º 2
0
def _get_empty_raw_with_valid_annot(fname):
    raw = _RawShell()
    raw.first_samp = 0
    edf_info = _read_edf_header(fname=fname,
                                annot=None,
                                annotmap=None,
                                exclude=())

    sfreq = _compute_sfreq_from_edf_info(edf_info)
    raw.info = _empty_info(sfreq)
    raw.info['meas_date'] = edf_info['meas_date']

    def _time_as_index(times, use_rounding, origin):
        if use_rounding:
            return np.round(np.atleast_1d(times) * sfreq)
        else:
            return np.floor(np.atleast_1d(times) * sfreq)

    raw.time_as_index = _time_as_index
    return raw