How to use the pybv.write_brainvision function in pybv

To help you get started, we’ve selected a few pybv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cbrnr / mnelab / mnelab / io / writers.py View on Github external
"""Export data to BrainVision EEG/VHDR/VMRK file (requires pybv)."""
    import pybv

    name, ext = Path(fname).stem, "".join(Path(fname).suffixes)
    parent = Path(fname).parent
    data = raw.get_data()
    fs = raw.info["sfreq"]
    ch_names = raw.info["ch_names"]
    if events is None:
        if raw.annotations:
            events = mne.events_from_annotations(raw)[0]
            dur = raw.annotations.duration * fs
            events = np.column_stack([events[:, [0, 2]], dur.astype(int)])
    else:
        events = events[:, [0, 2]]
    pybv.write_brainvision(data, fs, ch_names, name, parent, events=events)

pybv

pybv - a lightweight I/O utility for the BrainVision data format

BSD-3-Clause
Latest version published 12 hours ago

Package Health Score

76 / 100
Full package analysis