How to use pybv - 4 common examples

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 bids-standard / pybv / pybv / io.py View on Github external
def _write_vmrk_file(vmrk_fname, eeg_fname, events, meas_date):
    """Write BrainvVision marker file."""
    with codecs.open(vmrk_fname, 'w', encoding='utf-8') as fout:
        print(r'Brain Vision Data Exchange Marker File, Version 1.0', file=fout)  # noqa: E501
        print(r';Exported using pybv {}'.format(__version__), file=fout)
        print(r'', file=fout)
        print(r'[Common Infos]', file=fout)
        print(r'Codepage=UTF-8', file=fout)
        print(r'DataFile={}'.format(eeg_fname.split(os.sep)[-1]), file=fout)
        print(r'', file=fout)
        print(r'[Marker Infos]', file=fout)
        print(r'; Each entry: Mk
github bids-standard / pybv / docs / conf.py View on Github external
# see: https://sphinx.readthedocs.io/en/1.3/extensions.html
extensions = [
   'sphinx.ext.autosummary',
   'sphinx.ext.viewcode',
   'sphinx.ext.intersphinx',
   'numpydoc'
   ]

# Generate the autosummary
autosummary_generate = True

# General information about the project.
project = 'pybv'
copyright = '2018-{}, pybv developers'.format(date.today().year)
author = 'pybv developers'
version = pybv.__version__
release = version

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# Define master doc
master_doc = 'index'

# Options for HTML output
html_theme = "alabaster"
html_theme_options = {"description": "A lightweight I/O utility for the BrainVision data format.",  # noqa: E501
                      "fixed_sidebar": True,
                      "github_button": True,
                      "github_repo": "pybv",
github bids-standard / pybv / pybv / io.py View on Github external
def _write_vhdr_file(vhdr_fname, vmrk_fname, eeg_fname, data, sfreq, ch_names,
                     orientation='multiplexed', format='binary_float32',
                     resolution=1e-7, unit='µV'):
    """Write BrainvVision header file."""
    fmt = format.lower()
    bvfmt, _ = _chk_fmt(format)

    multiplexed = _chk_multiplexed(orientation)

    with codecs.open(vhdr_fname, 'w', encoding='utf-8') as fout:
        print(r'Brain Vision Data Exchange Header File Version 1.0', file=fout)
        print(r';Written using pybv {}'.format(__version__), file=fout)
        print(r'', file=fout)
        print(r'[Common Infos]', file=fout)
        print(r'Codepage=UTF-8', file=fout)
        print(r'DataFile={}'.format(op.basename(eeg_fname)), file=fout)
        print(r'MarkerFile={}'.format(op.basename(vmrk_fname)), file=fout)

        if fmt.startswith('binary'):
            print(r'DataFormat=BINARY', file=fout)

        if multiplexed:
            print(r'; DataOrientation: MULTIPLEXED=ch1,pt1, ch2,pt1 ...', file=fout)  # noqa: E501
            print(r'DataOrientation=MULTIPLEXED', file=fout)

        print(r'NumberOfChannels={}'.format(len(data)), file=fout)
        print(r'; Sampling interval in microseconds', file=fout)
        print(r'SamplingInterval={}'.format(int(1e6 / sfreq)), file=fout)
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 19 days ago

Package Health Score

78 / 100
Full package analysis